Skip to content

Commit 4ea92d9

Browse files
committed
step-registry: setup the commands to allow running on bastian
To enable internal clusters current plan is to run the steps from the bastian instances. Since there can be multiple of these running to isolate the binaries and files this change makes 2 changes, - WORSPACE, this defaults to /tmp All the files created as part of the steps, that are not in shared or artifact dir must be created in the WORKSPACE dir. This ensures that on bastians we can provide each test separate dir for the files. - PATH WORKSPACE is added to the PATH, this allows the wrapper to copy all the required binaries for that test to the WORKSPACE and the step can continue to use these transparently.
1 parent 63ad090 commit 4ea92d9

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed

ci-operator/step-registry/gather/extra/gather-extra-commands.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ function queue() {
1616
fi
1717
}
1818

19-
export PATH=$PATH:/tmp/shared
19+
export HOME=/tmp
20+
export WORKSPACE=${WORKSPACE:-/tmp}
21+
export PATH="${PATH}:${WORKSPACE}"
2022

2123
if test ! -f "${KUBECONFIG}"
2224
then
@@ -27,11 +29,11 @@ fi
2729
echo "Gathering artifacts ..."
2830
mkdir -p ${ARTIFACT_DIR}/pods ${ARTIFACT_DIR}/nodes ${ARTIFACT_DIR}/metrics ${ARTIFACT_DIR}/bootstrap ${ARTIFACT_DIR}/network ${ARTIFACT_DIR}/oc_cmds
2931

30-
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > /tmp/nodes
31-
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > /tmp/node-provider-IDs
32-
oc --insecure-skip-tls-verify --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> /tmp/node-provider-IDs
33-
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
34-
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/pods-api
32+
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.metadata.name}{"\n"}{end}' > ${WORKSPACE}/nodes
33+
oc --insecure-skip-tls-verify --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > ${WORKSPACE}/node-provider-IDs
34+
oc --insecure-skip-tls-verify --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> ${WORKSPACE}/node-provider-IDs
35+
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > ${WORKSPACE}/containers
36+
oc --insecure-skip-tls-verify --request-timeout=5s get pods -l openshift.io/component=api --all-namespaces --template '{{ range .items }}-n {{ .metadata.namespace }} {{ .metadata.name }}{{ "\n" }}{{ end }}' > ${WORKSPACE}/pods-api
3537

3638
queue ${ARTIFACT_DIR}/config-resources.json oc --insecure-skip-tls-verify --request-timeout=5s get apiserver.config.openshift.io authentication.config.openshift.io build.config.openshift.io console.config.openshift.io dns.config.openshift.io featuregate.config.openshift.io image.config.openshift.io infrastructure.config.openshift.io ingress.config.openshift.io network.config.openshift.io oauth.config.openshift.io project.config.openshift.io scheduler.config.openshift.io -o json
3739
queue ${ARTIFACT_DIR}/apiservices.json oc --insecure-skip-tls-verify --request-timeout=5s get apiservices -o json
@@ -94,30 +96,30 @@ FILTER=gzip queue ${ARTIFACT_DIR}/openapi.json.gz oc --insecure-skip-tls-verify
9496
while IFS= read -r i; do
9597
mkdir -p ${ARTIFACT_DIR}/nodes/$i
9698
queue ${ARTIFACT_DIR}/nodes/$i/heap oc --insecure-skip-tls-verify get --request-timeout=20s --raw /api/v1/nodes/$i/proxy/debug/pprof/heap
97-
done < /tmp/nodes
99+
done < ${WORKSPACE}/nodes
98100

99101
FILTER=gzip queue ${ARTIFACT_DIR}/nodes/masters-journal.gz oc --insecure-skip-tls-verify adm node-logs --role=master --unify=false
100102
FILTER=gzip queue ${ARTIFACT_DIR}/nodes/masters-journal-previous.gz oc --insecure-skip-tls-verify adm node-logs --boot=-1 --role=master --unify=false
101103
FILTER=gzip queue ${ARTIFACT_DIR}/nodes/workers-journal.gz oc --insecure-skip-tls-verify adm node-logs --role=worker --unify=false
102104
FILTER=gzip queue ${ARTIFACT_DIR}/nodes/workers-journal-previous.gz oc --insecure-skip-tls-verify adm node-logs --boot=-1 --role=worker --unify=false
103105

