Open tony-mw opened 2 years ago
Use Argo Events to setup a GitHub event source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/github.md
And then trigger a Argo workflow: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/argo-workflow.md
Right, that works in GitHub... but the problem is that some source control tools don't send you which files change in their event
File event source might be what you want: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/file.md
File event source might be what you want
Am I missing some context? How would this help with Git event trigger?
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 👍.