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

Reuse artifacts generated for other branches when appropriate #57

Open
AlexTMjugador opened this issue Oct 23, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@AlexTMjugador
Copy link
Member

Related problem

Currently, the action caching logic is tuned to err on the safe side in some complex situations, isolating the artifacts generated in previous runs per branch.

The rationale behind the isolation is that each branch may contain a totally unrelated commit history, so it'd be incorrect for the action to reuse artifacts from potentially unrelated packs in different branches (e.g., the pack.png file from the pack at branch a should not be confused with the pack.png file from the pack at branch b, if b is the mainline for a different pack).

However, in several practical scenarios inter-branch artifact reuse is correct and possible. For example, feature branches share a common ancestor commit with the mainline, so the artifact generated for that ancestor can be safely reused for the feature branch.

If implemented right, this idea has the potential of substantially speeding up practical workflows.

Proposed solution

Change the last artifact retrieval and storage algorithm:

  • When looking for the previous artifact, first look for an artifact in the current branch, like it is done now. If that fails, for the branch this workflow is running on, find other branches that share a common ancestor commit, and take note of that ancestor commit. Then find the artifact related to that commit (exactly how is a good question). If there are several branches that share an ancestor, prefer the one that has diverged less (i.e., has the shortest distance to the ancestor).
  • When storing the previous artifact, save in the cache any information needed to implement this previous point, apart from the system ID.

Alternative solutions

  • Add action inputs to manually select what branches are okay to reuse. I think that is not a proper solution because it'd shift the problem to end-users, and be prone to issues if branch policies are not strictly enforced.

Additional context

This was suggested by Mergu#0001 on Discord: https://discord.com/channels/85364538328768512/831829590502408193/1033822435822284820

@AlexTMjugador AlexTMjugador added the enhancement New feature or request label Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant