From 090d0d41d09a84b72db7c48a099a46f6c3b4a433 Mon Sep 17 00:00:00 2001 From: Ben Rush Date: Wed, 24 Oct 2018 11:59:01 -0400 Subject: [PATCH] Build and push docker containers to automation gcr When commits are merged to develop, trigger a build that builds containers for builder, eos, and eos-dev, and push them to a private gcr project. --- .buildkite/docker.yml | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .buildkite/docker.yml diff --git a/.buildkite/docker.yml b/.buildkite/docker.yml new file mode 100644 index 00000000000..c482abfe388 --- /dev/null +++ b/.buildkite/docker.yml @@ -0,0 +1,77 @@ +steps: + - command: | + echo "AUTHENTICATING GOOGLE SERVICE ACCOUNT" && \ + gcloud --quiet auth activate-service-account b1-automation-svc@b1-automation-dev.iam.gserviceaccount.com --key-file=/etc/gcp-service-account.json && \ + docker-credential-gcr configure-docker && \ + echo "BUILDING BUILD IMAGE" && \ + cd Docker/builder && \ + docker build -t eosio/builder:latest -t eosio/builder:$BUILDKITE_COMMIT . --build-arg branch=$BUILDKITE_COMMIT && \ + docker tag eosio/builder:$BUILDKITE_COMMIT gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT && \ + docker tag eosio/builder:latest gcr.io/b1-automation-dev/eosio/builder:latest && \ + echo "PUSHING DOCKER IMAGES" && \ + docker push gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT && \ + docker push gcr.io/b1-automation-dev/eosio/builder:latest && \ + echo "TRASHING OLD IMAGES" && \ + docker rmi eosio/builder:$BUILDKITE_COMMIT && \ + docker rmi eosio/builder:latest && \ + docker rmi gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT && \ + docker rmi gcr.io/b1-automation-dev/eosio/builder:latest + label: "Docker build builder" + agents: + role: "automation-docker-builder-fleet" + aws:instance-type: "m5d.2xlarge" + timeout: 300 + + - wait + + - command: | + echo "AUTHENTICATING GOOGLE SERVICE ACCOUNT" && \ + gcloud --quiet auth activate-service-account b1-automation-svc@b1-automation-dev.iam.gserviceaccount.com --key-file=/etc/gcp-service-account.json && \ + docker-credential-gcr configure-docker && \ + echo "BUILDING EOS IMAGE" && \ + docker pull gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT && \ + cd Docker/dev && \ + docker build -t eosio/eos:latest -t eosio/eos:$BUILDKITE_COMMIT . --build-arg branch=$BUILDKITE_BRANCH && \ + docker tag eosio/eos:$BUILDKITE_COMMIT gcr.io/b1-automation-dev/eosio/eos:$BUILDKITE_COMMIT && \ + docker tag eosio/eos:latest gcr.io/b1-automation-dev/eosio/eos:latest && \ + echo "PUSHING DOCKER IMAGES" && \ + docker push gcr.io/b1-automation-dev/eosio/eos:$BUILDKITE_COMMIT && \ + docker push gcr.io/b1-automation-dev/eosio/eos:latest && \ + echo "TRASHING OLD IMAGES" && \ + docker rmi eosio/eos:$BUILDKITE_COMMIT && \ + docker rmi eosio/eos:latest && \ + docker rmi gcr.io/b1-automation-dev/eosio/eos:$BUILDKITE_COMMIT && \ + docker rmi gcr.io/b1-automation-dev/eosio/eos:latest && \ + docker rmi gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT + label: "Docker build eos" + agents: + role: "automation-docker-builder-fleet" + aws:instance-type: "m5d.2xlarge" + timeout: 300 + + - command: | + echo "AUTHENTICATING GOOGLE SERVICE ACCOUNT" && \ + gcloud --quiet auth activate-service-account b1-automation-svc@b1-automation-dev.iam.gserviceaccount.com --key-file=/etc/gcp-service-account.json && \ + docker-credential-gcr configure-docker && \ + echo "BUILDING EOS DEV IMAGE" && \ + docker pull gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT && \ + cd Docker/dev && \ + docker build -t eosio/eos-dev:latest -t eosio/eos-dev:$BUILDKITE_COMMIT . --build-arg branch=$BUILDKITE_BRANCH && \ + docker tag eosio/eos-dev:$BUILDKITE_COMMIT gcr.io/b1-automation-dev/eosio/eos-dev:$BUILDKITE_COMMIT && \ + docker tag eosio/eos-dev:latest gcr.io/b1-automation-dev/eosio/eos-dev:latest && \ + echo "PUSHING DOCKER IMAGES" && \ + docker push gcr.io/b1-automation-dev/eosio/eos-dev:$BUILDKITE_COMMIT && \ + docker push gcr.io/b1-automation-dev/eosio/eos-dev:latest && \ + echo "TRASHING OLD IMAGES" && \ + docker rmi eosio/eos-dev:$BUILDKITE_COMMIT && \ + docker rmi eosio/eos-dev:latest && \ + docker rmi gcr.io/b1-automation-dev/eosio/eos-dev:$BUILDKITE_COMMIT && \ + docker rmi gcr.io/b1-automation-dev/eosio/eos-dev:latest && \ + docker rmi gcr.io/b1-automation-dev/eosio/builder:$BUILDKITE_COMMIT + label: "Docker build eos-dev" + agents: + role: "automation-docker-builder-fleet" + aws:instance-type: "m5d.2xlarge" + timeout: 300 + + - wait