Skip to content

Commit

Permalink
⬆️ Simplify release workflow, rework image tagging strategy and prepa…
Browse files Browse the repository at this point in the history
…re TF 0.13 beta 3 release (#34)

* ⬆️ updated default tf and aws cli versions

* 👷 simplify release workflow, added support for TF 0.13 beta3

* 📝 updated image tag documentation

* ✏️ update included tools doc

* ✨ review by pyaillet

Co-authored-by: Pierre-Yves Aillet <pyaillet@users.noreply.github.com>

Co-authored-by: Pierre-Yves Aillet <pyaillet@users.noreply.github.com>
  • Loading branch information
bgauduch and pyaillet committed Jul 8, 2020
1 parent ec3101e commit 6c14906
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
release:
types: [published]

env:
ORGANIZATION: "zenika"
IMAGE_NAME: "terraform-aws-cli"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -28,40 +24,40 @@ jobs:

strategy:
matrix:
versions:
- { tf_version: "0.11.14", awscli_version: "1.18.85" }
- { tf_version: "0.12.26", awscli_version: "1.18.85" }
- { tf_version: "0.13.0-beta2", awscli_version: "1.18.85" }
tf_version:
- "0.11.14"
- "0.12.28"
- "0.13.0-beta3"

env:
TF_VERSION: ${{ matrix.versions.tf_version }}
AWS_CLI_VERSIOIN: ${{ matrix.versions.awscli_version }}
IMAGE_TAG: "tf${{ matrix.versions.tf_version }}-awscli${{ matrix.versions.awscli_version }}"
ORGANIZATION: "zenika"
IMAGE_NAME: "terraform-aws-cli"
AWS_CLI_VERSION: "1.18.93"

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Get and save release tag
- name: Get and save the release tag
run: echo "::set-env name=RELEASE_TAG::${GITHUB_REF##*/}"

- name: Build and save image release tag
run: echo "::set-env name=IMAGE_RELEASE_TAG::r${RELEASE_TAG}-${IMAGE_TAG}"
- name: Build and save the image release tag
run: echo "::set-env name=IMAGE_TAG::release-${RELEASE_TAG}_terraform-${{ matrix.tf_version }}_awscli-${AWS_CLI_VERSION}"

- name: Build image
run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=$TF_VERSION --build-arg AWS_CLI_VERSION=$AWS_CLI_VERSIOIN --tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG
run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=${{ matrix.tf_version }} --build-arg AWS_CLI_VERSION=${AWS_CLI_VERSION} --tag ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_TAG}

- name: Login to Docker Hub registry
run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Push image to registry
run: docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG
run: docker push ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_TAG}

- name: Save image
run: docker image save -o $IMAGE_NAME-$IMAGE_RELEASE_TAG.tar $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG
run: docker image save -o ${IMAGE_NAME}-${IMAGE_TAG}.tar ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_TAG}

- name: Upload image artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_RELEASE_TAG }}
path: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_RELEASE_TAG }}.tar
name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_TAG }}
path: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_TAG }}.tar
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup build arguments with default versions
ARG AWS_CLI_VERSION=1.18.85
ARG TERRAFORM_VERSION=0.12.26
ARG AWS_CLI_VERSION=1.18.93
ARG TERRAFORM_VERSION=0.12.28
ARG PYTHON_MAJOR_VERSION=3.7
ARG DEBIAN_VERSION=buster-20200514-slim

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Available image tags can be found on the Docker Hub registry: [zenika/terraform-
The following image tag strategy is applied:
* `zenika/terraform-aws-cli:latest` - build from master
* Included CLI versions can be found in the [Dockerfile](https://github.com/Zenika/terraform-aws-cli/blob/master/Dockerfile)
* `zenika/terraform-aws-cli:rS.T-tfUU.VV.WW-awscliXX.YY.ZZ` - build from releases
* `rS.T` is the release tag
* `tfUU.VV.WWW` is the Terraform version included in the image
* `awscliXX.YY.ZZ` is the AWS CLI version included in the image
* `zenika/terraform-aws-cli:release-S.T_terraform-UU.VV.WW_awscli-XX.YY.ZZ` - build from releases
* `release-S.T` is the release tag
* `terraform-UU.VV.WWW` is the Terraform version included in the image
* `awscli-XX.YY.ZZ` is the AWS CLI version included in the image

Please report to the [releases page](https://github.com/Zenika/terraform-aws-cli/releases) for the changelogs. Any other tags are not supported.

Expand All @@ -29,10 +29,10 @@ This image gives you the flexibility to be used for development or as a base ima
Tools included:

* [AWS CLI](https://aws.amazon.com/fr/cli/)
* Included version indicated in the image tag: `awscliXX.YY.ZZ`
* Included version indicated in the image tag: `awscli-XX.YY.ZZ`
* See available version on the [pip repository](https://pypi.org/project/awscli/#history)
* [Terraform CLI](https://www.terraform.io/docs/commands/index.html)
* Included version indicated in the image tag: `tfXX.YY.ZZ`
* Included version indicated in the image tag: `terraform-XX.YY.ZZ`
* See available versions on the [project release page](https://github.com/hashicorp/terraform/releases)
* [Git](https://git-scm.com/) for Terraform remote module usage, see available versions on the [Debian Packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=git)
* [jq](https://stedolan.github.io/jq/) to process JSON returned by AWS, see available versions on the [Debian Packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=jq)
Expand Down Expand Up @@ -71,8 +71,8 @@ Optionally, it is possible to choose the tools desired versions using [Docker bu
```bash
# Set tools desired versions
AWS_CLI_VERSION=1.18.85
TERRAFORM_VERSION=0.12.26
AWS_CLI_VERSION=1.18.93
TERRAFORM_VERSION=0.12.28

# launch the build script with parameters
./dev-build.sh $AWS_CLI_VERSION $TERRAFORM_VERSION
Expand Down
4 changes: 2 additions & 2 deletions tests/container-structure-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ commandTests:
- name: "Check Terraform CLI version"
command: "terraform"
args: ["version"]
expectedOutput: ["Terraform v0.12.26"]
expectedOutput: ["Terraform v0.12.28"]

- name: "Check AWS CLI version"
command: "aws"
args: ["--version"]
expectedOutput: ["aws-cli/1.18.85"]
expectedOutput: ["aws-cli/1.18.93"]

0 comments on commit 6c14906

Please sign in to comment.