pipelines-as-code icon indicating copy to clipboard operation
pipelines-as-code copied to clipboard

add flag `webhook-secret` to `tkn-pac setup` provider cli

Open ramessesii2 opened this issue 2 years ago β€’ 4 comments

Why is this useful

  • Users wouldn't know the webhook-secret created for the git provider if they don't create a Repository CR. We solve this issue by providing --webhook-secret flag with tkn-pac setup <provider> --webhook-secret flag.

Fixes #908

Signed-off-by: Satyam Bhardwaj [email protected]

Changes

Submitter Checklist

  • [x] β™½ Run make test lint before submitting a PR (ie: with pre-commit, no need to waste CPU cycle on CI
  • [x] πŸ“– If you are adding a user facing feature or make a change of the behavior, please verify that you have documented it
  • [x] πŸ§ͺ 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).

ramessesii2 avatar Oct 17 '22 08:10 ramessesii2

@sm43 @chmouel if this looks good to you, specifically the part where --webhook-secret is a flag for the tkn-pac setup <provider> only and is not carried to child commands of it, I can go ahead and make this change visible in cli DOC as well. 2. Should there be any change in the unit-tests?

ramessesii2 avatar Oct 17 '22 09:10 ramessesii2

I've updated the PR. Although, not sure how to fix this error when I run make test lint (it's visible in the CI logs as well).

Linting go files...
pkg/random/random_test.go:25: File is not `gofumpt`-ed (gofumpt)
}
pkg/cmd/tknpac/setup/root.go:15: File is not `gofumpt`-ed (gofumpt)
var (
	webhookSecret string
)

ramessesii2 avatar Oct 19 '22 07:10 ramessesii2

I've updated the PR. Although, not sure how to fix this error when I run make test lint (it's visible in the CI logs as well).

Linting go files...
pkg/random/random_test.go:25: File is not `gofumpt`-ed (gofumpt)
}
pkg/cmd/tknpac/setup/root.go:15: File is not `gofumpt`-ed (gofumpt)
var (
	webhookSecret string
)

try running make fumpt πŸ™ƒ

sm43 avatar Oct 19 '22 07:10 sm43

Thanks @sm43, CI is passing now.

ramessesii2 avatar Oct 19 '22 08:10 ramessesii2

I think @savitaashture is working on some refactoring of that code, let's see if you can both sync on this..

chmouel avatar Oct 25 '22 09:10 chmouel

Codecov Report

Merging #919 (f439a12) into main (c290933) will increase coverage by 0.07%. The diff coverage is 68.00%.

@@            Coverage Diff             @@
##             main     #919      +/-   ##
==========================================
+ Coverage   63.88%   63.95%   +0.07%     
==========================================
  Files          80       80              
  Lines        5203     5205       +2     
==========================================
+ Hits         3324     3329       +5     
+ Misses       1568     1567       -1     
+ Partials      311      309       -2     
Impacted Files Coverage Ξ”
pkg/cli/webhook/webhook.go 0.00% <ΓΈ> (ΓΈ)
pkg/cli/webhook/github.go 55.76% <62.50%> (+1.48%) :arrow_up:
pkg/cli/webhook/gitlab.go 56.66% <66.66%> (+2.22%) :arrow_up:
pkg/random/random.go 90.90% <75.00%> (-9.10%) :arrow_down:
pkg/sort/repository_status.go 72.72% <0.00%> (-2.28%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Oct 25 '22 09:10 codecov-commenter

I think @savitaashture is working on some refactoring of that code, let's see if you can both sync on this..

Discussed with @ramessesii2 about the scenario & Yes with tkn pac webhook add command this functionality will be taken care Here is PR https://github.com/openshift-pipelines/pipelines-as-code/pull/949

savitaashture avatar Oct 27 '22 08:10 savitaashture

Closing this PR in favor of #949.

ramessesii2 avatar Oct 27 '22 08:10 ramessesii2