pipelines-as-code
pipelines-as-code copied to clipboard
Auto configure new repo (only with GH app)
if auto-configure-new-github-repo is enabled in pac configmap
then PAC will auto configure newly created GitHub Repositories
it will create Repository CR and a namespace
By default if the github repository is pac/test-repo
then it will create namespace with name test-repo-pipelines and repository with name test-repo
User can provide template for generating name for namespace using auto-configure-repo-namespace-template
# Whether to auto configure newly created repositories, this will create a new namespace
# and repository CR, supported only with GitHub App
auto-configure-new-github-repo: "false"
# add a template to generate name for namespace for your auto configured github repo
# supported fields are repo_owner, repo_name
# eg. if defined as `{{repo_owner}}-{{repo_name}}-ci`, then namespace generated for repository
# https://github.com/owner/repo will be `owner-repo-ci`
auto-configure-repo-namespace-template: ""
Changes
Submitter Checklist
- [ ] ♽ Run
make test lintbefore submitting a PR (ie: with pre-commit, no need to waste CPU cycle on CI - [ ] 📖 If you are adding a user facing feature or make a change of the behavior, please verify that you have documented it
- [ ] 🧪 100% coverage is not a target but most of the time we would rather have a unit test if you make a code change.
- [ ] 🎁 If that's something that is possible to do please ensure to check if we can add a e2e test.
- [ ] 🔎 If there is a flakiness in the CI tests then don't necessary ignore it, better get the flakyness fixed before merging or if that's not possible there is a good reason to bypass it. (token rate limitation may be a good reason to skip).
Codecov Report
Merging #890 (3596e9b) into main (e4dfebd) will decrease coverage by
0.14%. The diff coverage is61.42%.
@@ Coverage Diff @@
## main #890 +/- ##
==========================================
- Coverage 63.93% 63.79% -0.15%
==========================================
Files 80 81 +1
Lines 5182 5264 +82
==========================================
+ Hits 3313 3358 +45
- Misses 1560 1587 +27
- Partials 309 319 +10
| Impacted Files | Coverage Δ | |
|---|---|---|
| pkg/adapter/adapter.go | 50.00% <0.00%> (-5.00%) |
:arrow_down: |
| pkg/provider/github/github.go | 76.12% <ø> (ø) |
|
| pkg/provider/github/repository.go | 74.13% <74.13%> (ø) |
|
| pkg/matcher/repo_runinfo_matcher.go | 30.76% <0.00%> (-6.74%) |
:arrow_down: |
| pkg/hub/get.go | 82.85% <0.00%> (-0.48%) |
:arrow_down: |
| pkg/random/random.go | 100.00% <0.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
One caveat with this implementation is that it only works with newly created repo, but I would imagine this would be more used when existing repos are there and the github apps is installed and then they use PAC...
yeah. I was looking into in if we install github app on all repositories does the old repo emit any event 🤔 but nope.
we have 2 ways now...
- if auto configure is enabled then list all repos which are attached to github app.. (I guess there should be some api) and then create repository Cr for it.
- or when we get event from that repo, and we don't find a any repository cr for it. we create one. (not secure but we will have to check where the event is coming from using some regex/org name)
yeah. I was looking into in if we install github app on all repositories does the old repo emit any event thinking but nope.
(about importing existing repo since this PR handles only newly created repos).
maybe having a import flag in the CLI could solve this, it will :
tkn pac import organisation org
will go over every repos in the org organisation and create a namespace/repo using a template.
this could be used as well for other git providers too,
but we need to check with @siamaksade and koustav if that's a customer use case
yeah. I was looking into in if we install github app on all repositories does the old repo emit any event thinking but nope.
(about importing existing repo since this PR handles only newly created repos).
maybe having a import flag in the CLI could solve this, it will :
tkn pac import organisation orgwill go over every repos in the
orgorganisation and create a namespace/repo using a template.this could be used as well for other git providers too,
but we need to check with @siamaksade and koustav if that's a customer use case
yeah but here user will need to provide token, CLI could be an option
yeah. I was looking into in if we install github app on all repositories does the old repo emit any event thinking but nope.
(about importing existing repo since this PR handles only newly created repos).
maybe having a import flag in the CLI could solve this, it will :
tkn pac import organisation orgwill go over every repos in the
orgorganisation and create a namespace/repo using a template.this could be used as well for other git providers too,
but we need to check with @siamaksade and koustav if that's a customer use case
https://github.com/openshift-pipelines/pipelines-as-code/issues/934