-
-
Notifications
You must be signed in to change notification settings - Fork 62
feat(build): replace assembly with action-build-push-images #1805
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
base: master
Are you sure you want to change the base?
Changes from 6 commits
e3b17ae
4d190ff
584358e
5937a55
1a6ce94
2dc729a
2b9bd81
d9925bc
01cae28
1f13b83
d9fdb5b
68bf56d
19ae58e
06e8bc1
990e9c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,8 +86,15 @@ jobs: | |
- name: Build Binary | ||
run: | | ||
cargo build --release --locked --target="${RUST_TARGET}" --features="${FEATURES}" | ||
mkdir -p /tmp/linux/${{ matrix.arch }} | ||
mv "target/${RUST_TARGET}/release/symbolicator" ./symbolicator | ||
|
||
- name: Upload Binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: symbolicator-binary-${{ matrix.arch }} | ||
path: ./symbolicator | ||
|
||
- name: Split debug info | ||
run: | | ||
mkdir -p "/tmp/debug-info/" | ||
|
@@ -112,9 +119,9 @@ jobs: | |
|
||
- name: Prepare Docker Context | ||
run: | | ||
mkdir docker-ctx | ||
mkdir -p docker-ctx/binaries/linux/${{ matrix.arch }} | ||
cp Dockerfile docker-ctx/ | ||
mv symbolicator docker-ctx/ | ||
mv symbolicator docker-ctx/binaries/linux/${{ matrix.arch }} | ||
Comment on lines
119
to
+123
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. Why is this still happening if you upload the binary? |
||
|
||
- name: Build Image | ||
joshuarli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: docker/build-push-action@v6 | ||
|
@@ -131,94 +138,56 @@ jobs: | |
name: symbolicator-image@${{ matrix.arch }} | ||
path: /tmp/symbolicator-${{ matrix.arch }}.tar | ||
|
||
assemble-ghcr: | ||
assemble: | ||
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. I wonder if there's an argument towards keeping ghcr publishing and gar publishing separate jobs given a scenario where ghcr goes down, the job fails entirely and deploys are blocked. I like the idea of combining all this into one workflow though. WDYT @Dav1dde? 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. I think it was just easier to deal with conditionals (publish to this or that) and docker credentials in separate jobs. Good idea to consolidate these. |
||
needs: [build-setup, build-image] | ||
if: "needs.build-setup.outputs.full_ci == 'true'" | ||
|
||
name: Assemble for Github Container Registry | ||
name: Assemble | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
packages: write | ||
|
||
env: | ||
IMAGE: "ghcr.io/getsentry/symbolicator" | ||
packages: write # required for GHCR | ||
contents: read | ||
id-token: write # required for GAR | ||
|
||
steps: | ||
- name: Docker Login | ||
run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN" | ||
env: | ||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v5 | ||
joshuarli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
- name: Download Images | ||
- name: Download Binaries | ||
uses: actions/download-artifact@v5 | ||
with: | ||
pattern: symbolicator-image@* | ||
path: /tmp | ||
merge-multiple: true | ||
pattern: symbolicator-binary-* | ||
path: /tmp/docker-ctx | ||
|
||
- &assemble | ||
name: Assemble and Push Images | ||
- name: Prepare Docker Context | ||
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 | ||
cp Dockerfile /tmp/docker-ctx | ||
joshuarli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mkdir -p /tmp/docker-ctx/binaries/linux/amd64 /tmp/docker-ctx/binaries/linux/arm64 | ||
mv /tmp/docker-ctx/symbolicator-binary-amd64/symbolicator /tmp/docker-ctx/binaries/linux/amd64 | ||
mv /tmp/docker-ctx/symbolicator-binary-arm64/symbolicator /tmp/docker-ctx/binaries/linux/arm64 | ||
|
||
# If action-build-and-push-images supports passing in a docker tar, | ||
# then we can reuse the image artifact rather than this workaround | ||
# (thankfully the build amounts to just a cp, wouldn't be doing this | ||
# if the build was more complicated as we're building twice) | ||
|
||
- name: Build and push images | ||
if: "needs.build-setup.outputs.full_ci == 'true'" | ||
uses: getsentry/action-build-and-push-images@b172ab61a5f7eabd58bd42ce231b517e79947c01 | ||
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' | ||
joshuarli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
platforms: linux/amd64,linux/arm64 | ||
build_context: '/tmp/docker-ctx' | ||
publish_on_pr: true # TEMPORARY FOR TESTING | ||
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. self reminder to remove this before merging |
||
ghcr: true | ||
google_ar: true | ||
# note: nightly will only be tagged if on default branch | ||
tag_nightly: true | ||
# on GAR we expect latest tags, nightly is canonically only a GHCR thing for us | ||
tag_latest: true | ||
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] | ||
|
Uh oh!
There was an error while loading. Please reload this page.