Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Adding E2E cluster name as a parameter for CloudBuild #1611

Merged
merged 5 commits into from Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions build/e2e-image/entrypoint.sh
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
set -e
FEATURES=$1
TEST_CLUSTER_NAME=$2

echo $FEATURES
export SHELL="/bin/bash"
export KUBECONFIG="/root/.kube/config"
Expand All @@ -25,13 +27,13 @@ if [ "$1" = 'local' ]
then
gcloud auth login
fi
gcloud container clusters get-credentials e2e-test-cluster \
gcloud container clusters get-credentials $TEST_CLUSTER_NAME \
--zone=us-west1-c --project=agones-images
kubectl port-forward statefulset/consul 8500:8500 &
echo "Waiting consul port-forward to launch on 8500..."
timeout 60 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' 127.0.0.1 8500
echo "consul port-forward launched. Starting e2e tests..."
echo "consul lock -child-exit-code=true -timeout 30m -try 30m -verbose LockE2E '/root/e2e.sh "$FEATURES""
echo "consul lock -child-exit-code=true -timeout 30m -try 30m -verbose LockE2E '/root/e2e.sh "$FEATURES"'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this apostrophe correct? Should there be a partner somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should result in '/root/e2e.sh $FEATURES'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is echo command. From Cloud build:

Step #22 - "e2e-stable": Handling connection for 8500
Step #22 - "e2e-stable": consul port-forward launched. Starting e2e tests...
Step #22 - "e2e-stable": consul lock -child-exit-code=true -timeout 30m -try 30m -verbose LockE2E '/root/e2e.sh '
Step #21 - "e2e-feature-gates": Handling connection for 8500
Step #21 - "e2e-feature-gates": consul port-forward launched. Starting e2e tests...
Step #21 - "e2e-feature-gates": consul lock -child-exit-code=true -timeout 30m -try 30m -verbose LockE2E '/root/e2e.sh PlayerTracking=true&ContainerPortAllocation=true'

consul lock -child-exit-code=true -timeout 30m -try 30m -verbose LockE2E '/root/e2e.sh "'$FEATURES'"'
killall -q kubectl || true
echo "successfully killed kubectl proxy"
8 changes: 5 additions & 3 deletions build/includes/google-cloud.mk
Expand Up @@ -40,11 +40,12 @@ clean-gcloud-test-cluster: $(ensure-build-image)

# Creates a gcloud cluster for end-to-end
# it installs also a consul cluster to handle build system concurrency using a distributed lock
gcloud-e2e-test-cluster: TEST_CLUSTER_NAME ?= e2e-test-cluster
gcloud-e2e-test-cluster: $(ensure-build-image)
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
deployment-manager deployments create e2e-test-cluster \
deployment-manager deployments create $(TEST_CLUSTER_NAME) \
--config=$(mount_path)/build/gke-test-cluster/cluster-e2e.yml
$(MAKE) gcloud-auth-cluster GCP_CLUSTER_NAME=e2e-test-cluster GCP_CLUSTER_ZONE=us-west1-c
$(MAKE) gcloud-auth-cluster GCP_CLUSTER_NAME=$(TEST_CLUSTER_NAME) GCP_CLUSTER_ZONE=us-west1-c
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
kubectl apply -f $(mount_path)/build/helm.yaml
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
Expand All @@ -53,10 +54,11 @@ gcloud-e2e-test-cluster: $(ensure-build-image)
helm install --wait --set Replicas=1,uiService.type=ClusterIP --name consul stable/consul

# Deletes the gcloud e2e cluster and cleanup any left pvc volumes
clean-gcloud-e2e-test-cluster: TEST_CLUSTER_NAME ?= e2e-test-cluster
clean-gcloud-e2e-test-cluster: $(ensure-build-image)
-docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
helm delete --purge consul && kubectl delete pvc -l component=consul-consul
$(MAKE) clean-gcloud-test-cluster GCP_CLUSTER_NAME=e2e-test-cluster
$(MAKE) clean-gcloud-test-cluster GCP_CLUSTER_NAME=$(TEST_CLUSTER_NAME)

# Creates a gcloud cluster for prow
gcloud-prow-build-cluster: $(ensure-build-image)
Expand Down
5 changes: 2 additions & 3 deletions cloudbuild.yaml
Expand Up @@ -231,7 +231,7 @@ steps:
#

- name: 'e2e-runner'
args: ['PlayerTracking=true&ContainerPortAllocation=true']
args: ['PlayerTracking=true&ContainerPortAllocation=true', 'e2e-test-cluster']
id: e2e-feature-gates
waitFor:
- push-images
Expand All @@ -242,10 +242,9 @@ steps:
#

- name: 'e2e-runner'
args: ['']
args: ['', 'e2e-test-cluster']
id: e2e-stable
waitFor:
- e2e-feature-gates
- push-images
- build-e2e

Expand Down