Step: cucushift-pre

Container image used for this step: ci/verification-tests:latest

ci/verification-tests:latest resolves to an image imported from the specified imagestream tag on the build farm (documentation).

Environment

Step exposes no environmental variables except the defaults.

Source Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash

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

# prepare users
users=""
htpass_file=/tmp/users.htpasswd

for i in $(seq 1 30);
do
    username="testuser-${i}"
    password=$(< /dev/urandom tr -dc 'a-z0-9' | fold -w 12 | head -n 1 || true)
    users+="${username}:${password},"
    if [ -f "${htpass_file}" ]; then
        htpasswd -B -b ${htpass_file} "${username}" "${password}"
    else
        htpasswd -c -B -b ${htpass_file} "${username}" "${password}"
    fi
done

# current generation
gen=$(oc get deployment oauth-openshift -n openshift-authentication -o jsonpath='{.metadata.generation}')

# add users to cluster
oc create secret generic htpass-secret --from-file=htpasswd=${htpass_file} -n openshift-config
oc apply -f - <<EOF
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
  name: cluster
spec:
  identityProviders:
  - name: htpassidp
    challenge: true
    login: true
    mappingMethod: claim
    type: HTPasswd
    htpasswd:
      fileData:
        name: htpass-secret
EOF

# wait for oauth-openshift to rollout
wait_auth=true
expected_replicas=$(oc get deployment oauth-openshift -n openshift-authentication -o jsonpath='{.spec.replicas}')
while $wait_auth;
do
    available_replicas=$(oc get deployment oauth-openshift -n openshift-authentication -o jsonpath='{.status.availableReplicas}')
    new_gen=$(oc get deployment oauth-openshift -n openshift-authentication -o jsonpath='{.metadata.generation}')
    if [[ $expected_replicas == "$available_replicas" && $((new_gen)) -gt $((gen)) ]]; then
        wait_auth=false
    else
        sleep 10
    fi
done

# configure cucushift runtime environment variables
hosts=$(grep server "${KUBECONFIG}" | cut -d '/' -f 3 | cut -d ':' -f 1)
ver_cli=$(oc version --client | cut -d ' ' -f 3 | cut -d '.' -f1,2)
users=${users::-1}

runtime_env=${SHARED_DIR}/runtime_env

cat <<EOF >>"${runtime_env}"
export USERS=${users}
export CUCUMBER_PUBLISH_QUIET=true
export DISABLE_WAIT_PRINT=true
export BUSHSLICER_DEFAULT_ENVIRONMENT=ocp4
export BUSHSLICER_LOG_LEVEL=INFO
export OPENSHIFT_ENV_OCP4_HOSTS="${hosts}:lb"
export OPENSHIFT_ENV_OCP4_ADMIN_CREDS_SPEC=file:///tmp/kubeconfig
export BUSHSLICER_CONFIG="{'environments': {'ocp4': {'version': '${ver_cli}'}}}"
EOF

Properties

Property Value Description
Termination grace period[?] 10m0s Period of time until SIGKILL signal is sent to the test pod (after SIGTERM signal is sent).
Resource requests (cpu) 350m Used in .resources.requests of the pod running this step.
Resource requests (memory) 1Gi Used in .resources.requests of the pod running this step.
Resource limits (cpu) 1 Used in .resources.limits of the pod running this step.
Inject oc CLI[?] latest The oc CLI sourced from the specified release is injected into this step's' image.

GitHub Link:

https://github.com/openshift/release/blob/master/ci-operator/step-registry/cucushift/pre/cucushift-pre-ref.yaml

Owners:

Approvers:

Source code for this page located on GitHub