-
Notifications
You must be signed in to change notification settings - Fork 279
Add support for generating based on scraping the Github API. #209
Conversation
Includes general support for repo hosts and a specific implementation for Github.
An example YAML: apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: testing
namespace: default
spec:
generators:
- repoHost:
github:
organization: myorg
tokenRef:
name: github-token
key: token
filters:
- repositoryMatch: ^service-.*
pathExists: kubernetes/kustomization.yaml
template:
metadata:
name: '{{ repository }}'
spec:
source:
repoURL: '{{ url }}'
targetRevision: '{{ branch }}'
path: kubernetes/
project: default
destination:
server: https://kubernetes.default.svc
namespace: default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add docs, an example, and E2E tests?
Very nice generator and use case!
The indentation style changed between versions.
@coderanger try to rebase / merge master, #207 should have fixed the problem in "Verify generated manifests" |
A question raised from a friend: should this support discovering branches as well as repos. Right now its hardwired to only consider the default branch of a repo. Seems like a thing that could be added in the future, another filter and a flag for allBranches: true or something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice PR @coderanger , thanks for contributing this! I've got some suggestions around name changes, and some doc/comment tweaks below, but nothing major... let me know what you think 😄 .
…ode for GitHub, and configurable clone protocol. The first two combined allow generating deployment projects for new branches automatically. The last allows using HTTPS clone URLs if needed for token authentication.
Updated those three todos so they now all exist and work :) |
…a reference to a secret.
Fingers crossed no lingering typos.
… then AND two-level system. This also swaps PathExists -> PathsExist so you can still check for multiple files if needed.
Because no human can truly grok go.sum.
Okay, I renamed everything to "SCM provider" as the overall subsystem name and reworked the multi-filter behavior to be simpler (the OR/AND approach discussed above). |
@coderanger - FYI if you see an E2E test failure in the PR check, it's not anything wrong with your code, it's this: #227 (I'm working on a fix). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, one tweak to the example and good to go (unless you had anything else you wanted to add)
…d we don't need to require an SSH key setup.
I think that's everything I can think of to add to start with :) I'm sure when folks with other use cases get their hands on it, there will be more options and filters that we can ponder but I think this covers the bulk of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice, thanks for working on this! It adds a powerful new tool into the ApplicationSet tool belt, and should really enable folks doing GitOps over multiple repositories in an organization to best automate that using ApplicationSets 🎉.
Includes general support for repo hosts and a specific implementation for Github.
I'm not sold on the naming of "repo host" but I couldn't think of anything better to cover future expansion to GitLab, Bitbucket, etc.
Closes #216