Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tofu #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
62 changes: 60 additions & 2 deletions .github/workflows/release-runner-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,60 @@ env:
VERSION: ${{ github.event.inputs.version }}

jobs:
release-tofu:
runs-on: ubuntu-latest
env:
INFRA_EXEC_NAME: tofu
strategy:
matrix:
tofu_version: [1.6.0-alpha1, 1.6.0-alpha2, 1.6.0-alpha3, 1.6.0-alpha4, 1.6.0-alpha5]
runner: [base, aws]
steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: "--debug"
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish multi-arch tofu-${{ matrix.runner }} images
uses: docker/build-push-action@v5
with:
push: true
no-cache: true
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./${{ matrix.runner }}.Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
build-args: |
BASE_IMAGE=ghcr.io/weaveworks/tf-runner:${{ env.VERSION }}-base
INFRA_EXEC_VERSION=${{ matrix.tofu_version }}
INFRA_EXEC_NAME=${{ env.INFRA_EXEC_NAME }}
INFRA_EXEC_URL_PREFIX=https://github.com/opentofu/opentofu/releases/download/v
tags: |
ghcr.io/tf-controller/${{ env.INFRA_EXEC_NAME }}-runner:${{ env.VERSION }}-${{ matrix.runner }}-tofu-${{ matrix.tofu_version }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ env.VERSION }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}

release-mpl:
runs-on: ubuntu-latest
env:
INFRA_EXEC_NAME: terraform
strategy:
matrix:
tf_version: [1.0.11, 1.1.9, 1.2.9, 1.3.10, 1.4.7, 1.5.7]
Expand Down Expand Up @@ -53,7 +105,9 @@ jobs:
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
build-args: |
BASE_IMAGE=ghcr.io/weaveworks/tf-runner:${{ env.VERSION }}-base
TF_VERSION=${{ matrix.tf_version }}
INFRA_EXEC_VERSION=${{ matrix.tf_version }}
INFRA_EXEC_NAME=${{ env.INFRA_EXEC_NAME }}
INFRA_EXEC_URL_PREFIX=https://releases.hashicorp.com/terraform/
tags: |
ghcr.io/tf-controller/tf-runner:${{ env.VERSION }}-${{ matrix.runner }}-tf-${{ matrix.tf_version }}-mpl
labels: |
Expand All @@ -66,6 +120,8 @@ jobs:

release-bsl:
runs-on: ubuntu-latest
env:
INFRA_EXEC_NAME: terraform
strategy:
matrix:
tf_version: [1.6.0-beta2]
Expand Down Expand Up @@ -99,7 +155,9 @@ jobs:
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
build-args: |
BASE_IMAGE=ghcr.io/weaveworks/tf-runner:${{ env.VERSION }}-base
TF_VERSION=${{ matrix.tf_version }}
INFRA_EXEC_VERSION=${{ matrix.tf_version }}
INFRA_EXEC_NAME=${{ env.INFRA_EXEC_NAME }}
INFRA_EXEC_URL_PREFIX=https://releases.hashicorp.com/terraform/
tags: |
ghcr.io/tf-controller/tf-runner:${{ env.VERSION }}-${{ matrix.runner }}-tf-${{ matrix.tf_version }}-bsl
labels: |
Expand Down
11 changes: 7 additions & 4 deletions aws.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-

FROM $BASE_IMAGE
ARG TARGETARCH
ARG TF_VERSION
ARG INFRA_EXEC_VERSION
ARG INFRA_EXEC_URL_PREFIX
ARG INFRA_EXEC_NAME

# Switch to root to have permissions for operations
USER root
Expand All @@ -31,9 +33,10 @@ COPY --from=aws-builder /usr/local/aws-cli/ /usr/local/aws-cli/
COPY --from=aws-builder /aws-cli-bin/ /usr/local/bin/

# terraform
ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip terraform_${TF_VERSION}_linux_${TARGETARCH}.zip
RUN unzip -q terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \
rm terraform_${TF_VERSION}_linux_${TARGETARCH}.zip && \
ADD ${INFRA_EXEC_URL_PREFIX}${INFRA_EXEC_VERSION}/${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip
RUN unzip -q ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \
rm ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip && \
mv /usr/local/bin/${INFRA_EXEC_NAME} /usr/local/bin/terraform && \
chmod +x /usr/local/bin/terraform

# Switch back to the non-root user after operations
Expand Down
11 changes: 7 additions & 4 deletions base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ ARG BASE_IMAGE
FROM $BASE_IMAGE

ARG TARGETARCH
ARG TF_VERSION
ARG INFRA_EXEC_VERSION
ARG INFRA_EXEC_URL_PREFIX
ARG INFRA_EXEC_NAME

# Switch to root to have permissions for operations
USER root

# terraform
ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip terraform_${TF_VERSION}_linux_${TARGETARCH}.zip
RUN unzip -q terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \
rm terraform_${TF_VERSION}_linux_${TARGETARCH}.zip && \
ADD ${INFRA_EXEC_URL_PREFIX}${INFRA_EXEC_VERSION}/${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip
RUN unzip -q ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \
rm ${INFRA_EXEC_NAME}_${INFRA_EXEC_VERSION}_linux_${TARGETARCH}.zip && \
mv /usr/local/bin/${INFRA_EXEC_NAME} /usr/local/bin/terraform && \
chmod +x /usr/local/bin/terraform

# Switch back to the non-root user after operations
Expand Down