104106
# Snapshot iptables-save on each node for debugging possible kube-proxy issues
105-
oc --insecure-skip-tls-verify get --request-timeout=20s -n openshift-sdn -l app=sdn pods --template '{{ range .items }}{{ .metadata.name }}{{ "\n" }}{{ end }}' > /tmp/sdn-pods
107+
oc --insecure-skip-tls-verify get --request-timeout=20s -n openshift-sdn -l app=sdn pods --template '{{ range .items }}{{ .metadata.name }}{{ "\n" }}{{ end }}' > ${WORKSPACE}/sdn-pods
106108
while IFS= read -r i; do
107109
queue ${ARTIFACT_DIR}/network/iptables-save-$i oc --insecure-skip-tls-verify rsh --timeout=20 -n openshift-sdn -c sdn $i iptables-save -c
108-
done < /tmp/sdn-pods
110+
done < ${WORKSPACE}/sdn-pods
109111

110112
while IFS= read -r i; do
111113
file="$( echo "$i" | cut -d ' ' -f 3 | tr -s ' ' '_' )"
112114
queue ${ARTIFACT_DIR}/metrics/${file}-heap oc --insecure-skip-tls-verify exec $i -- /bin/bash -c 'oc --insecure-skip-tls-verify get --raw /debug/pprof/heap --server "https://$( hostname ):8443" --config /etc/origin/master/admin.kubeconfig'
113115
queue ${ARTIFACT_DIR}/metrics/${file}-controllers-heap oc --insecure-skip-tls-verify exec $i -- /bin/bash -c 'oc --insecure-skip-tls-verify get --raw /debug/pprof/heap --server "https://$( hostname ):8444" --config /etc/origin/master/admin.kubeconfig'
114-
done < /tmp/pods-api
116+
done < ${WORKSPACE}/pods-api
115117

116118
while IFS= read -r i; do
117119
file="$( echo "$i" | cut -d ' ' -f 2,3,5 | tr -s ' ' '_' )"
118120
FILTER=gzip queue ${ARTIFACT_DIR}/pods/${file}.log.gz oc --insecure-skip-tls-verify logs --request-timeout=20s $i
119121
FILTER=gzip queue ${ARTIFACT_DIR}/pods/${file}_previous.log.gz oc --insecure-skip-tls-verify logs --request-timeout=20s -p $i
120-
done < /tmp/containers
122+
done < ${WORKSPACE}/containers
121123

122124
echo "Snapshotting prometheus (may take 15s) ..."
123125
queue ${ARTIFACT_DIR}/metrics/prometheus.tar.gz oc --insecure-skip-tls-verify exec -n openshift-monitoring prometheus-k8s-0 -- tar cvzf - -C /prometheus .

ci-operator/step-registry/gather/must-gather/gather-must-gather-commands.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ set -o nounset
44
set -o errexit
55
set -o pipefail
66

7+
export HOME=/tmp
8+
export WORKSPACE=${WORKSPACE:-/tmp}
9+
export PATH="${PATH}:${WORKSPACE}"
10+
711
if test ! -f "${KUBECONFIG}"
812
then
913
echo "No kubeconfig, so no point in calling must-gather."

ci-operator/step-registry/ipi/deprovision/deprovision/ipi-deprovision-deprovision-commands.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,26 @@ trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wa
99
export AWS_SHARED_CREDENTIALS_FILE=$CLUSTER_PROFILE_DIR/.awscred
1010
export AZURE_AUTH_LOCATION=$CLUSTER_PROFILE_DIR/osServicePrincipal.json
1111
export GOOGLE_CLOUD_KEYFILE_JSON=$CLUSTER_PROFILE_DIR/gce.json
12+
export HOME=/tmp
13+
export WORKSPACE=${WORKSPACE:-/tmp}
14+
export PATH="${PATH}:${WORKSPACE}"
1215

1316
echo "Deprovisioning cluster ..."
1417
if [[ ! -s "${SHARED_DIR}/metadata.json" ]]; then
1518
echo "Skipping: ${SHARED_DIR}/metadata.json not found."
1619
exit
1720
fi
1821

