Skip to content

Commit

Permalink
Add separate image with az cli (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
msamendinger authored May 4, 2023
1 parent 6d73d44 commit fcd3bed
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
deployment:
strategy:
matrix:
target: [aws, gcp]
target: [aws, gcp, azure]
platform: [linux/amd64, linux/arm64]
name: Build the image
runs-on: ubuntu-latest
Expand All @@ -39,3 +39,4 @@ jobs:
set: |
${{ matrix.target }}.tags=runner-terraform:${{ github.sha }}
${{ matrix.target }}.platform=${{ matrix.platform }}
12 changes: 12 additions & 0 deletions .github/workflows/publish_future.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ jobs:
bake_set: |
gcp.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:gcp-future
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-future
- name: Build and push future image (w/ az cli)
uses: ./.github/workflows/publish
with:
bake_target: azure
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_release: false
bake_set: |
azure.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-future
azure.tags=ghcr.io/spacelift-io/runner-terraform:azure-future
21 changes: 21 additions & 0 deletions .github/workflows/publish_scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ jobs:
- `${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:gcp-${{ steps.tag.outputs.TAG }}`
- `ghcr.io/spacelift-io/runner-terraform:gcp-latest`
- `ghcr.io/spacelift-io/runner-terraform:gcp-${{ steps.tag.outputs.TAG }}`
### Image with az cli
- `${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-latest`
- `${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-${{ steps.tag.outputs.TAG }}`
- `ghcr.io/spacelift-io/runner-terraform:azure-latest`
- `ghcr.io/spacelift-io/runner-terraform:azure-${{ steps.tag.outputs.TAG }}`
bake_set: |
aws.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:latest
aws.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:${{ steps.tag.outputs.TAG }}
Expand All @@ -89,3 +95,18 @@ jobs:
gcp.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:gcp-${{ steps.tag.outputs.TAG }}
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-latest
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-${{ steps.tag.outputs.TAG }}
- name: Build and push weekly image (w/ az cli)
uses: ./.github/workflows/publish
with:
bake_target: azure
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
git_tag: ${{ steps.latest-tag.outputs.tag }}
publish_release: false
bake_set: |
azure.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-latest
azure.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-${{ steps.tag.outputs.TAG }}
azure.tags=ghcr.io/spacelift-io/runner-terraform:azure-latest
azure.tags=ghcr.io/spacelift-io/runner-terraform:azure-${{ steps.tag.outputs.TAG }}
17 changes: 16 additions & 1 deletion .github/workflows/publish_tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,19 @@ jobs:
gcp.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:gcp-latest
gcp.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:gcp-${{ steps.latest-tag.outputs.tag }}
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-latest
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-${{ steps.latest-tag.outputs.tag }}
gcp.tags=ghcr.io/spacelift-io/runner-terraform:gcp-${{ steps.latest-tag.outputs.tag }}
- name: Build and push latest image (w/ az cli)
uses: ./.github/workflows/publish
with:
bake_target: azure
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
git_tag: ${{ steps.latest-tag.outputs.tag }}
publish_release: false
bake_set: |
azure.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-latest
azure.tags=${{ secrets.PUBLIC_RUNNER_TERRAFORM_ECR_REPOSITORY_URL }}:azure-${{ steps.latest-tag.outputs.tag }}
azure.tags=ghcr.io/spacelift-io/runner-terraform:azure-latest
azure.tags=ghcr.io/spacelift-io/runner-terraform:azure-${{ steps.latest-tag.outputs.tag }}
3 changes: 2 additions & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
strategy:
matrix:
target: [aws, gcp]
target: [aws, gcp, azure]
platform: [linux/amd64, linux/arm64]
name: Analyze
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,3 +58,4 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results.sarif"

10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ RUN gcloud --version && \
infracost --version

USER spacelift

FROM base AS azure

RUN az --version && \
terragrunt --version && \
python --version && \
infracost --version

USER spacelift

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ with ECR.

## Images

We publish two images. The default has `aws` CLI v2 included, the other has `gcloud`.
This is because `gcloud` is a very large package and we want to keep the image size down.
We publish three images. The default has `aws` CLI v2 included, the others
`gcloud` and `az` respectively.
This is because `gcloud` and `az` are very large packages and we want to keep the image size down.

- `spacelift-io/runner-terraform:latest` -> with `aws` CLI
- `spacelift-io/runner-terraform:gcp-latest` -> with `gcloud` CLI
- `spacelift-io/runner-terraform:azure-latest` -> with `az` CLI

## Branch Model

Expand All @@ -29,3 +31,4 @@ $ git push origin v1.1.0
```

We also have a weekly cron job that re-runs the `main` branch just to have the latest package updates.

9 changes: 8 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ target "gcp" {
target = "gcp"
platforms = ["linux/amd64", "linux/arm64"]
args = {"BASE_IMAGE": "gcr.io/google.com/cloudsdktool/google-cloud-cli:alpine"}
}
}

target "azure" {
target = "azure"
platforms = ["linux/amd64", "linux/arm64"]
args = {"BASE_IMAGE": "mcr.microsoft.com/azure-cli:2.48.1"}
}

0 comments on commit fcd3bed

Please sign in to comment.