Skip to content

Commit

Permalink
Merge pull request #451 from codenrhoden/e2e-new-images
Browse files Browse the repository at this point in the history
Change e2e script/job to use new image locations
  • Loading branch information
k8s-ci-robot authored Jul 25, 2019
2 parents 0e25314 + da5ea39 commit 5c29835
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 58 deletions.
22 changes: 0 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ CWD := $(abspath .)
# nested GOPATH.
SHELL := hack/shell-with-gopath.sh

# Image URL to use all building/pushing image targets
CI_IMG ?= gcr.io/cnx-cluster-api/vsphere-cluster-api-provider
CLUSTERCTL_CI_IMG ?= gcr.io/cnx-cluster-api/clusterctl

# Retrieves the git hash
VERSION ?= $(shell git describe --always --dirty)

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

###################################
# CI Build and Push targets
###################################

ci-image: generate fmt vet manifests
docker build . -t "$(CI_IMG):$(VERSION)"
docker build . -f cmd/clusterctl/Dockerfile -t "$(CLUSTERCTL_CI_IMG):$(VERSION)"

ci-push: ci-image
# Log into the registry with a service account file. In CI, GCR_KEY_FILE contains the content and not the file name.
@echo "logging into gcr.io registry with key file"
@echo $$GCR_KEY_FILE | docker login -u _json_key --password-stdin gcr.io
docker push "$(CI_IMG):$(VERSION)"
docker push "$(CLUSTERCTL_CI_IMG):$(VERSION)"
@echo docker logout gcr.io

.PHONY: ci-yaml ci-image ci-push

################################################################################
## The default targets ##
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test-infra/config/jobs/kubernetes-sigs/cluster-api-provider-vsphere

## Containers

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).
The CAPV manager images are hosted at [`gcr.io/cluster-api-provider-vsphere`](gcr.io/cluster-api-provider-vsphere).

## Test CI locally

Expand Down
17 changes: 3 additions & 14 deletions scripts/e2e/bootstrap_job.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ spec:
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
initContainers:
- name: clusterctl-bin
image: gcr.io/cnx-cluster-api/clusterctl:${VERSION}
command: ['sh', '-c', 'cp /root/clusterctl /tmp/clusterctl/clusterctl && chmod +x /tmp/clusterctl/clusterctl']
volumeMounts:
- name: shared-data
mountPath: /tmp/clusterctl
containers:
- name: cluster-api-provider-vsphere-ci
image: gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci:${VERSION}
image: gcr.io/cluster-api-provider-vsphere/pr/ci:${VERSION}
env:
- name: CLUSTERCTL_VERSION
value: ${VERSION}
- name: TARGET_VM_PREFIX
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -65,12 +60,6 @@ spec:
secretKeyRef:
name: clusterapi-provider-vsphere-ci-secret
key: bootstrap-kubeconfig
volumeMounts:
- name: shared-data
mountPath: /tmp/clusterctl/
command:
- "./clusterctl.sh"
volumes:
- name: shared-data
emptyDir: {}
restartPolicy: Never
7 changes: 5 additions & 2 deletions scripts/e2e/bootstrap_job/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile

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

all: build
.PHONY : all
Expand All @@ -16,9 +16,12 @@ build: copyspec

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

clean:
docker image rm -f $(REGISTRY):$(VERSION)
Expand Down
10 changes: 7 additions & 3 deletions scripts/e2e/bootstrap_job/clusterctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ do
fi
done
wget https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl \
--no-verbose -O /usr/local/bin/kubectl
--no-verbose -O /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl

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

# run clusterctl
echo "test ${PROVIDER_COMPONENT_SPEC}"
/tmp/clusterctl/clusterctl create cluster -e ~/.kube/config -c ./spec/cluster.yml \
clusterctl create cluster -e ~/.kube/config -c ./spec/cluster.yml \
-m ./spec/machines.yml \
-p ./spec/"${PROVIDER_COMPONENT_SPEC}" \
-a ./spec/addons.yml \
--provider vsphere \
-v 6
-v 6

ret=$?
if [ "$ret" != 0 ]; then
Expand Down
21 changes: 7 additions & 14 deletions scripts/e2e/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ apply_secret_to_bootstrap() {
echo "test ${provider_component}"

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

Expand Down Expand Up @@ -162,24 +162,16 @@ on_exit() {

# the main loop
trap on_exit EXIT
vsphere_controller_version=""
if [ -z "${PROW_JOB_ID}" ] ; then
CONTEXT="debug"
start_docker
vsphere_controller_version=$(shell git describe --always --dirty)
else
CONTEXT="prow"
if [ -z "${PULL_PULL_SHA}" ] ; then
# for periodic job
vsphere_controller_version="${PROW_JOB_ID}"
else
# for presubmit job
vsphere_controller_version="${PULL_PULL_SHA}"
fi
fi

export VERSION="${vsphere_controller_version}"
echo "build vSphere controller version: ${vsphere_controller_version}"
VERSION=$(git describe --dirty --always 2>/dev/null)
export VERSION
echo "build vSphere controller version: ${VERSION}"

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

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

# get bootstrap VM
Expand All @@ -206,7 +199,7 @@ kubeconfig_path=$(run_cmd_on_bootstrap "${bootstrap_vm_ip}" "kind get kubeconfig
run_cmd_on_bootstrap "${bootstrap_vm_ip}" "sed -i s/localhost/${bootstrap_vm_ip}/g ${kubeconfig_path}"
kubeconfig=$(run_cmd_on_bootstrap "${bootstrap_vm_ip}" "cat ${kubeconfig_path}")
export BOOTSTRAP_KUBECONFIG="${kubeconfig}"
apply_secret_to_bootstrap "${vsphere_controller_version}"
apply_secret_to_bootstrap "${VERSION}"

# launch the job at bootstrap cluster
fill_file_with_value "bootstrap_job.template"
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e/hack/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile

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

all: build push clean
.PHONY : all
Expand Down
2 changes: 1 addition & 1 deletion scripts/e2e/hack/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
key: node-role.kubernetes.io/master
containers:
- name: cluster-api-provider-vsphere-ci
image: gcr.io/cnx-cluster-api/cluster-api-provider-vsphere-ci-debug:debug
image: gcr.io/cluster-api-provider-vsphere/pr/ci-debug:debug
imagePullPolicy: Never
securityContext:
privileged: true
Expand Down

0 comments on commit 5c29835

Please sign in to comment.