Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL=/usr/bin/env bash -o errexit

.PHONY: help check check-core check-services dry-core core dry-services services all
.PHONY: help check check-boskos check-core check-services dry-core core dry-services services all

CONTAINER_ENGINE ?= docker

Expand All @@ -9,9 +9,13 @@ help:

all: core services

check: check-core check-services
check: check-core check-services check-boskos
@echo "Service config check: PASS"

check-boskos:
hack/validate-boskos.sh
@echo "Boskos config check: PASS"

check-core:
core-services/_hack/validate-core-services.sh core-services
@echo "Core service config check: PASS"
Expand All @@ -38,6 +42,7 @@ services:
update:
$(MAKE) jobs
$(MAKE) ci-operator-config
$(MAKE) boskos-config
$(MAKE) prow-config
$(MAKE) registry-metadata

Expand All @@ -59,6 +64,10 @@ registry-metadata:
$(CONTAINER_ENGINE) pull registry.svc.ci.openshift.org/ci/generate-registry-metadata:latest
$(CONTAINER_ENGINE) run --rm -v "$(CURDIR)/ci-operator/step-registry:/ci-operator/step-registry:z" registry.svc.ci.openshift.org/ci/generate-registry-metadata:latest --registry /ci-operator/step-registry

boskos-config:
cd core-services/prow/02_config && ./generate-boskos.py
.PHONY: boskos-config

prow-config:
$(CONTAINER_ENGINE) pull registry.svc.ci.openshift.org/ci/determinize-prow-config:latest
$(CONTAINER_ENGINE) run --rm -v "$(CURDIR)/core-services/prow/02_config:/config:z" registry.svc.ci.openshift.org/ci/determinize-prow-config:latest --prow-config-dir /config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ presubmits:
cpu: 10m
serviceAccountName: config-updater
trigger: (?m)^/test( | .* )app-ci-config-dry,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- master
cluster: build01
context: ci/prow/boskos-config
decorate: true
labels:
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-release-master-boskos-config
rerun_command: /test boskos-config
spec:
containers:
- command:
- hack/validate-boskos.sh
image: registry.svc.ci.openshift.org/ci/python-validation
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
trigger: (?m)^/test( | .* )boskos-config,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
Expand Down
3 changes: 3 additions & 0 deletions core-services/prow/02_config/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
approvers:
- dptp
- wking
118 changes: 59 additions & 59 deletions core-services/prow/02_config/_boskos.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
---
# generated with generate-boskos.py; do not edit directly
resources:
- type: aws-quota-slice
state: free
- max-count: 150
min-count: 150
max-count: 150
- type: azure4-quota-slice
state: free
type: aws-quota-slice
- max-count: 30
min-count: 30
max-count: 30
- type: gcp-quota-slice
state: free
type: azure4-quota-slice
- max-count: 120
min-count: 120
max-count: 120
- type: libvirt-s390x-quota-slice
state: free
names:
- "libvirt-s390x-0-0"
- "libvirt-s390x-0-1"
- "libvirt-s390x-0-2"
- "libvirt-s390x-0-3"
- "libvirt-s390x-0-4"
- type: libvirt-ppc64le-quota-slice
type: gcp-quota-slice
- names:
- libvirt-ppc64le-0-0
- libvirt-ppc64le-0-1
- libvirt-ppc64le-0-2
- libvirt-ppc64le-0-3
- libvirt-ppc64le-1-0
- libvirt-ppc64le-1-1
- libvirt-ppc64le-1-2
- libvirt-ppc64le-1-3
state: free
names:
- "libvirt-ppc64le-0-0"
- "libvirt-ppc64le-0-1"
- "libvirt-ppc64le-0-2"
- "libvirt-ppc64le-0-3"
- "libvirt-ppc64le-1-0"
- "libvirt-ppc64le-1-1"
- "libvirt-ppc64le-1-2"
- "libvirt-ppc64le-1-3"
- type: metal-quota-slice
type: libvirt-ppc64le-quota-slice
- names:
- libvirt-s390x-0-0
- libvirt-s390x-0-1
- libvirt-s390x-0-2
- libvirt-s390x-0-3
- libvirt-s390x-0-4
state: free
type: libvirt-s390x-quota-slice
- max-count: 1000
min-count: 1000
max-count: 1000
- type: openstack-quota-slice
state: free
type: metal-quota-slice
- names:
- openstack-osuosl-ppc64le-01
- openstack-osuosl-ppc64le-02
- openstack-osuosl-ppc64le-03
- openstack-osuosl-ppc64le-04
state: free
type: openstack-osuosl-ppc64le-quota-slice
- names:
- openstack-ppc64le-00
- openstack-ppc64le-01
- openstack-ppc64le-02
- openstack-ppc64le-03
state: free
type: openstack-ppc64le-quota-slice
- max-count: 7
min-count: 7
max-count: 7
- type: openstack-vexxhost-quota-slice
state: free
type: openstack-quota-slice
- max-count: 3
min-count: 3
max-count: 3
- type: openstack-ppc64le-quota-slice
state: free
names:
- "openstack-ppc64le-00"
- "openstack-ppc64le-01"
- "openstack-ppc64le-02"
- "openstack-ppc64le-03"
- type: openstack-osuosl-ppc64le-quota-slice
type: openstack-vexxhost-quota-slice
- names:
- ovirt-10
- ovirt-11
- ovirt-12
- ovirt-13
- ovirt-14
- ovirt-15
- ovirt-16
- ovirt-17
state: free
names:
- "openstack-osuosl-ppc64le-01"
- "openstack-osuosl-ppc64le-02"
- "openstack-osuosl-ppc64le-03"
- "openstack-osuosl-ppc64le-04"
- type: vsphere-quota-slice
type: ovirt-quota-slice
- max-count: 20
min-count: 20
state: free
type: packet-quota-slice
- max-count: 10
min-count: 10
max-count: 10
- type: ovirt-quota-slice
state: free
names:
- "ovirt-10"
- "ovirt-11"
- "ovirt-12"
- "ovirt-13"
- "ovirt-14"
- "ovirt-15"
- "ovirt-16"
- "ovirt-17"
- type: packet-quota-slice
state: free
min-count: 20
max-count: 20
type: vsphere-quota-slice
75 changes: 75 additions & 0 deletions core-services/prow/02_config/generate-boskos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env python3

