Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# The following parameters are required:
# - GITHUB_ORG
# - GITHUB_REPO
# - CIRCLECI_TOKEN
# - REPOSITORY
# - CIRCLECI_API_KEY
#

AWS_ACCESS_KEY_ID := $(shell aws secretsmanager get-secret-value --secret-id=ci-user-aws-keys | jq -r '.SecretString'| jq -r .access_key_id)
AWS_SECRET_ACCESS_KEY := $(shell aws secretsmanager get-secret-value --secret-id=ci-user-aws-keys | jq -r '.SecretString'| jq -r .secret_key)
AWS_ACCESS_KEY_ID := $(shell aws secretsmanager get-secret-value --secret-id=ci-user-aws-keys${randomSeed} | jq -r '.SecretString'| jq -r .access_key_id)
AWS_SECRET_ACCESS_KEY := $(shell aws secretsmanager get-secret-value --secret-id=ci-user-aws-keys${randomSeed} | jq -r '.SecretString'| jq -r .secret_key)
GITHUB_ORG := $(shell echo ${REPOSITORY} | cut -d "/" -f 2)
GITHUB_REPO := $(shell echo ${REPOSITORY} | cut -d "/" -f 3)

run:
@echo "Set CIRCLECI environment variables\n"
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_ACCESS_KEY_ID", "value":"${AWS_ACCESS_KEY_ID}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_TOKEN}
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_SECRET_ACCESS_KEY", "value":"${AWS_SECRET_ACCESS_KEY}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_TOKEN}
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_ACCESS_KEY_ID", "value":"${AWS_ACCESS_KEY_ID}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_API_KEY}
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_SECRET_ACCESS_KEY", "value":"${AWS_SECRET_ACCESS_KEY}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_API_KEY}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY passed in as args now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, no. Just missed that they were referenced in there. Added them back in.

@echo "\nFollow CIRCLECI project"
curl -X POST https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/follow?circle-token=${CIRCLECI_TOKEN}
curl -X POST https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/follow?circle-token=${CIRCLECI_API_KEY}
@echo "\nDone"

3 changes: 3 additions & 0 deletions zero-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ parameters:
- field: stagingBackendSubdomain
label: Staging Backend Host Name (e.g. api.)
default: api.
- field: randomSeed
label: Random seed that will be shared between projects to come up with deterministic resource names
execute: uuidgen | head -c 8