Skip to content

Commit

Permalink
feat: make published Docker images multi-platform, add linux/arm64 pl…
Browse files Browse the repository at this point in the history
…at (#2395)
  • Loading branch information
v1v authored Jul 10, 2024
1 parent 980658e commit a540168
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
67 changes: 64 additions & 3 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ env:
jobs:
release:
runs-on: ubuntu-latest

env:
DOCKER_IMAGE_NAME: "docker.elastic.co/observability/apm-agent-dotnet"
PREFIX_APM_AGENT: "build/output/ElasticApmAgent_"
PREFIX_APM_PROFILER: "build/output/elastic_apm_profiler_"
SUFFIX_APM_AGENT: ".zip"
SUFFIX_APM_PROFILER: "-linux-x64.zip"
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
Expand All @@ -40,9 +45,65 @@ jobs:

- name: publish canary packages github package repository
run: dotnet nuget push 'build/output/_packages/*.nupkg' -k ${{secrets.GITHUB_TOKEN}} -s https://nuget.pkg.github.com/elastic/index.json --skip-duplicate --no-symbols


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: Log in to the Elastic Container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }}
username: ${{ secrets.ELASTIC_DOCKER_USERNAME }}
password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels)
id: docker-meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
flavor: |
latest=auto
tags: |
# "1.2.3" and "latest" Docker tags on push of git tag "v1.2.3"
type=raw,value=${{ steps.bootstrap.outputs.agent-version }}
# "edge" Docker tag on git push to default branch
type=edge
- name: Build and Push Profiler Docker Image
id: docker-push
continue-on-error: true # continue for now until we see it working in action
uses: docker/build-push-action@31159d49c0d4756269a0940a750801a1ea5d7003 # v6.1.0
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
build-args: |
AGENT_ZIP_FILE=${{ env.PREFIX_APM_PROFILER }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_PROFILER }}
- name: Attest image
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
continue-on-error: true # continue for now until we see it working in action
with:
subject-name: ${{ env.DOCKER_IMAGE_NAME }}
subject-digest: ${{ steps.docker-push.outputs.digest }}
push-to-registry: true

- name: generate build provenance (APM Agent)
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ github.workspace }}/${{ env.PREFIX_APM_AGENT }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_AGENT }}"

- name: generate build provenance (APM Profiler)
uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "${{ github.workspace }}/${{ env.PREFIX_APM_PROFILER }}${{ steps.bootstrap.outputs.agent-version }}${{ env.SUFFIX_APM_PROFILER }}"

- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/send@v1.7.0
uses: elastic/oblt-actions/slack/send@v1
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#apm-agent-dotnet"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
Expand Down

0 comments on commit a540168

Please sign in to comment.