Skip to content

Setup Shared CI for Uploading Dev and Release Images - #182

Open
anish-mudaraddi wants to merge 14 commits into
masterfrom
tidy-ci
Open

anish-mudaraddi wants to merge 14 commits into
masterfrom
tidy-ci

Conversation

@anish-mudaraddi

@anish-mudaraddi anish-mudaraddi commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The current build jobs are complex and there's a lot of repeated code. Currently, to add a new image, a whole new CI/CD pipeline: test -> lint -> build dev image -> build release image would need to be written - ultimately slowing down development.

This PR:
Makes it easier and standardise on the way we add and test new docker images. By setting up "generic" build scripts that will automatically detect images in this repo, build and push these images without explicitly needing to write another CI action.

  1. separate image build jobs from testing and linting jobs to promote code reuse.

    • "Create Dev Image" action runs when a PR is created - to build images and upload them to harbor in the stfc-cloud-staging project.

    • "Create Release Image" action runs when a PR is merged into master

  2. read and export a buildcache when building images so CI finishes quicker

  3. Provide a way to locally build images using ./github/scripts/build_image.sh - see updated readme on how to use the new CI jobs

  4. Setup a periodic PR to rebuild images and bump patch versions so we pick up the latest package dependency updates

To add new docker images - we now only need to write an action to test and lint source code which is much easier to write and maintain. This is not easy to make generic since we have a mix of Go and Python and slightly different project/package configurations.

Changelog

simplified the CI such that:

  1. have 2 scripts to handle building and pushing images - used by github action and can be invoked locally for testing. Easy to test the scripts outside of github actions

  2. created a shared action to automatically detect changes to a image subdirectory and builds and pushes a dev image when a PR is opened: e.g. 1.0.0dev.1293a1

  3. created an action that builds and pushes a new release image and github tag when a PR is merged to master

  4. modified existing CI that would regularly publish a PR bumping the patch version for rabbit-consumer docker image. Made this apply to all docker images so that we can force dependencies to updated and the docker build step

  5. simplified individual image CI jobs to just testing and linting - not also building the images. This reduces duplicated code.

@anish-mudaraddi
anish-mudaraddi requested review from a team and DavidFair as code owners September 7, 2026 15:51
@anish-mudaraddi anish-mudaraddi changed the title Tidy ci Setup Shared CI for Uploading Dev and Release Images Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (b27dfaa) to head (52307f8).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #182      +/-   ##
==========================================
+ Coverage   97.24%   98.40%   +1.15%     
==========================================
  Files          16       48      +32     
  Lines        1198     3069    +1871     
==========================================
+ Hits         1165     3020    +1855     
- Misses         33       49      +16     
Flag Coverage Δ
rabbit_consumer 97.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anish-mudaraddi
anish-mudaraddi force-pushed the tidy-ci branch 3 times, most recently from f4b2b6c to da27b94 Compare September 8, 2026 09:05
Comment thread .github/workflows/create_dev_image.yaml Resolved
Comment thread .github/workflows/create_dev_image.yaml Resolved
Comment thread .github/workflows/patch_bump_pr.yaml Resolved
Comment thread .github/workflows/patch_bump_pr.yaml Resolved
Comment thread .github/workflows/patch_bump_pr.yaml Resolved
@anish-mudaraddi
anish-mudaraddi force-pushed the tidy-ci branch 3 times, most recently from 51377f5 to 0da9530 Compare September 10, 2026 13:30
anish-mudaraddi and others added 9 commits October 2, 2026 14:52
setup distinct CI jobs that can be reused.

- separate build_image related actions into two distinct CI jobs. Create dev image and Create release image

Create dev image runs when a PR is created - to build images and upload them to harbor in the stfc-cloud-staging project.

Create release image happens when merged into master

we also allow building locally using scripts in .github/scripts/build_dev_image.sh and .github/scripts/build_release_image.sh for local testing

See updated readme on how to use the new CI jobs

Motivation:
- build jobs and CI are complex - there's a lot of repeated code between CI jobs - ultimately performing similar jobs: building dev and release images and uploading to harbor.

# Changelog

simplified the CI such that:

- have 2 scripts to handle building and pushing images - used by github action and can be invoked locally for testing. Easy to test the scripts outside of github actions

- created a shared action that builds and pushes a dev image when a PR is opened that changes the contents of a image subdirectory.

- created an action that build a new release image when a PR is merged to master

- modified existing CI that would regularly publish a PR bumping the patch version for rabbit-consumer docker image. Made this apply to all docker images so that we can force dependencies to updated and the docker build step

- simplified individual image CI jobs to just testing and linting - not also building the images. This reduces duplicated code.
login to harbor not staging harbor
Co-authored-by: George Matthews <112955466+gmatthews20@users.noreply.github.com>
split out detect_changed_images.sh and validate_version.sh from build_dev_image.yaml
this github action periodically opened a PR that would just bump the
patch version of each chart, forcing a new dev image to be created.

this was done to update the underlying apt package dependencies
periodically for the chart.

I removed this because there was an argument made that the reviewer had
nothing to review - hence we need to re-think this PR - potentially by
only opening when a dependency changed and doocumenting what dependencies
changed in the PR
scripts were too complex, simplify to just use the docker build-push-action instead of standalone scripts

the manual method is simple just a docker build <image> <tags> --push <other-flags> - So just document that in the README

remove validating the version.txt change as not all versions will be in the format major.minor.patch. Instead we simply check that it has been changed in detect_changed_images.sh
Maximise build space is slow running, run only when we're sure to build an image
add comment link releases
version step was removed as we no longer check to see if there was a
version bump and simply if it was changed
@anish-mudaraddi

Copy link
Copy Markdown
Collaborator Author

changes since last review:

  1. simplify the build image scripts to use the docker/build_push_action
  2. don't check the version bump was done properly, just that it was changed - allows setting a unique tag that doesn't necessarily match the major.minor.bump - some of our images don't use this

@anish-mudaraddi
anish-mudaraddi force-pushed the tidy-ci branch 3 times, most recently from 728eaf3 to 07ad519 Compare October 13, 2026 12:22
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.

2 participants