You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to add a key:list(values) option to the git artifact stanza of the Workflow/Workflow-Template CRD where an operator can specify the paths of files that, when modified, will trigger the workflow.
I ran into a scenario where I needed this functionality to set a working directory for a later stage in my workflow, based on the files changed in the repo. That was specifically for a Terraform workflow, but I could see this also being useful in monorepos containing multiple microservices where builds should only happen when code specific directories has changed.
I was able to achieve this by developing a custom go program that leverages the go-git package to derive file changes that occur when an Event triggers a Workflow. This runs as a pre-build stage in the workflow currently, and passes the working directories from one stage to the next.
Here is a snippet of my code which is triggered if the event is a pull request that I think could likely be a good starting point to add this feature. (If the event is just a commit to main or any branch that builds, there is less logic because you only have to compare the 2 latest commits instead of every ancestor of main)
Summary
It would be useful to add a
key:list(values)
option to the git artifact stanza of the Workflow/Workflow-Template CRD where an operator can specify the paths of files that, when modified, will trigger the workflow.Use Cases
I ran into a scenario where I needed this functionality to set a working directory for a later stage in my workflow, based on the files changed in the repo. That was specifically for a Terraform workflow, but I could see this also being useful in monorepos containing multiple microservices where builds should only happen when code specific directories has changed.
I was able to achieve this by developing a custom go program that leverages the go-git package to derive file changes that occur when an Event triggers a Workflow. This runs as a pre-build stage in the workflow currently, and passes the working directories from one stage to the next.
Here is a snippet of my code which is triggered if the event is a pull request that I think could likely be a good starting point to add this feature. (If the event is just a commit to main or any branch that builds, there is less logic because you only have to compare the 2 latest commits instead of every ancestor of main)
Message from the maintainers:
Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.
The text was updated successfully, but these errors were encountered: