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

Remove old build workflow and tidy up the new one. #80

Merged
merged 2 commits into from
Feb 5, 2024
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
82 changes: 36 additions & 46 deletions .github/workflows/build-multiarch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ on:
push:
branches:
- main
- dj-maisy/test_shared_matrix
schedule:
- cron: '0 3 * * *'
- cron: '34 3 * * *'

jobs:
configure_builds:
name: Configure Build Settings (from config.json)
runs-on: ubuntu-22.04
name: Read configuration from build-matrix.json
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set Matrix Data
id: set-matrix
run: echo "matrix=$(jq -c . < .github/config.json)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
show-progress: false
- id: set-matrix
run: echo "matrix=$(jq -c . < build-matrix.json)" >> $GITHUB_OUTPUT

# TODO: can we push the target arch into the build matrix to avoid duplicating these jobs?
build_and_push_amd64:
name: Build ruby_${{ join(matrix.version.rubyver, '.') }} for AMD64 and push to GHCR
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: configure_builds
strategy:
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix)}}
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix) }}
permissions:
packages: write
steps:
Expand All @@ -49,21 +49,18 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout from GitHub
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef || github.ref }}

- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v3
show-progress: false

- uses: docker/setup-buildx-action@v3

- name: Calculate Image Tags
id: calculate-image-tags
- id: calculate-image-tags
run: |
CREATED_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "createdDate=${CREATED_DATE}" >> $GITHUB_OUTPUT

- name: Generate Base Image Metadata
uses: docker/metadata-action@v5
id: base-image-metadata
Expand Down Expand Up @@ -108,8 +105,7 @@ jobs:
type=sha,enable=true,prefix=${{ join(matrix.version.rubyver, '.') }}-,suffix=-amd64,format=short
type=sha,enable=true,priority=100,format=long,prefix=${{ join(matrix.version.rubyver, '.') }}-,suffix=-amd64

- name: Build Base Image
id: build-base-image
- id: build-base-image
uses: docker/build-push-action@v5
with:
file: base.Dockerfile
Expand All @@ -124,8 +120,7 @@ jobs:
tags: ${{ steps.base-image-metadata.outputs.tags }}
labels: ${{ steps.base-image-metadata.outputs.labels }}

- name: Build Builder Image
id: build-builder-image
- id: build-builder-image
uses: docker/build-push-action@v5
with:
file: builder.Dockerfile
Expand All @@ -143,10 +138,10 @@ jobs:

build_and_push_arm64:
name: Build ruby_${{ join(matrix.version.rubyver, '.') }} for ARM64 and push to GHCR
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: configure_builds
strategy:
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix)}}
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix) }}
permissions:
packages: write
steps:
Expand All @@ -157,26 +152,23 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout from GitHub
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef || github.ref }}
show-progress: false

- name: Set up QEMU (on ARM64 Only)
- name: Set up QEMU for ARM64 build
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v3

- name: Calculate Image Tags
id: calculate-image-tags
- uses: docker/setup-buildx-action@v3

- id: calculate-image-tags
run: |
CREATED_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo "createdDate=${CREATED_DATE}" >> $GITHUB_OUTPUT

- name: Generate Base Image Metadata
uses: docker/metadata-action@v5
id: base-image-metadata
Expand Down Expand Up @@ -221,8 +213,7 @@ jobs:
type=sha,enable=true,prefix=${{ join(matrix.version.rubyver, '.') }}-,suffix=-arm64,format=short
type=sha,enable=true,priority=100,prefix=${{ join(matrix.version.rubyver, '.') }}-,suffix=-arm64,format=long

- name: Build Base Image
id: build-base-image
- id: build-base-image
uses: docker/build-push-action@v5
with:
file: base.Dockerfile
Expand All @@ -237,8 +228,7 @@ jobs:
tags: ${{ steps.base-image-metadata.outputs.tags }}
labels: ${{ steps.base-image-metadata.outputs.labels }}

- name: Build Builder Image
id: build-builder-image
- id: build-builder-image
uses: docker/build-push-action@v5
with:
file: builder.Dockerfile
Expand All @@ -261,9 +251,9 @@ jobs:
- configure_builds
- build_and_push_amd64
- build_and_push_arm64
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix)}}
matrix: ${{ fromJson(needs.configure_builds.outputs.matrix) }}
permissions:
packages: write
steps:
Expand All @@ -274,11 +264,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout from GitHub
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRef || github.ref }}

show-progress: false

- name: Create SHA manifest and push for Ruby Base Images
run: |
docker manifest create \
Expand All @@ -302,7 +292,7 @@ jobs:
--amend ghcr.io/${{ github.repository_owner }}/govuk-ruby-base:${{ join(matrix.version.rubyver, '.') }}-${{ github.sha }}-amd64 \
--amend ghcr.io/${{ github.repository_owner }}/govuk-ruby-base:${{ join(matrix.version.rubyver, '.') }}-${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/govuk-ruby-base:${{ join(matrix.version.rubyver, '.') }}

- name: Create Ruby Versioned manifest and push for Ruby Builder Images
run: |
docker manifest create \
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/build.yaml

This file was deleted.

File renamed without changes.