import yaml


CONFIG = {
'aws-quota-slice': {
'default': 150,
},
'azure4-quota-slice': {
'default': 30,
},
'gcp-quota-slice': {
'default': 120,
},
'libvirt-s390x-quota-slice': {},
'libvirt-ppc64le-quota-slice': {},
Copy link
Contributor

@coverprice coverprice Oct 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code golf:

'libvirt-ppc64le-quota-slice': {
  f'libvirt-ppc64le-{i}-{j}': 1
  for j in range(4)
  for i in range(2)
},

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me. File a PR?

'metal-quota-slice': {
# Wild guesses. We'll see when we hit quota issues
'default': 1000,
},
'openstack-osuosl-ppc64le-quota-slice': {},
'openstack-quota-slice': {
'default': 7,
},
'openstack-vexxhost-quota-slice': {
'default': 3,
},
'openstack-ppc64le-quota-slice': {},
'ovirt-quota-slice': {},
'packet-quota-slice': {
'default': 20,
},
'vsphere-quota-slice': {
'default': 10,
},
}

for i in range(1):
for j in range(5):
CONFIG['libvirt-s390x-quota-slice']['libvirt-s390x-{}-{}'.format(i, j)] = 1

for i in range(2):
for j in range(4):
CONFIG['libvirt-ppc64le-quota-slice']['libvirt-ppc64le-{}-{}'.format(i, j)] = 1

for i in range(1, 5):
CONFIG['openstack-osuosl-ppc64le-quota-slice']['openstack-osuosl-ppc64le-{0:0>2}'.format(i)] = 1

for i in range(4):
CONFIG['openstack-ppc64le-quota-slice']['openstack-ppc64le-{0:0>2}'.format(i)] = 1

for i in range(10, 18):
CONFIG['ovirt-quota-slice']['ovirt-{}'.format(i)] = 1

config = {
'resources': [],
}

for typeName, data in sorted(CONFIG.items()):
resource = {
'type': typeName,
'state': 'free',
}
if set(data.keys()) == {'default'}:
resource['min-count'] = resource['max-count'] = data['default']
else:
resource['names'] = []
for name, count in sorted(data.items()):
resource['names'].extend([name]*count)
config['resources'].append(resource)

with open('_boskos.yaml', 'w') as f:
f.write('# generated with generate-boskos.py; do not edit directly\n')
yaml.dump(config, f, default_flow_style=False)
31 changes: 31 additions & 0 deletions hack/validate-boskos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# This script ensures that the Boskos configuration checked into git is up-to-date
# with the generator. If it is not, re-generate the configuration to update it.

set -o errexit
set -o nounset
set -o pipefail

base_dir=.

cd "${base_dir}/core-services/prow/02_config"
ORIGINAL="$(cat _boskos.yaml)"
./generate-boskos.py
DIFF="$(diff -u <(echo "${ORIGINAL}") _boskos.yaml || true)"
if test -n "${DIFF}"
then
cat << EOF
ERROR: This check enforces that the Boskos configuration is generated
ERROR: correctly. We have automation in place that updates the configuration and
ERROR: new changes to the configuration should be followed with a re-generation.

ERROR: Run the following command to re-generate the Boskos configuration:
ERROR: $ make boskos-config

ERROR: The following errors were found:

EOF
echo "${DIFF}"
exit 1
fi