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
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ tests:
commands: TEST_SUITE=openshift/conformance/parallel run-tests
openshift_installer_upi:
cluster_profile: vsphere
- as: e2e
commands: TEST_SUITE=openshift/conformance/parallel run-tests
openshift_installer_random: {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
presubmits:
openshift/installer:
- agent: kubernetes
always_run: false
branches:
- master
context: ci/prow/e2e
decorate: true
decoration_config:
skip_cloning: true
labels:
ci-operator.openshift.io/prowgen-controlled: "true"
name: pull-ci-openshift-installer-master-e2e
optional: true
rerun_command: /test e2e
spec:
containers:
- args:
- -c
- |
set -eux
target=$(awk < /usr/local/e2e-targets \
--assign "r=$RANDOM" \
'BEGIN { r /= 32767 } (r -= $1) <= 0 { print $2; exit }')
Copy link

Choose a reason for hiding this comment

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

@bbguimaraes curious - what does 32767 represent? in other words how you picked this value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-RANDOM

RANDOM

Each time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number generator.

We want a value in the range [0, 1] because that's how the ratios are expressed in the ConfigMap. That is accomplished by dividing the value we get from $RANDOM by the maximum value we can get — note: bash doesn't do floating point math.

awk has a rand function, but it has to be seeded; we could also do this:

awk < /usr/local/e2e-targets \
    --assign "r=$RANDOM" \
    'BEGIN { srand(r); r = rand() } …'

case "$target" in
aws) template=e2e; CLUSTER_TYPE=aws;;
azure) template=e2e; CLUSTER_TYPE=azure4;;
aws-upi) template=upi-e2e; CLUSTER_TYPE=aws;;
vsphere) template=upi-e2e; CLUSTER_TYPE=vsphere;;
*) echo >&2 "invalid target $target"; exit 1 ;;
esac
ln -s "/usr/local/job-definition/cluster-launch-installer-$template.yaml" /tmp/e2e
ln -s "/usr/local/cluster-profiles/$CLUSTER_TYPE" /tmp/e2e-cluster-profile
export CLUSTER_TYPE
exec ci-operator \
--artifact-dir=$(ARTIFACTS) \
--give-pr-author-access-to-namespace=true \
--secret-dir=/tmp/e2e-cluster-profile \
--sentry-dsn-path=/etc/sentry-dsn/ci-operator \
--target=e2e \
--template=/tmp/e2e
command:
- bash
env:
- name: CONFIG_SPEC
valueFrom:
configMapKeyRef:
key: openshift-installer-master.yaml
name: ci-operator-master-configs
- name: JOB_NAME_SAFE
value: e2e
- name: TEST_COMMAND
value: TEST_SUITE=openshift/conformance/parallel run-tests
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /usr/local/cluster-profiles/aws
name: cluster-profile-aws
- mountPath: /usr/local/cluster-profiles/azure4
name: cluster-profile-azure4
- mountPath: /usr/local/cluster-profiles/vsphere
name: cluster-profile-vsphere
- mountPath: /usr/local/e2e-targets
name: e2e-targets
subPath: e2e-targets
- mountPath: /usr/local/job-definition
name: job-definition
- mountPath: /etc/sentry-dsn
name: sentry-dsn
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: cluster-profile-aws
projected:
sources:
- secret:
name: cluster-secrets-aws
- name: cluster-profile-azure4
projected:
sources:
- secret:
name: cluster-secrets-azure4
- name: cluster-profile-vsphere
projected:
sources:
- secret:
name: cluster-secrets-vsphere
- configMap:
name: e2e-targets
name: e2e-targets
- name: job-definition
projected:
sources:
- configMap:
name: prow-job-cluster-launch-installer-e2e
- configMap:
name: prow-job-cluster-launch-installer-upi-e2e
- name: sentry-dsn
secret:
secretName: sentry-dsn
trigger: (?m)^/test( | .* )e2e,?($|\s.*)
- agent: kubernetes
always_run: false
branches:
Expand Down