Skip to content

Commit 0e2aad1

Browse files
authored
Remove depending on PULL_NUMBER in e2e (kubernetes#2516)
I'm not exactly sure why our e2e tests attempted to pull the code on their own based on the `PULL_NUMBER` envvar passed from the test system, but it should be unnecessary. We should expect the code to test is placed properly in the `GOPATH`. This should help with issues with merging multiple PRs at the same time, when tide tends to bind them together to make sure our daily merge capacity is higher than 24h/<time-to-execute-longest-tests>.`
1 parent 35ff405 commit 0e2aad1

File tree

12 files changed

+40
-69
lines changed

12 files changed

+40
-69
lines changed

tests/ci-csi-cinder-e2e.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ set -o pipefail
2929

3030
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
3131
cd "${REPO_ROOT}" || exit 1
32-
# PULL_NUMBER and PULL_BASE_REF are Prow job environment variables
33-
PR_NUMBER="${PULL_NUMBER:-}"
34-
[[ -z $PR_NUMBER ]] && echo "PR_NUMBER is required" && exit 1
32+
GOPATH=${PWD%/*/*/*} # /home/prow/go will be 3 directories up from where code is
3533
CONFIG_ANSIBLE="${CONFIG_ANSIBLE:-"true"}"
3634
RESOURCE_TYPE="${RESOURCE_TYPE:-"gce-project"}"
3735
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
@@ -97,15 +95,19 @@ stdout_callback = debug
9795
EOF
9896
fi
9997

98+
# Upload CPO code
99+
scp -i ~/.ssh/google_compute_engine \
100+
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
101+
-r ${GOPATH}/* ${USERNAME}@${PUBLIC_IP}:/root/
102+
100103
# Run ansible playbook on the CI host, e.g. a VM in GCP
101104
# USERNAME and PUBLIC_IP are global env variables set after creating the CI host.
102105
ansible-playbook -v \
103106
--user ${USERNAME} \
104107
--private-key ~/.ssh/google_compute_engine \
105108
--inventory ${PUBLIC_IP}, \
106109
--ssh-common-args "-o StrictHostKeyChecking=no" \
107-
tests/playbooks/test-csi-cinder-e2e.yaml \
108-
-e github_pr=${PR_NUMBER}
110+
tests/playbooks/test-csi-cinder-e2e.yaml
109111
exit_code=$?
110112

111113
# Fetch cinder-csi tests logs for debugging purpose

tests/ci-csi-manila-e2e.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ set -o pipefail
2929

3030
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
3131
cd "${REPO_ROOT}" || exit 1
32-
# PULL_NUMBER and PULL_BASE_REF are Prow job environment variables
33-
PR_NUMBER="${PULL_NUMBER:-}"
34-
[[ -z $PR_NUMBER ]] && echo "PR_NUMBER is required" && exit 1
32+
GOPATH=${PWD%/*/*/*} # /home/prow/go will be 3 directories up from where code is
3533
CONFIG_ANSIBLE="${CONFIG_ANSIBLE:-"true"}"
3634
RESOURCE_TYPE="${RESOURCE_TYPE:-"gce-project"}"
3735
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
@@ -97,15 +95,19 @@ stdout_callback = debug
9795
EOF
9896
fi
9997

98+
# Upload CPO code
99+
scp -i ~/.ssh/google_compute_engine \
100+
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
101+
-r ${GOPATH}/* ${USERNAME}@${PUBLIC_IP}:/root/
102+
100103
# Run ansible playbook on the CI host, e.g. a VM in GCP
101104
# USERNAME and PUBLIC_IP are global env variables set after creating the CI host.
102105
ansible-playbook -v \
103106
--user ${USERNAME} \
104107
--private-key ~/.ssh/google_compute_engine \
105108
--inventory ${PUBLIC_IP}, \
106109
--ssh-common-args "-o StrictHostKeyChecking=no" \
107-
tests/playbooks/test-csi-manila-e2e.yaml \
108-
-e github_pr=${PR_NUMBER}
110+
tests/playbooks/test-csi-manila-e2e.yaml
109111
exit_code=$?
110112

111113
# Fetch manila-csi tests results

tests/ci-occm-e2e.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ set -o pipefail
2929

3030
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
3131
cd "${REPO_ROOT}" || exit 1
32-
# PULL_NUMBER and PULL_BASE_REF are Prow job environment variables
33-
PR_NUMBER="${PULL_NUMBER:-}"
34-
[[ -z $PR_NUMBER ]] && echo "PR_NUMBER is required" && exit 1
32+
GOPATH=${PWD%/*/*/*} # /home/prow/go will be 3 directories up from where code is
3533
CONFIG_ANSIBLE="${CONFIG_ANSIBLE:-"true"}"
3634
RESOURCE_TYPE="${RESOURCE_TYPE:-"gce-project"}"
3735
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
@@ -98,6 +96,11 @@ stdout_callback = debug
9896
EOF
9997
fi
10098

99+
# Upload CPO code
100+
scp -i ~/.ssh/google_compute_engine \
101+
-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
102+
-r ${GOPATH}/* ${USERNAME}@${PUBLIC_IP}:/root/
103+
101104
# Run ansible playbook on the CI host, e.g. a VM in GCP
102105
# USERNAME and PUBLIC_IP are global env variables set after creating the CI host.
103106
ansible-playbook -v \
@@ -106,15 +109,14 @@ ansible-playbook -v \
106109
--inventory ${PUBLIC_IP}, \
107110
--ssh-common-args "-o StrictHostKeyChecking=no" \
108111
tests/playbooks/test-occm-e2e.yaml \
109-
-e github_pr=${PR_NUMBER} \
110112
-e octavia_provider=${OCTAVIA_PROVIDER} \
111113
-e run_e2e=true
112114
exit_code=$?
113115

114116
# Fetch devstack logs for debugging purpose
115-
#scp -i ~/.ssh/google_compute_engine \
116-
# -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
117-
# -r ${USERNAME}@${PUBLIC_IP}:/opt/stack/logs $ARTIFACTS/logs/devstack || true
117+
# scp -i ~/.ssh/google_compute_engine \
118+
# -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
119+
# -r ${USERNAME}@${PUBLIC_IP}:/opt/stack/logs $ARTIFACTS/logs/devstack || true
118120

119121
# Fetch octavia amphora image build logs for debugging purpose
120122
scp -i ~/.ssh/google_compute_engine \

tests/playbooks/roles/install-cpo-occm/defaults/main.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
github_pr: ""
32
devstack_workdir: "{{ ansible_user_dir }}/devstack"
43

54
# Used for uploading image to local registry.

tests/playbooks/roles/install-cpo-occm/tasks/main.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
rm -rf $GOPATH/src/k8s.io/cloud-provider-openstack
7-
mkdir -p $GOPATH/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
9-
cd cloud-provider-openstack
10-
if [[ {{ github_pr }} != "" ]]; then
11-
git fetch origin +refs/pull/{{ github_pr }}/merge
12-
git checkout FETCH_HEAD; git checkout -b PR{{ github_pr }}
6+
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7+
mkdir -p $GOPATH/src/k8s.io; cd $_
8+
git clone https://github.com/kubernetes/cloud-provider-openstack
139
fi
1410
1511
- name: Build and upload openstack-cloud-controller-manager image
1612
shell:
1713
executable: /bin/bash
1814
cmd: |
1915
cd $GOPATH/src/k8s.io/cloud-provider-openstack
20-
VERSION="latest"
21-
if [[ {{ github_pr }} != "" ]]; then
22-
VERSION=v0.0.{{ github_pr }}
23-
fi
16+
VERSION="v0.0.99" # Fake version, but in proper format.
2417
2518
make push-multiarch-image-openstack-cloud-controller-manager \
2619
ARCHS='amd64' \
@@ -76,10 +69,8 @@
7669
shell:
7770
executable: /bin/bash
7871
cmd: |
79-
VERSION="latest"
80-
if [[ {{ github_pr }} != "" ]]; then
81-
VERSION=v0.0.{{ github_pr }}
82-
fi
72+
VERSION="v0.0.99" # Fake version, but in proper format.
73+
8374
cd $GOPATH/src/k8s.io/cloud-provider-openstack
8475
# replace image with built image
8576
sed -i "s#registry.k8s.io/provider-os/openstack-cloud-controller-manager:[^'\"]\+#{{ remote_registry_host }}/openstack-cloud-controller-manager:${VERSION}#" manifests/controller-manager/openstack-cloud-controller-manager-ds.yaml

tests/playbooks/roles/install-csi-cinder/defaults/main.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
github_pr: ""
32
devstack_workdir: "{{ ansible_user_dir }}/devstack"
43

54
# Used for uploading image to local registry.

tests/playbooks/roles/install-csi-cinder/tasks/main.yaml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
rm -rf $GOPATH/src/k8s.io/cloud-provider-openstack
7-
mkdir -p $GOPATH/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
9-
cd cloud-provider-openstack
10-
if [[ {{ github_pr }} != "" ]]; then
11-
git fetch origin +refs/pull/{{ github_pr }}/merge
12-
git checkout FETCH_HEAD; git checkout -b PR{{ github_pr }}
6+
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7+
mkdir -p $GOPATH/src/k8s.io; cd $_
8+
git clone https://github.com/kubernetes/cloud-provider-openstack
139
fi
1410
1511
- name: Build and upload cinder-csi-plugin image
1612
shell:
1713
executable: /bin/bash
1814
cmd: |
1915
cd $GOPATH/src/k8s.io/cloud-provider-openstack
20-
VERSION="latest"
21-
if [[ {{ github_pr }} != "" ]]; then
22-
VERSION=v0.0.{{ github_pr }}
23-
fi
16+
VERSION="v0.0.99" # Fake version, but in proper format.
2417
2518
make push-multiarch-image-cinder-csi-plugin \
2619
ARCHS='amd64' \
@@ -65,10 +58,7 @@
6558
6659
sed -i "/cloud\.conf/c\ cloud.conf: $b64data" manifests/cinder-csi-plugin/csi-secret-cinderplugin.yaml
6760
68-
VERSION="latest"
69-
if [[ {{ github_pr }} != "" ]]; then
70-
VERSION=v0.0.{{ github_pr }}
71-
fi
61+
VERSION="v0.0.99" # Fake version, but in proper format.
7262
# replace image with built image
7363
sed -i "s#registry.k8s.io/provider-os/cinder-csi-plugin:[^'\"]\+#{{ remote_registry_host }}/cinder-csi-plugin:${VERSION}#" manifests/cinder-csi-plugin/cinder-csi-controllerplugin.yaml
7464
sed -i "s#registry.k8s.io/provider-os/cinder-csi-plugin:[^'\"]\+#{{ remote_registry_host }}/cinder-csi-plugin:${VERSION}#" manifests/cinder-csi-plugin/cinder-csi-nodeplugin.yaml

tests/playbooks/roles/install-csi-manila/defaults/main.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
github_pr: ""
32
devstack_workdir: "{{ ansible_user_dir }}/devstack"
43

54
# Used for uploading image to local registry.

tests/playbooks/roles/install-csi-manila/tasks/main.yaml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
rm -rf {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
7-
mkdir -p {{ ansible_user_dir }}/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
9-
cd cloud-provider-openstack
10-
if [[ {{ github_pr }} != "" ]]; then
11-
git fetch origin +refs/pull/{{ github_pr }}/merge
12-
git checkout FETCH_HEAD; git checkout -b PR{{ github_pr }}
6+
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7+
mkdir -p $GOPATH/src/k8s.io; cd $_
8+
git clone https://github.com/kubernetes/cloud-provider-openstack
139
fi
1410
1511
- name: Build and upload manila-csi-plugin image
1612
shell:
1713
executable: /bin/bash
1814
cmd: |
19-
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
20-
VERSION="latest"
21-
if [[ {{ github_pr }} != "" ]]; then
22-
VERSION=v0.0.{{ github_pr }}
23-
fi
15+
cd $GOPATH/src/k8s.io/cloud-provider-openstack
16+
VERSION="v0.0.99" # Fake version, but in proper format.
2417
2518
make push-multiarch-image-manila-csi-plugin \
2619
ARCHS='amd64' \
@@ -124,10 +117,7 @@
124117
shell:
125118
executable: /bin/bash
126119
cmd: |
127-
VERSION="latest"
128-
if [[ {{ github_pr }} != "" ]]; then
129-
VERSION=v0.0.{{ github_pr }}
130-
fi
120+
VERSION="v0.0.99" # Fake version, but in proper format.
131121
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack/charts/manila-csi-plugin
132122
cat <<EOF >> override-helm-values.yaml
133123
csimanila:

tests/playbooks/test-csi-cinder-e2e.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
vars:
77
e2e_test_version: v1.29.0
88
user: stack
9-
github_pr: 123
109
global_env: {}
1110
devstack_workdir: /home/{{ user }}/devstack
1211

0 commit comments

Comments
 (0)