Skip to content

Commit 66dac25

Browse files
authored
chore: default to only amd64 docker builds (hyperlane-xyz#6256)
### Description chore: default to only amd64 docker builds - default agent/monorepo images are only for amd64 - this saves time, cost of each image build - if required for local runs, devs can manually trigger the workflow and say they want an arm64 build - allowing manual runs also means that you don't need to have a PR open just to trigger image builds anymore ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues <!-- - Fixes #[issue number here] --> ### Backward compatibility <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests -->
1 parent 84f5b21 commit 66dac25

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

.github/workflows/monorepo-docker.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ on:
1313
- 'docker-entrypoint.sh'
1414
- '.dockerignore'
1515
- '.github/workflows/monorepo-docker.yml'
16+
workflow_dispatch:
17+
inputs:
18+
include_arm64:
19+
description: 'Include arm64 in the build'
20+
required: false
21+
default: 'false'
1622

1723
concurrency:
1824
group: build-push-monorepo-${{ github.ref }}
@@ -81,6 +87,15 @@ jobs:
8187
REGISTRY_VERSION=$(cat .registryrc)
8288
echo "REGISTRY_VERSION=$REGISTRY_VERSION" >> $GITHUB_ENV
8389
90+
- name: Determine platforms
91+
id: determine-platforms
92+
run: |
93+
if [ "${{ github.event.inputs.include_arm64 }}" == "true" ]; then
94+
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
95+
else
96+
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
97+
fi
98+
8499
- name: Build and push
85100
uses: depot/build-push-action@v1
86101
with:
@@ -92,4 +107,4 @@ jobs:
92107
labels: ${{ steps.meta.outputs.labels }}
93108
build-args: |
94109
REGISTRY_COMMIT=${{ env.REGISTRY_VERSION }}
95-
platforms: linux/amd64,linux/arm64
110+
platforms: ${{ steps.determine-platforms.outputs.platforms }}

.github/workflows/rust-docker.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
paths:
99
- 'rust/**'
1010
- '.github/workflows/rust-docker.yml'
11+
workflow_dispatch:
12+
inputs:
13+
include_arm64:
14+
description: 'Include arm64 in the build'
15+
required: false
16+
default: 'false'
1117
concurrency:
1218
group: build-push-agents-${{ github.ref }}
1319
cancel-in-progress: true
@@ -64,6 +70,14 @@ jobs:
6470
registry: gcr.io
6571
username: _json_key
6672
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
73+
- name: Determine platforms
74+
id: determine-platforms
75+
run: |
76+
if [ "${{ github.event.inputs.include_arm64 }}" == "true" ]; then
77+
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
78+
else
79+
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
80+
fi
6781
- name: Build and push
6882
uses: depot/build-push-action@v1
6983
with:
@@ -73,4 +87,4 @@ jobs:
7387
push: true
7488
tags: ${{ steps.meta.outputs.tags }}
7589
labels: ${{ steps.meta.outputs.labels }}
76-
platforms: linux/amd64,linux/arm64
90+
platforms: ${{ steps.determine-platforms.outputs.platforms }}

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,23 @@ See [`rust/README.md`](rust/README.md)
119119
We use [changesets](https://github.com/changesets/changesets) to release to NPM. You can use the `release` script in `package.json` to publish.
120120

121121
For an alpha or beta version, follow the directions [here](https://github.com/changesets/changesets/blob/main/docs/prereleases.md).
122+
123+
### Manually Triggering Docker Builds in CI
124+
125+
To manually trigger Agent or Monorepo Docker builds in CI, you can use the workflows provided in the repository. Here are the steps to do so:
126+
127+
1. **Navigate to the workflow:**
128+
129+
- For agents, go to the [Rust Docker Workflow](https://github.com/hyperlane-xyz/hyperlane-monorepo/actions/workflows/rust-docker.yml).
130+
- For the monorepo, go to the [Monorepo Docker Workflow](https://github.com/hyperlane-xyz/hyperlane-monorepo/actions/workflows/monorepo-docker.yml).
131+
132+
2. **Trigger the workflow:**
133+
134+
- On the workflow page, click on the "Run workflow" button.
135+
- You may need to select a branch and decide whether to trigger builds for the `arm64` platform.
136+
137+
3. **Wait for the build to complete:**
138+
- Once triggered, monitor the progress of the build by opening the new workflow run.
139+
- You may have to refresh the page for it to appear.
140+
- Check the logs for any errors or issues during the build process.
141+
- Wait for the `build-and-push-to-gcr` step to complete successfully before using the new image.

0 commit comments

Comments
 (0)