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

Only rebuild images that could have changed #618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scottwittenburg
Copy link
Collaborator

@scottwittenburg scottwittenburg commented Sep 13, 2023

The goal here is to only rebuild images that might actually need to be rebuilt, based on what files changed. I suggested I would do this here, see that discussion for more background.

@scottwittenburg scottwittenburg force-pushed the only-rebuild-changed-images branch 2 times, most recently from e6815e6 to b2b5dc5 Compare September 14, 2023 19:30
@scottwittenburg
Copy link
Collaborator Author

I tested this stuff with a different workflow and rules since the way we have this workflow now, it only runs when pushing to main. Here's an example workflow: https://github.com/spack/spack-infrastructure/actions/runs/6179687042/job/16775011917

In there if you look through the jobs, you can see that the gh-gl-sync build ran the conditional step, while others, like the gitlab-api-scrape one skipped that step.

I wish there were an early exit option for jobs, instead of having to put an if on every step after the check, but it seems not to exist. A lot of people want it though, based on the popularity of this issue.

@scottwittenburg scottwittenburg changed the title WIP: Add a workflow to test getting changed files Add a workflow to test getting changed files Sep 14, 2023
@scottwittenburg scottwittenburg changed the title Add a workflow to test getting changed files Only rebuild images that could have changed Sep 14, 2023
Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

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

LGTM. It might be worth looking into whether we can use https://github.com/dorny/paths-filter instead (maybe that was the action you were referring to earlier). And then use the output from that action to build the job matrix dynamically. Sort of how it's done here https://stackoverflow.com/a/65434401. Might be something to put on the backlog at least depending on how high of a priority this is, but I think this solution is sufficient for our purposes now

@scottwittenburg
Copy link
Collaborator Author

scottwittenburg commented Sep 14, 2023

It might be worth looking into whether we can use https://github.com/dorny/paths-filter instead (maybe that was the action you were referring to earlier).

It was actually this one I meant, which looks really active, is used by a lot of people, and has more features.

And then use the output from that action to build the job matrix dynamically

Yeah, I wanted to do that too, once I saw this workflow in change-actions repo, I wondered how we could do that in our case. Just need to figure out how to continue using our manually incremented tags in that scenario, but I didn't really try yet. I'll give it a go, as it would be nice to skip altogether the jobs we don't need.

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