19-
cp -ar "${SHARED_DIR}" /tmp/installer
20-
openshift-install --dir /tmp/installer destroy cluster &
22+
dir=${WORKSPACE}/installer
23+
mkdir -p "${dir}/"
24+
cp -ar "${SHARED_DIR}"/* "${dir}/"
25+
openshift-install --dir "${dir}" destroy cluster &
2126

2227
set +e
2328
wait "$!"
2429
ret="$?"
2530
set -e
2631

27-
cp /tmp/installer/.openshift_install.log "${ARTIFACT_DIR}"
32+
cp "${dir}"/.openshift_install.log "${ARTIFACT_DIR}"
2833

2934
exit "$ret"

ci-operator/step-registry/ipi/install/install/ipi-install-install-commands.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export PULL_SECRET_PATH=${CLUSTER_PROFILE_DIR}/pull-secret
1616
export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=${RELEASE_IMAGE_LATEST}
1717
export OPENSHIFT_INSTALL_INVOKER=openshift-internal-ci/${JOB_NAME}/${BUILD_ID}
1818
export HOME=/tmp
19+
export WORKSPACE=${WORKSPACE:-/tmp}
20+
export PATH="${PATH}:${WORKSPACE}"
1921

2022
case "${CLUSTER_TYPE}" in
2123
aws) export AWS_SHARED_CREDENTIALS_FILE=${CLUSTER_PROFILE_DIR}/.awscred;;
@@ -25,8 +27,8 @@ vsphere) ;;
2527
*) echo >&2 "Unsupported cluster type '${CLUSTER_TYPE}'"
2628
esac
2729

28-
dir=/tmp/installer
29-
mkdir "${dir}/"
30+
dir=${WORKSPACE}/installer
31+
mkdir -p "${dir}/"
3032
cp "${SHARED_DIR}/install-config.yaml" "${dir}/"
3133

3234
# move private key to ~/.ssh/ so that installer can use it to gather logs on

ci-operator/step-registry/openshift/e2e/test/openshift-e2e-test-commands.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ set -o pipefail
77
export AWS_SHARED_CREDENTIALS_FILE=${CLUSTER_PROFILE_DIR}/.awscred
88
export AZURE_AUTH_LOCATION=${CLUSTER_PROFILE_DIR}/osServicePrincipal.json
99
export GCP_SHARED_CREDENTIALS_FILE=${CLUSTER_PROFILE_DIR}/gce.json
10-
export HOME=/tmp/home
11-
export PATH=/usr/libexec/origin:$PATH
10+
export HOME=/tmp
11+
export WORKSPACE=${WORKSPACE:-/tmp}
12+
export PATH=/usr/libexec/origin:${WORKSPACE}:$PATH
1213

1314
trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM
1415

15-
mkdir -p "${HOME}"
16-
1716
# if the cluster profile included an insights secret, install it to the cluster to
1817
# report support data from the support-operator
1918
if [[ -f "${CLUSTER_PROFILE_DIR}/insights-live.yaml" ]]; then
@@ -47,16 +46,16 @@ vsphere) export TEST_PROVIDER=vsphere;;
4746
*) echo >&2 "Unsupported cluster type '${CLUSTER_TYPE}'"; exit 1;;
4847
esac
4948

50-
mkdir -p /tmp/output
51-
cd /tmp/output
49+
mkdir -p ${WORKSPACE}/output
50+
cd ${WORKSPACE}/output
5251

5352
if [[ "${CLUSTER_TYPE}" == gcp ]]; then
54-
pushd /tmp
53+
pushd ${WORKSPACE}
5554
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-256.0.0-linux-x86_64.tar.gz
5655
tar -xzf google-cloud-sdk-256.0.0-linux-x86_64.tar.gz
57-
export PATH=$PATH:/tmp/google-cloud-sdk/bin
56+
export PATH=$PATH:${WORKSPACE}/google-cloud-sdk/bin
5857
mkdir gcloudconfig
59-
export CLOUDSDK_CONFIG=/tmp/gcloudconfig
58+
export CLOUDSDK_CONFIG=${WORKSPACE}/gcloudconfig
6059
gcloud auth activate-service-account --key-file="${GCP_SHARED_CREDENTIALS_FILE}"
6160
gcloud config set project openshift-gce-devel-ci
6261
popd
@@ -69,5 +68,5 @@ fi
6968

7069
openshift-tests run "${test_suite}" \
7170
--provider "${TEST_PROVIDER}" \
72-
-o /tmp/artifacts/e2e.log \
73-
--junit-dir /tmp/artifacts/junit
71+
-o ${ARTIFACT_DIR}/e2e.log \
72+
--junit-dir ${ARTIFACT_DIR}/junit

0 commit comments

Comments
 (0)