Skip to content

Commit 5c29835

Browse files
authored
Merge pull request #451 from codenrhoden/e2e-new-images
Change e2e script/job to use new image locations
2 parents 0e25314 + da5ea39 commit 5c29835

File tree

8 files changed

+25
-58
lines changed

8 files changed

+25
-58
lines changed

Makefile

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ CWD := $(abspath .)
2626
# nested GOPATH.
2727
SHELL := hack/shell-with-gopath.sh
2828

29-
# Image URL to use all building/pushing image targets
30-
CI_IMG ?= gcr.io/cnx-cluster-api/vsphere-cluster-api-provider
31-
CLUSTERCTL_CI_IMG ?= gcr.io/cnx-cluster-api/clusterctl
32-
3329
# Retrieves the git hash
3430
VERSION ?= $(shell git describe --always --dirty)
3531

@@ -89,24 +85,6 @@ vendor:
8985
cp -rf --no-preserve=mode "$${_src}" "$${_dst}"
9086
.PHONY: vendor
9187

92-
###################################
93-
# CI Build and Push targets
94-
###################################
95-
96-
ci-image: generate fmt vet manifests
97-
docker build . -t "$(CI_IMG):$(VERSION)"
98-
docker build . -f cmd/clusterctl/Dockerfile -t "$(CLUSTERCTL_CI_IMG):$(VERSION)"
99-
100-
ci-push: ci-image
101-
# Log into the registry with a service account file. In CI, GCR_KEY_FILE contains the content and not the file name.
102-
@echo "logging into gcr.io registry with key file"
103-
@echo $$GCR_KEY_FILE | docker login -u _json_key --password-stdin gcr.io
104-
docker push "$(CI_IMG):$(VERSION)"
105-
docker push "$(CLUSTERCTL_CI_IMG):$(VERSION)"
106-
@echo docker logout gcr.io
107-
108-
.PHONY: ci-yaml ci-image ci-push
109-
11088
################################################################################
11189
## The default targets ##
11290
################################################################################

scripts/e2e/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ test-infra/config/jobs/kubernetes-sigs/cluster-api-provider-vsphere
6767

6868
## Containers
6969

70-
The CAPV manager images are hosted at [`gcr.io/cnx-cluster-api/vsphere-cluster-api-provider`](gcr.io/cnx-cluster-api/vsphere-cluster-api-provider). The images for CI are hosted at [`gcr/cnx-cluster-api/cluster-api-provider-vsphere-ci`](gcr/cnx-cluster-api/cluster-api-provider-vsphere-ci).
70+
The CAPV manager images are hosted at [`gcr.io/cluster-api-provider-vsphere`](gcr.io/cluster-api-provider-vsphere).
7171

7272
## Test CI locally
7373

scripts/e2e/bootstrap_job.template

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ spec:
99
tolerations:
1010
- effect: NoSchedule
1111
key: node-role.kubernetes.io/master
12-
initContainers:
13-
- name: clusterctl-bin
14-
image: gcr.io/cnx-cluster-api/clusterctl:${VERSION}
15-
command: ['sh', '-c', 'cp /root/clusterctl /tmp/clusterctl/clusterctl && chmod +x /tmp/clusterctl/clusterctl']
16-
volumeMounts:
17-
- name: shared-data
18-
mountPath: /tmp/clusterctl
1912
containers:
2013
- name: cluster-api-provider-vsphere-ci
21-
image: gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci:${VERSION}
14+
image: gcr.io/cluster-api-provider-vsphere/pr/ci:${VERSION}
2215
env:
16+
- name: CLUSTERCTL_VERSION
17+
value: ${VERSION}
2318
- name: TARGET_VM_PREFIX
2419
valueFrom:
2520
secretKeyRef:
@@ -65,12 +60,6 @@ spec:
6560
secretKeyRef:
6661
name: clusterapi-provider-vsphere-ci-secret
6762
key: bootstrap-kubeconfig
68-
volumeMounts:
69-
- name: shared-data
70-
mountPath: /tmp/clusterctl/
7163
command:
7264
- "./clusterctl.sh"
73-
volumes:
74-
- name: shared-data
75-
emptyDir: {}
7665
restartPolicy: Never

scripts/e2e/bootstrap_job/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile
22

33
VERSION ?= $(shell git describe --always --dirty)
4-
REGISTRY ?=gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci
4+
REGISTRY ?=gcr.io/cluster-api-provider-vsphere/pr/ci
55

66
all: build
77
.PHONY : all
@@ -16,9 +16,12 @@ build: copyspec
1616

1717
push: build
1818
@echo "logging into gcr.io registry with key file"
19-
@echo $$GCR_KEY_FILE | docker login -u _json_key --password-stdin gcr.io
19+
# TODO hardcoded key file location is a temp workaround
20+
gcloud auth activate-service-account --key-file /root/.capv/keyfile.json
21+
docker login -u _json_key --password-stdin gcr.io </root/.capv/keyfile.json
2022
docker push $(REGISTRY):$(VERSION)
2123
@echo docker logout gcr.io
24+
gcloud auth revoke
2225

2326
clean:
2427
docker image rm -f $(REGISTRY):$(VERSION)

scripts/e2e/bootstrap_job/clusterctl.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,22 @@ do
5959
fi
6060
done
6161
wget https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl \
62-
--no-verbose -O /usr/local/bin/kubectl
62+
--no-verbose -O /usr/local/bin/kubectl
6363
chmod +x /usr/local/bin/kubectl
6464

65+
# download clusterctl binary
66+
wget https://storage.googleapis.com/capv-pr/"${CLUSTERCTL_VERSION}"/bin/linux/amd64/clusterctl \
67+
--no-verbose -O /usr/local/bin/clusterctl
68+
chmod +x /usr/local/bin/clusterctl
6569

6670
# run clusterctl
6771
echo "test ${PROVIDER_COMPONENT_SPEC}"
68-
/tmp/clusterctl/clusterctl create cluster -e ~/.kube/config -c ./spec/cluster.yml \
72+
clusterctl create cluster -e ~/.kube/config -c ./spec/cluster.yml \
6973
-m ./spec/machines.yml \
7074
-p ./spec/"${PROVIDER_COMPONENT_SPEC}" \
7175
-a ./spec/addons.yml \
7276
--provider vsphere \
73-
-v 6
77+
-v 6
7478

7579
ret=$?
7680
if [ "$ret" != 0 ]; then

scripts/e2e/e2e.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ apply_secret_to_bootstrap() {
119119
echo "test ${provider_component}"
120120

121121
echo "test controller version $1"
122-
vsphere_controller_version="gcr.io/cnx-cluster-api/vsphere-cluster-api-provider:$1"
122+
local vsphere_controller_version="gcr.io/cluster-api-provider-vsphere/pr/manager:$1"
123123
export_base64_value "VSPHERE_CONTROLLER_VERSION" "${vsphere_controller_version}"
124124
echo "test ${vsphere_controller_version}"
125125

@@ -162,24 +162,16 @@ on_exit() {
162162

163163
# the main loop
164164
trap on_exit EXIT
165-
vsphere_controller_version=""
166165
if [ -z "${PROW_JOB_ID}" ] ; then
167166
CONTEXT="debug"
168167
start_docker
169-
vsphere_controller_version=$(shell git describe --always --dirty)
170168
else
171169
CONTEXT="prow"
172-
if [ -z "${PULL_PULL_SHA}" ] ; then
173-
# for periodic job
174-
vsphere_controller_version="${PROW_JOB_ID}"
175-
else
176-
# for presubmit job
177-
vsphere_controller_version="${PULL_PULL_SHA}"
178-
fi
179170
fi
180171

181-
export VERSION="${vsphere_controller_version}"
182-
echo "build vSphere controller version: ${vsphere_controller_version}"
172+
VERSION=$(git describe --dirty --always 2>/dev/null)
173+
export VERSION
174+
echo "build vSphere controller version: ${VERSION}"
183175

184176
# set target cluster vm name prefix
185177
get_random_str
@@ -190,7 +182,8 @@ export_base64_value "TARGET_VM_PREFIX" "${TARGET_VM_PRE}"
190182
go get -u github.com/vmware/govmomi/govc
191183

192184
# Push new container images
193-
make ci-push
185+
# TODO the `-k` flag here is a workaround until we can set GCR_KEY_FILE properly
186+
hack/release.sh -t pr -p -k /root/.capv/keyfile.json
194187
cd ./scripts/e2e/bootstrap_job && make push && cd .. || exit 1
195188

196189
# get bootstrap VM
@@ -206,7 +199,7 @@ kubeconfig_path=$(run_cmd_on_bootstrap "${bootstrap_vm_ip}" "kind get kubeconfig
206199
run_cmd_on_bootstrap "${bootstrap_vm_ip}" "sed -i s/localhost/${bootstrap_vm_ip}/g ${kubeconfig_path}"
207200
kubeconfig=$(run_cmd_on_bootstrap "${bootstrap_vm_ip}" "cat ${kubeconfig_path}")
208201
export BOOTSTRAP_KUBECONFIG="${kubeconfig}"
209-
apply_secret_to_bootstrap "${vsphere_controller_version}"
202+
apply_secret_to_bootstrap "${VERSION}"
210203

211204
# launch the job at bootstrap cluster
212205
fill_file_with_value "bootstrap_job.template"

scripts/e2e/hack/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile
22

33
VERSION ?= $(shell git describe --always --dirty)
4-
REGISTRY ?=gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci-debug
4+
REGISTRY ?=gcr.io/cluster-api-provider-vsphere/pr/ci-debug
55

66
all: build push clean
77
.PHONY : all

scripts/e2e/hack/job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
key: node-role.kubernetes.io/master
1212
containers:
1313
- name: cluster-api-provider-vsphere-ci
14-
image: gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci-debug:debug
14+
image: gcr.io/cluster-api-provider-vsphere/pr/ci-debug:debug
1515
imagePullPolicy: Never
1616
securityContext:
1717
privileged: true

0 commit comments

Comments
 (0)