Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(secrets): verify casing of orgs and repos in SCM before adding secret #700

Merged
merged 5 commits into from
Sep 27, 2022

Conversation

ecrupper
Copy link
Contributor

GitHub is case insensitive, while Vela is not. This causes issues when a user attempts to create an org or repo secret with the wrong casing. The secret is created and added to the database, which is unexpected behavior when the user navigates to their secrets page and does not see it there.

Example of the new casing check, given that EastonCrupper/myvela is the repo in Vela:

vela add secret --secret.engine native --secret.type repo --org EastonCrupper --repo MyVela --name example --value blahblahblah
DEBU[0000] parsing Vela client from provided configuration 
DEBU[0000] validating provided configuration for Vela client 
TRAC[0000] creating Vela client for http://localhost:8080 
TRAC[0000] setting token for Vela client                
DEBU[0000] validating secret configuration              
DEBU[0000] executing add for secret configuration       
DEBU[0000] capturing value for secret example           
TRAC[0000] adding secret native/repo/EastonCrupper/MyVela/example 
FATA[0000] unable to retrieve repository MyVela. Did you mean myvela? 

@ecrupper ecrupper self-assigned this Sep 22, 2022
@ecrupper ecrupper requested a review from a team as a code owner September 22, 2022 16:12
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #700 (5c31e41) into main (f0741c9) will decrease coverage by 0.04%.
The diff coverage is 46.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #700      +/-   ##
==========================================
- Coverage   55.09%   55.05%   -0.05%     
==========================================
  Files         210      211       +1     
  Lines       15912    15994      +82     
==========================================
+ Hits         8767     8805      +38     
- Misses       6768     6811      +43     
- Partials      377      378       +1     
Impacted Files Coverage Δ
api/secret.go 0.00% <0.00%> (ø)
scm/github/org.go 88.00% <88.00%> (ø)
scm/github/repo.go 74.77% <100.00%> (+1.25%) ⬆️

api/secret.go Show resolved Hide resolved
api/secret.go Show resolved Hide resolved
Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants