8000 Add parallel ci pipelines by ralphlange · Pull Request #71 · epics-training/training-vm · GitHub
[go: up one dir, main page]

Skip to content

Add parallel ci pipelines - #71

Merged
ralphlange merged 10 commits into
epics-training:mainfrom
ralphlange:parallel-ci-pipelines
Mar 28, 2026
Merged

ralphlange merged 10 commits into
epics-training:mainfrom
ralphlange:parallel-ci-pipelines

Conversation

@ralphlange
@ralphlange ralphlange commented Jan 5, 2026 •
Copy link
Copy Markdown
Contributor

First part of reducing the duration of CI testing:

Use a two-stage pipeline, to

  • build a container image (initial_build, base and pvxs) and push it to GitHub's repo
  • use that image for several parallel test builds of roles.

Alas, the time savings are considerably less that I hoped for.

That's why a second part (different PR) will break the fixed pipeline and run the first stage (container image build) only when needed, so that the usual CI tests (changes on a second-stage role) will save 10-20 minutes (depending on flavour).

(fixes #63)

@ralphlange
ralphlange requested a review from gilesknap January 5, 2026 16:11
@gilesknap
Copy link
Copy Markdown
Contributor

Hi, @ralphlange (happy new year!).

You have certainly gone to a lot of effort here and made much better use of github actions. But as you mention, the previous builds did all run in parallel, even though they were just calling a script.

Now that you are correctly using docker/build-push-action you could take advantage of githubs build cache to improve speed. e.g. see
https://github.com/epics-containers/ioc-adsimdetector/blob/931b4a15888d061aa5ca1408640929d78258a33d/.github/workflows/build.yml#L60-L61

you would need to take care to use a different scope for each of the 4 workflows that calls into generic-ci.yml because they each need a different cache.

This way you would get speed up for the whole of the container build. In fact I don't think you need the two stage build if you get this working right.

e.g. look at the build-image job here https://github.com/epics-containers/ioc-adsimdetector/actions/runs/19670901234/job/56339244267 all the container build steps are being pulled from the cache and it is significantly faster than those builds where there is a change early in the Dockerfile.

@ralphlange
Copy link
Copy Markdown
Contributor Author

Excellent idea! (happy new year!)

I will try that.

I will also add some special handling for pull requests, as we certainly don't want those to push images to the target organization's docker repo. (Found an action that allows storing images as build artefacts, which is exactly how things should be handled for PRs: scoped with the PR build itself, downloadable, not requiring authentication and auto-deleted after a while.)

Stay tuned...

@gilesknap
gilesknap commented Jan 7, 2026 •
Copy link
Copy Markdown
Contributor

I will also add some special handling for pull requests

We usually build containers for PRs but only push them to the registry for tagged builds (although this means you don't get a container image to test locally until release or beta tag - your idea of using artefacts would give you that, but I guess you would need to manually download the image instead of use an ghcr.io registry address for it).

DLS best practice for use of github actions might give you a few pointers, it comes from our python project template, the simplest example of which is here https://github.com/DiamondLightSource/python-copier-template-example/tree/main/.github/workflows

@simon-ess simon-ess left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall seems fine to me; a few minor comments/questions though.

# to local.yml and adjust as needed
# Setting all module switches to false (just make sure the variables exist)
initial_setup: false
docker: true # for rootful this needs to happen before first reboot
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems not obviously related to the commit message, and now the comment doesn't seem to match...

(That said, this file is deleted later so meh...)

Comment thread .github/workflows/ci-rocky.yml Resolved
Comment thread ansible/roles/bluesky/defaults/main.yml Resolved
Comment thread ansible/playbook.yml Resolved
@ralphlange
ralphlange force-pushed the parallel-ci-pipelines branch 2 times, most recently from 1bbc87d to 6d4f223 Compare February 27, 2026 14:06
@ralphlange
Copy link
Copy Markdown
Contributor Author

This is the updated, rebased PR as of after the Codeathon.
Please refer to the stage at https://github.com/ralphlange/training-vm/actions for the build.
(PR builds are not allowed to create container images.)

@ralphlange
Copy link
Copy Markdown
Contributor Author

Now the CI duration is flexible and varies:
Between changes in an EPICS Module role (4min) and changes to the initial_install or EPICS Base roles (55min).

@ralphlange
Copy link
Copy Markdown
Contributor Author

@simon-ess: Which of your comments on the old version do you retain? I'll take care of those.

Restructure the GitHub Actions CI pipeline into two independent stages.
- Stage 1 (rebuild-container-images):
  Rebuilds base container images for Debian, Fedora, Rocky, and Ubuntu
  when base roles or Containerfiles are changed
- Stage 2 (test-roles-*):
  Installs downstream EPICS module roles and applications using the base images.
  Triggered by downstream role changes or completion of Stage 1.
  Includes a 'prep' job to handle lowercase repository names for GHCR.

Refactor the Ansible setup to support modular testing.
- Use 'ansible/configs/' to store CI profiles and local overrides.
- Convert 'playbook.yml' to use 'include_role' in 'tasks:' for granular control.
- Implement explicit dependencies in 'meta/main.yml'.
- Fix 'update.sh' to use the new configuration path structure.
- Resolve GHCR tagging issues by ensuring lowercase repository names.

Co-authored-by: google-labs-jules[bot]
- distro-dependent settings in vars/os
- playbook pre-task to load the correct settings
- epics-module was not a proper role
- as the build system is under m-base,
  the build_module task belongs there
gets rid of GitHub Actions warnings about the
default value resulting in an empty base image name
Required for the upcoming switch to Node.js 24
- actions/checkout to v6
- docker/login-action to v4
- docker/build-push-action to v7
- requires explicit configuration from command line
  using '-e "@vars/foobar.yml"'
@ralphlange
ralphlange force-pushed the parallel-ci-pipelines branch from 6d4f223 to d29aee1 Compare March 28, 2026 17:38
@ralphlange
ralphlange merged commit 14d571c into epics-training:main Mar 28, 2026
7 of 23 checks passed
@ralphlange
Copy link
Copy Markdown
Contributor Author

Builds fail because of PRs not being able to push container images.
I'll fix that in a separate PR.

Merging. Thanks for the reviews!

ralphlange added a commit to ralphlange/training-vm that referenced this pull request Apr 6, 2026
ralphlange added a commit to ralphlange/training-vm that referenced this pull request Apr 11, 2026
ralphlange added a commit to ralphlange/training-vm that referenced this pull request Apr 11, 2026
ralphlange added a commit to ralphlange/training-vm that referenced this pull request Apr 11, 2026
ralphlange added a commit that referenced this pull request Apr 12, 2026
@ralphlange
ralphlange deleted the parallel-ci-pipelines branch July 27, 2026 08:52
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.

Parallelize CI build

3 participants

0