From 85770038a29c5edbfcc8dac43a2e25210a5bdc18 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 7 Apr 2021 09:58:10 +0000 Subject: [PATCH] Run AWS CLI from a container image So we don't have to install it, or Python. Need to run in 'machine' executor on CircleCI so we can mount volumes into the Docker command. --- .circleci/config.yml | 6 +++--- Makefile | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2c0a4deb..47ced8a97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -179,16 +179,16 @@ jobs: path: /tmp/artifacts deploy: - <<: *defaults + machine: + image: circleci/classic:201709-01 + working_directory: /home/circleci/src/github.com/weaveworks/scope environment: IMAGES: scope cloud-agent steps: - checkout - - setup_remote_docker - attach_workspace: at: . - run: | - pip install awscli docker load -i scope.tar docker load -i cloud-agent.tar - run: | diff --git a/Makefile b/Makefile index 47aa07e21..2929ee082 100644 --- a/Makefile +++ b/Makefile @@ -202,15 +202,18 @@ $(SCOPE_BACKEND_BUILD_UPTODATE): backend/* $(SUDO) docker tag $(SCOPE_BACKEND_BUILD_IMAGE) $(SCOPE_BACKEND_BUILD_IMAGE):$(IMAGE_TAG) touch $@ +# Run aws CLI from a container image so we don't have to install Python, etc. +AWS_COMMAND=docker run $(RM) $(RUN_FLAGS) \ + -e AWS_ACCESS_KEY_ID=$$UI_BUCKET_KEY_ID \ + -e AWS_SECRET_ACCESS_KEY=$$UI_BUCKET_KEY_SECRET \ + -v $(shell pwd):/scope \ + amazon/aws-cli:2.1.35 + ui-upload: client/build-external/index.html - AWS_ACCESS_KEY_ID=$$UI_BUCKET_KEY_ID \ - AWS_SECRET_ACCESS_KEY=$$UI_BUCKET_KEY_SECRET \ - aws s3 cp client/build-external/ s3://static.weave.works/scope-ui/ --recursive --exclude '*.html' + $(AWS_COMMAND) s3 cp /scope/client/build-external/ s3://static.weave.works/scope-ui/ --recursive --exclude '*.html' ui-pkg-upload: client/bundle/weave-scope.tgz - AWS_ACCESS_KEY_ID=$$UI_BUCKET_KEY_ID \ - AWS_SECRET_ACCESS_KEY=$$UI_BUCKET_KEY_SECRET \ - aws s3 cp client/bundle/weave-scope.tgz s3://weaveworks-js-modules/weave-scope/$(shell echo $(SCOPE_VERSION))/weave-scope.tgz + $(AWS_COMMAND) s3 cp /scope/client/bundle/weave-scope.tgz s3://weaveworks-js-modules/weave-scope/$(shell echo $(SCOPE_VERSION))/weave-scope.tgz # We don't rmi images here; rm'ing the .uptodate files is enough to # get the build images rebuilt, and rm'ing the scope exe is enough to