Skip to content

CI: Run different workflow if new image needs to be built.#44

Merged
derobins merged 7 commits into
developfrom
rildixon/ci-build-image-only-on-change
Nov 13, 2025
Merged

CI: Run different workflow if new image needs to be built.#44
derobins merged 7 commits into
developfrom
rildixon/ci-build-image-only-on-change

Conversation

@riley-dixon
Copy link
Copy Markdown
Collaborator

@riley-dixon riley-dixon commented Nov 11, 2025

We would like to enable a fork-based development process. Our current CI does not allow this due to us building and pushing a new "development" CI image for every PR. Pushing this image to GHCR is a privileged action and is not enabled by default from external PRs. Using build artifacts instead is another solution that does not require these privileges but loses certain performance qualities like caching. In addition, we found that certain machines could take 30-60 minutes to download the CI image via build artifacts.

This approach uses GHCR but limits when we choose to build and push a new development CI image. This will only be triggered if the Dockerfile has been changed. The rest of the CI process will then use this new development image when building and testing. Since pushing to GHCR is a privileged action, any changes to the Dockerfile must be submitted internally within the repo.

If the Dockerfile's have not been changed, no image will be built and will use the latest CI image that is kept in sync with the develop branch.

Whenever a PR is accepted & merged into develop, a new 'latest' CI image will be built and published.

@riley-dixon riley-dixon self-assigned this Nov 11, 2025
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch 3 times, most recently from 59f8ca5 to 060edfe Compare November 11, 2025 03:19
Comment thread .github/workflows/ais-ci.yml Fixed
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch 11 times, most recently from 04e5880 to f625f3c Compare November 12, 2025 22:17
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch 13 times, most recently from 218ff43 to bf5663c Compare November 13, 2025 00:59
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch from bf5663c to 695bb67 Compare November 13, 2025 01:10
If the Dockerfile's have been changed, we need to rebuild the
CI image. Else, we can skip this step and just re-use the
latest image in-sync with main.

Currently there is a workaround regarding how we pass the new
CI image name should it need to be built. This is a limitation
with how GitHub handles matrix job's with outputs. Because our
image tag is based on a constant, the jobs within the matrix
will all provide the same value at least. Ideally we would
provide the full image name and tag. We can look at refactoring
the workflow to avoid this situation.

If a new image needs to be built, it will also attempt to push this
image to the docker registry. This means any changes to the Dockerfile
will require a PR to be opened directly in hipFile instead of a fork.

Given that the Dockerfile is expected to rarely change, this should be
an acceptable trade-off.
This cache will only be used by the same PR if it gets updated
for whatever reason. This way people won't be sad if a particular
distro takes 20 minutes to download packages for if they need to
change the PR.

Intentionally not caching from 'latest' to have a relatively
up-to-date image. Open to discuss about this.
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch from 695bb67 to 58bfd98 Compare November 13, 2025 02:34
This will keep our CI image up-to-date, even if we aren't
making any changes to the Dockerfile. This will only run
if a PR has been accepted and merged.
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch from 58bfd98 to b6cec82 Compare November 13, 2025 17:52
@riley-dixon riley-dixon marked this pull request as ready for review November 13, 2025 17:59
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch 2 times, most recently from 37608da to a91e6bd Compare November 13, 2025 19:07
@riley-dixon riley-dixon force-pushed the rildixon/ci-build-image-only-on-change branch from a91e6bd to 07099ec Compare November 13, 2025 19:07
@riley-dixon
Copy link
Copy Markdown
Collaborator Author

Will need to reconfigure the "Required" CI Checks if this PR is accepted.

@derobins derobins merged commit 5afc9b2 into develop Nov 13, 2025
31 of 32 checks passed
@derobins derobins deleted the rildixon/ci-build-image-only-on-change branch November 13, 2025 22:00
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.

4 participants