-
Notifications
You must be signed in to change notification settings - Fork 7
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
Build arm containers with new github actions arm runner (PP-2139) #2280
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2280 +/- ##
=======================================
Coverage 91.12% 91.12%
=======================================
Files 363 363
Lines 41327 41327
Branches 8846 8846
=======================================
Hits 37660 37660
Misses 2405 2405
Partials 1262 1262 ☔ View full report in Codecov by Sentry. |
@@ -51,7 +51,7 @@ runs: | |||
id: cache | |||
with: | |||
path: ${{ steps.poetry-dir.outputs.home }} | |||
key: ${{ runner.os }}-poetry${{ inputs.version }}-install-py${{ steps.python-version.outputs.version }} | |||
key: ${{ runner.os }}-${{ runner.arch }}-poetry${{ inputs.version }}-install-py${{ steps.python-version.outputs.version }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be broken out to a separate PR if we want. Our action to install poetry didn't take into account the runners architecture before, so it tried to use the same cache for both intel and arm, causing poetry installs to fail on whichever platform wasn't in the cache.
This adds the platform to the cache key, so it will work with new arm based runners.
- main | ||
paths: | ||
- .github/workflows/build-base-image.yml | ||
- docker/Dockerfile.baseimage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now update the base image on pushes to main
that modify the base-image workflow or dockerfile. Previously this was done as part of build.yml
, but based on the new structure, pushing this within its own workflow made more sense to me.
needs: [build] | ||
permissions: | ||
contents: read | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: ["linux/amd64", "linux/arm64"] | ||
image: ["scripts", "webapp"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The majority of the time in this workflow is spent pulling the image, rather then running the tests, so it made sense to combine the job for scripts and webapp, since running the tests themselves is quick.
@@ -1,4 +1,4 @@ | |||
FROM opensearchproject/opensearch:1 as opensearch | |||
FROM opensearchproject/opensearch:1 AS opensearch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly necessary, but resolves a build warning about mixed cases in statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's funny how persnickety Docker is about this. 😂
@@ -1,5 +1,3 @@ | |||
version: "3.9" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again not strictly necessary, just resolves a build warning about version
being deprecated
# Wait for container to start | ||
wait_for_runit "$container" | ||
|
||
# Make sure database initialization completed successfully | ||
timeout 240s grep -q 'Initialization complete' <(docker compose logs "$container" -f 2>&1) | ||
timeout 240s grep -q -e 'Initialization complete' -e "Migrations complete" <(docker compose logs "$container" -f 2>&1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to change this, because there is a race condition now that we test both webapp and scripts in the same container, previously we would have always hit initialization, now the first container to start does it.
from unittest.mock import MagicMock, call | ||
from unittest.mock import MagicMock, call, patch | ||
|
||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test changes could be broken out to separate PR. They are necessary because we now run the tests against a container that has a version set. The tests previously assumed this was not the cause, causing some of these tests to fail.
The changes just mock the __version__
variable so it doesn't matter if its set or not, the tests will always behave correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! 🎸
Description
Build our images using the github ARM runners.
This makes several changes:
Motivation and Context
Github now has native arm runners:
community/community#148648
This allows us to build our ARM images faster, and without relying on emulation which was causing issues (see: actions/runner-images#11471).
This work is mainly based on this documentation from docker:
https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
But adapted to our environment / workflow.
How Has This Been Tested?
Checklist