-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make build image actions matrix actions, and add filespace cleanup to…
… create (#2871)
- Loading branch information
Showing
2 changed files
with
23 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,11 @@ on: | |
|
||
jobs: | ||
check-linux-build-image: | ||
strategy: | ||
matrix: | ||
build: | ||
- runtime: golang:1.24.0-alpine3.21 | ||
- runtime: mcr.microsoft.com/oss/go/microsoft/golang:1.24.0-bookworm | ||
runs-on: ubuntu-22.04 # related to https://github.com/docker/setup-qemu-action/issues/198 | ||
steps: | ||
- name: Checkout | ||
|
@@ -37,36 +42,4 @@ jobs: | |
push: false | ||
tags: grafana/alloy-build-image:latest | ||
build-args: | | ||
GO_RUNTIME=golang:1.24.0-alpine3.21 | ||
check-linux-boringcrypto-build-image: | ||
runs-on: ubuntu-22.04 # related to https://github.com/docker/setup-qemu-action/issues/198 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Remove unnecessary files | ||
run: | | ||
rm -rf /usr/share/dotnet | ||
rm -rf "$AGENT_TOOLSDIRECTORY" | ||
rm -rf /opt/ghc | ||
rm -rf "/usr/local/share/boost" | ||
rm -rf /opt/hostedtoolcache | ||
- name: Setup QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:qemu-v7.0.0-28 # https://github.com/docker/setup-qemu-action/issues/198 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Create test Linux build image for boring crypto | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./tools/build-image | ||
push: false | ||
tags: grafana/alloy-build-image:latest | ||
build-args: | | ||
GO_RUNTIME=mcr.microsoft.com/oss/go/microsoft/golang:1.24.0-bookworm | ||
GO_RUNTIME=${{ matrix.build.runtime }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,63 +11,30 @@ permissions: | |
jobs: | ||
linux_build_image: | ||
name: Create a Linux build image | ||
runs-on: | ||
labels: ubuntu-22.04 # related to https://github.com/docker/setup-qemu-action/issues/198 | ||
strategy: | ||
matrix: | ||
build: | ||
- runtime: golang:1.24.0-alpine3.21 | ||
- runtime: mcr.microsoft.com/oss/go/microsoft/golang:1.24.0-bookworm | ||
suffix: "-boringcrypto" | ||
runs-on: ubuntu-22.04 # related to https://github.com/docker/setup-qemu-action/issues/198 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache: false | ||
|
||
- name: Get version from Git tag | ||
env: | ||
FULL_TAG: ${{ github.ref_name }} | ||
id: get_image_version | ||
run: echo "image_tag=${FULL_TAG##*/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Login to DockerHub (from vault) | ||
uses: grafana/shared-workflows/actions/[email protected] | ||
|
||
- name: Setup QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:qemu-v7.0.0-28 # https://github.com/docker/setup-qemu-action/issues/198 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Create Linux build image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./tools/build-image | ||
tags: grafana/alloy-build-image:${{ steps.get_image_version.outputs.image_tag }} | ||
build-args: | | ||
GO_RUNTIME=golang:1.24.0-alpine3.21 | ||
linux_build_image_boringcrypto: | ||
name: Create a Linux build image for boringcrypto | ||
runs-on: | ||
labels: ubuntu-22.04 # related to https://github.com/docker/setup-qemu-action/issues/198 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache: false | ||
- name: Remove unnecessary files | ||
run: | | ||
rm -rf /usr/share/dotnet | ||
rm -rf "$AGENT_TOOLSDIRECTORY" | ||
rm -rf /opt/ghc | ||
rm -rf "/usr/local/share/boost" | ||
rm -rf /opt/hostedtoolcache | ||
- name: Get version from Git tag | ||
env: | ||
FULL_TAG: ${{ github.ref_name }} | ||
id: get_image_version | ||
run: echo "image_tag=${FULL_TAG##*/}-boringcrypto" >> $GITHUB_OUTPUT | ||
run: echo "image_tag=${FULL_TAG##*/}${{ matrix.build.suffix }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Login to DockerHub (from vault) | ||
uses: grafana/shared-workflows/actions/[email protected] | ||
|
@@ -85,6 +52,7 @@ jobs: | |
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./tools/build-image | ||
push: true | ||
tags: grafana/alloy-build-image:${{ steps.get_image_version.outputs.image_tag }} | ||
build-args: | | ||
GO_RUNTIME=mcr.microsoft.com/oss/go/microsoft/golang:1.24.0-bullseye | ||
GO_RUNTIME=${{ matrix.build.runtime }} |