-
-
Notifications
You must be signed in to change notification settings - Fork 62
feat(build): use action-build-push-images #1802
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5eec0bb
replace image assembly with action-build-push-images
joshuarli 9c06ef6
ref: dedupe buildx and ghcr should be full ci only, same with e2e ci
joshuarli 32eff4c
Revert "ref: dedupe buildx and ghcr should be full ci only, same with…
joshuarli 3e345bb
dedupe buildx
joshuarli 204491a
publish to ghcr on prs
joshuarli 26bdfd2
[skip ci] build and push ghcr nightly on default branch
joshuarli 833926c
fix
joshuarli 54ed7b1
[skip ci] full ci correct meaning
joshuarli b17e8af
ref: actually nightly is only tagged on default branch so can dedupe
joshuarli 5de2c8e
Update .github/workflows/image.yml
joshuarli fa6d944
linux/amd64,linux/arm64 for prod too
joshuarli 5ac1184
Merge remote-tracking branch 'origin' into use-action-build-push-images
joshuarli 55ae450
skip for contributor and dependabot prs
joshuarli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -42,6 +42,11 @@ jobs: | |
build-image: | ||
needs: build-setup | ||
|
||
permissions: | ||
contents: read | ||
packages: write # Required for GHCR | ||
id-token: write # Required for Google Artifact Registry (GAR) | ||
|
||
strategy: | ||
matrix: | ||
arch: ${{ fromJson(needs.build-setup.outputs.archs) }} | ||
|
@@ -107,118 +112,38 @@ jobs: | |
name: symbolicator-debug@${{ matrix.arch }} | ||
path: /tmp/debug-info/* | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Prepare Docker Context | ||
run: | | ||
mkdir docker-ctx | ||
cp Dockerfile docker-ctx/ | ||
mv symbolicator docker-ctx/ | ||
|
||
- name: Build Image | ||
uses: docker/build-push-action@v6 | ||
- name: Build and push ghcr image | ||
uses: getsentry/action-build-and-push-images@a53f146fc1ea3cb404f2dcf7378f5b60dd98d3ca | ||
with: | ||
context: docker-ctx/ | ||
image_name: 'symbolicator' | ||
platforms: linux/${{ matrix.arch }} | ||
joshuarli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
tags: symbolicator-${{ matrix.arch }} | ||
outputs: type=docker,dest=/tmp/symbolicator-${{ matrix.arch }}.tar | ||
push: false | ||
|
||
- name: Upload Image | ||
uses: actions/upload-artifact@v4 | ||
dockerfile_path: './Dockerfile' | ||
build_context: './docker-ctx' | ||
ghcr: true | ||
joshuarli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tag_nightly: false # todo true | ||
tag_latest: false | ||
joshuarli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Build and push production image | ||
if: github.ref_name == github.event.repository.default_branch | ||
uses: getsentry/action-build-and-push-images@a53f146fc1ea3cb404f2dcf7378f5b60dd98d3ca | ||
with: | ||
name: symbolicator-image@${{ matrix.arch }} | ||
path: /tmp/symbolicator-${{ matrix.arch }}.tar | ||
|
||
assemble-ghcr: | ||
needs: [build-setup, build-image] | ||
if: "needs.build-setup.outputs.full_ci == 'true'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is now done on every commit since e2e now needs ghcr.io/getsentry/symbolicator:${{ github.sha }} because it can't download symbolicator-amd64.tar anymore not a big deal imo, very little overhead since actually building the final docker image is really fast |
||
|
||
name: Assemble for Github Container Registry | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
packages: write | ||
|
||
env: | ||
IMAGE: "ghcr.io/getsentry/symbolicator" | ||
|
||
steps: | ||
- name: Docker Login | ||
run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN" | ||
env: | ||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Download Images | ||
uses: actions/download-artifact@v5 | ||
with: | ||
pattern: symbolicator-image@* | ||
path: /tmp | ||
merge-multiple: true | ||
|
||
- &assemble | ||
name: Assemble and Push Images | ||
run: | | ||
set -x | ||
|
||
IMAGES=() | ||
for image in /tmp/symbolicator-*.tar; do | ||
NAME="$(basename $image .tar)" | ||
ARCH="${NAME#*-}" | ||
TARGET="${IMAGE}:${{ github.sha }}-${ARCH}" | ||
|
||
docker load --input "${image}" | ||
docker tag "${NAME}" "${TARGET}" | ||
docker push "${TARGET}" | ||
|
||
IMAGES+=("${TARGET}") | ||
done | ||
|
||
docker buildx imagetools create -t "${IMAGE}:${{ github.sha }}" "${IMAGES[@]}" | ||
|
||
if [[ "${{ github.ref_name }}" == "master" ]]; then | ||
docker buildx imagetools create -t "${IMAGE}:nightly" "${IMAGE}:${{ github.sha }}" | ||
fi | ||
|
||
assemble-ar: | ||
needs: [build-setup, build-image] | ||
if: "needs.build-setup.outputs.full_ci == 'true'" | ||
|
||
name: Assemble for Google Artifact Registry | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
env: | ||
IMAGE: "us-central1-docker.pkg.dev/sentryio/symbolicator/image" | ||
|
||
steps: | ||
- name: Google Auth | ||
id: auth | ||
uses: google-github-actions/auth@v3 | ||
with: | ||
workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool | ||
service_account: [email protected] | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v3 | ||
with: | ||
version: ">= 390.0.0" | ||
|
||
- name: Configure Docker | ||
run: gcloud auth configure-docker us-central1-docker.pkg.dev | ||
|
||
- name: Download Images | ||
uses: actions/download-artifact@v5 | ||
with: | ||
pattern: symbolicator-image@* | ||
path: /tmp | ||
merge-multiple: true | ||
|
||
- *assemble | ||
image_name: 'symbolicator' | ||
platforms: linux/${{ matrix.arch }} | ||
dockerfile_path: './Dockerfile' | ||
build_context: './docker-ctx' | ||
ghcr: false | ||
google_ar: true | ||
tag_nightly: false | ||
tag_latest: false | ||
google_ar_image_name: us-central1-docker.pkg.dev/sentryio/symbolicator/image | ||
google_workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool | ||
google_service_account: [email protected] | ||
|
||
gocd-artifacts: | ||
needs: [build-setup, build-image] | ||
|
@@ -260,18 +185,9 @@ jobs: | |
timeout-minutes: 30 | ||
|
||
steps: | ||
- name: Download Docker Image | ||
uses: actions/download-artifact@v5 | ||
with: | ||
pattern: symbolicator-image@amd64 | ||
path: /tmp | ||
|
||
- name: Load Docker Image | ||
run: docker load --input /tmp/symbolicator-amd64.tar | ||
|
||
- name: Run Sentry self-hosted e2e CI | ||
uses: getsentry/self-hosted@master | ||
with: | ||
project_name: symbolicator | ||
image_url: symbolicator-amd64 | ||
image_url: ghcr.io/getsentry/symbolicator:${{ github.sha }} | ||
joshuarli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.