Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

API Release Workflow

Derek Dohler edited this page Aug 21, 2023 · 6 revisions

AWS Credentials

Using the AWS CLI, create an AWS profile named climate:

$ aws --profile climate configure
AWS Access Key ID [****************F2DQ]:
AWS Secret Access Key [****************TLJ/]:
Default region name [us-east-1]: us-east-1
Default output format [None]:

You will be prompted to enter your AWS credentials, along with a default region. These credentials will be used to authenticate calls to the AWS API when using Terraform and the AWS CLI.

Create Release Branches

First, create release branches for the version about to be released. Ensure that you create release branches for each repository involved in the release:

$ git flow release start X.Y.Z

Update Change Log

Thus far, the CHANGELOG has been generated by github-changelog-generator. Follow the steps below to install and execute github-changelog-generator to update the CHANGELOG:

$ export GITHUB_TOKEN=<your github token>
$ docker run -ti --rm -v ${PWD}:/changelog -w /changelog \ 
  quay.io/azavea/github-changelog-generator:v1.14.3 \
      --token ${GITHUB_TOKEN} \
      --future-release X.Y.Z \
      --no-issues \
      --no-author

Publish Release Branches

Next, publish the release branch, but do so knowing that Jenkins will automatically attempt to deploy it to staging:

$ git flow release publish X.Y.Z

Once published, monitor the Branches tab of the Jenkins UI for a release/* job to begin:

Production Release

The commands in this section should be run from within the VM.

Once sufficient testing has occurred on the release, identify the first seven characters of the release branch SHA. The most consistent way to do this is to peek at the Jenkins release branch job output:

Attempting to deploy application version [f74dc17]...
-----------------------------------------------------

Then, export it as an environment variable:

$ export GIT_COMMIT="..."

Next, export all of the other necessary environment variables and execute cibuild, cipublish, and infra:

$ export CC_DOCS_FILES_BUCKET="production-us-east-1-climate-docs"
$ export CC_SETTINGS_BUCKET="production-us-east-1-climate-config"
$ export CC_S3STORAGE_BUCKET="climate-change-api-production"
$ export CC_AWS_ECR_ENDPOINT="784347171332.dkr.ecr.us-east-1.amazonaws.com"
$ ./scripts/cibuild
$ ./scripts/cipublish
$ docker-compose -f docker-compose.ci.yml run --rm terraform ./scripts/infra plan
$ docker-compose -f docker-compose.ci.yml run --rm terraform ./scripts/infra apply

The prefix for CC_AWS_ECR_ENDPOINT may be found here in the AWS console.

Repository Cleanup

Execute the following commands to merge the contents of the release branch back into develop and master:

$ git flow release finish X.Y.Z

Lastly, push your changes up to the origin repository:

$ git push origin develop
$ git checkout master
$ git push origin master
$ git push --tags