Skip to content

ci: provide arm64 image #13520

ci: provide arm64 image

ci: provide arm64 image #13520

Workflow file for this run

name: image
on:
pull_request:
push:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-image:
strategy:
matrix:
arch: ["amd64", "arm64"]
runs-on: |-
${{fromJson('{
"amd64": "ubuntu-20.04",
"arm64": "ubuntu-22.04-arm"
}')[matrix.arch] }}
env:
IMG_VERSIONED: ghcr.io/getsentry/snuba:${{ matrix.arch }}-${{ github.sha }}
steps:
- uses: actions/checkout@v4
- name: Docker Login
run: docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
- run: docker buildx create --driver docker-container --use
- name: build versioned image
run: |
set -euxo pipefail
docker buildx build \
--platform linux/${{ matrix.arch }} \
--tag "$IMG_VERSIONED" \
--target application \
.
- name: push all images
if: ${{ (github.ref_name == 'master') }}
run: |
docker push "$IMG_VERSIONED"
assemble:
needs: build-image
if: ${{ (github.ref_name == 'master') }}
runs-on: ubuntu-20.04
steps:
- name: Docker Login
run: docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
- name: Assemble Sha Image
run: |
docker manifest create \
'ghcr.io/getsentry/snuba:${{ github.sha }}' \
'ghcr.io/getsentry/snuba:arm64-${{ github.sha }}' \
'ghcr.io/getsentry/snuba:amd64-${{ github.sha }}'
docker manifest push ghcr.io/getsentry/snuba:${{ github.sha }}
- name: Assemble Latest Image
run: |
docker manifest create \
'ghcr.io/getsentry/snuba:latest' \
'ghcr.io/getsentry/snuba:arm64-${{ github.sha }}' \
'ghcr.io/getsentry/snuba:amd64-${{ github.sha }}'
docker manifest push ghcr.io/getsentry/snuba:latest
publish-to-dockerhub:
needs: assemble
name: Publish Snuba to DockerHub
runs-on: ubuntu-20.04
if: ${{ (github.ref_name == 'master') }}
steps:
- uses: actions/checkout@v4 # v3.1.0
- name: Pull the test image
id: image_pull
env:
IMAGE_URL: ghcr.io/getsentry/snuba:${{ github.sha }}
shell: bash
run: |
docker pull "$IMAGE_URL"
- name: Get short SHA for docker tag
id: short_sha
shell: bash
run: |
SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")
if [[ -z "$SHORT_SHA" ]]; then
echo "Short SHA empty? Re-running rev-parse."
git rev-parse --short "$GITHUB_SHA"
else
echo "sha=$SHORT_SHA" >> $GITHUB_OUTPUT
fi
- name: Push built docker image
shell: bash
env:
SHORT_SHA: ${{ steps.short_sha.outputs.sha }}
IMAGE_URL: ghcr.io/getsentry/snuba:${{ github.sha }}
run: |
# only login if the password is set
if [[ "${{ secrets.DOCKER_HUB_RW_TOKEN }}" ]]; then echo "${{ secrets.DOCKER_HUB_RW_TOKEN }}" | docker login --username=sentrybuilder --password-stdin; fi
# We push 3 tags to Dockerhub:
# first, the full sha of the commit
docker tag ${IMAGE_URL} getsentry/snuba:${GITHUB_SHA}
docker push getsentry/snuba:${GITHUB_SHA}
# second, the short sha of the commit
docker tag ${IMAGE_URL} getsentry/snuba:${SHORT_SHA}
docker push getsentry/snuba:${SHORT_SHA}
# finally, nightly
docker tag ${IMAGE_URL} getsentry/snuba:nightly
docker push getsentry/snuba:nightly
self-hosted-end-to-end:
needs: build

Check failure on line 116 in .github/workflows/image.yml

View workflow run for this annotation

GitHub Actions / image

Invalid workflow file

The workflow is not valid. .github/workflows/image.yml (Line: 116, Col: 12): Job 'self-hosted-end-to-end' depends on unknown job 'build'.
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Run Sentry self-hosted e2e CI
uses: getsentry/self-hosted@master
with:
project_name: snuba
image_url: ${{ needs.build.outputs.image_tag }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}