Skip to content
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

ci(docker): build each platform in a different worker #32

Merged
merged 4 commits into from
Jan 11, 2024

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Nov 29, 2023

This is an optimisation to reduce the amount of disk space and build time needed on each worker. It currently uses a self-hosted runner for creating ARM images, falling back to standard ubuntu-latest GitHub runners.

@michaelfig michaelfig self-assigned this Nov 29, 2023
@michaelfig michaelfig force-pushed the mfig-split-docker branch 6 times, most recently from ee20006 to cbb273a Compare November 30, 2023 00:34
@michaelfig
Copy link
Member Author

Testing and publishing just for linux/amd64:

image

@michaelfig michaelfig force-pushed the mfig-split-docker branch 4 times, most recently from 84ea843 to 79968d1 Compare November 30, 2023 18:39
@michaelfig michaelfig changed the title ci(docker): run each platform on a different worker ci(docker): build each platform in a different worker Nov 30, 2023
@michaelfig michaelfig force-pushed the mfig-split-docker branch 2 times, most recently from 3b95574 to e819776 Compare November 30, 2023 21:05
@michaelfig michaelfig force-pushed the mfig-split-docker branch 13 times, most recently from 8bf18ca to f359b44 Compare December 3, 2023 04:33
@michaelfig
Copy link
Member Author

... and we're publishing again! A self-hosted ARM64 worker takes less time than the ubuntu-latest worker:
image

@michaelfig michaelfig requested a review from mhofman December 3, 2023 16:32
@michaelfig
Copy link
Member Author

michaelfig commented Dec 3, 2023

  • need to change jobs required by branch protection from test-proposals to test-proposals (linux/amd64).

@michaelfig michaelfig changed the base branch from main to mfig-platform-matrix December 3, 2023 17:38
Base automatically changed from mfig-platform-matrix to main December 3, 2023 21:54
@michaelfig michaelfig force-pushed the mfig-split-docker branch 3 times, most recently from 4c1cb64 to 2c2eeac Compare December 5, 2023 17:48
@michaelfig
Copy link
Member Author

This is R4R, having split out the misc cleanups I made into another PR, #39.

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the failure notification got dropped, probably mistakenly?

Can we add a manual workflow trigger, and test it through that to make sure generating and publishing all platform images works as expected? (I expect that we'll need to add the manual workflow trigger to the main branch first)

Edit: sorry for the delayed review. For some reason I'm not getting notifications for PR reviews in this repo

DEFAULT_PLATFORM=linux/amd64
echo "default=$DEFAULT_PLATFORM" >> $GITHUB_OUTPUT
if ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}; then
platforms='["'"$DEFAULT_PLATFORM"'"]'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a minute to parse the quoting here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

Comment on lines 71 to 73
- name: Set up QEMU for cross-platform builds
uses: docker/setup-qemu-action@v3
if: ${{ matrix.platform != env.DEFAULT_PLATFORM }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QEMU is still needed when running arm on macos-latest-xlarge ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the setup-qemu unconditional so that we can easily modify the runner configuration without needing to change things in multiple places.

Comment on lines 103 to 122
sep=
SUFFIXED=
uarch=$(echo "${{ matrix.platform }}" | tr / _)
for TAG in ${{ steps.meta.outputs.tags }}; do
SUFFIXED="$SUFFIXED$sep$TAG-$uarch"
if test -z "$sep"; then
sep=,
echo "tag=$TAG-$uarch" >> $GITHUB_OUTPUT
fi
done
echo "tags=$SUFFIXED" >> $GITHUB_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty opaque too.

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the explicit permission required here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions are a restriction, not a grant.

Comment on lines 84 to 89
- name: notify on failure
if: failure() && github.event_name != 'pull_request'
uses: ./.github/actions/notify-status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be completely gone, any reason to remove master failure notifications ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification will fail due to missing GitHub secrets, but I'll leave it here just so we can correct the secrets to make it work again.

# but it's re-building the last stage. This is deemed good enough for now.
# see https://github.com/moby/moby/issues/34715
- name: Build and push complete image
- name: Compute tags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, can we move "compute tags" earlier in the job / before the build step so we can easily check the tags before the job completes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@michaelfig michaelfig force-pushed the mfig-split-docker branch 2 times, most recently from 96c5f3e to f1a9c5f Compare January 10, 2024 17:43
@michaelfig michaelfig force-pushed the mfig-split-docker branch 3 times, most recently from 82fb01b to cf9dfcb Compare January 10, 2024 19:30
@michaelfig
Copy link
Member Author

Can we add a manual workflow trigger, and test it through that to make sure generating and publishing all platform images works as expected? (I expect that we'll need to add the manual workflow trigger to the main branch first)

https://github.com/Agoric/agoric-3-proposals/actions shows both the manual and PR triggers working correctly.

@michaelfig
Copy link
Member Author

both the manual and PR triggers

That is, the manual and PR runs.

strategy:
matrix:
platform: ${{ fromJSON(needs.platforms.outputs.platforms) }}
# Run on our own self-hosted ARM64 machine if the platform is ARMish.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is operation of this machine documented?

@turadg turadg requested a review from mhofman January 11, 2024 18:54
Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing the manual run results, I'm confident this does what it claims it does!

@turadg turadg merged commit c6caffa into main Jan 11, 2024
10 of 14 checks passed
@turadg turadg deleted the mfig-split-docker branch January 11, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants