-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(appset): get latest protected tag from gitlab api #15886
base: master
Are you sure you want to change the base?
feat(appset): get latest protected tag from gitlab api #15886
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #15886 +/- ##
==========================================
- Coverage 49.51% 49.47% -0.05%
==========================================
Files 269 269
Lines 46990 47032 +42
==========================================
Hits 23269 23269
- Misses 21437 21478 +41
- Partials 2284 2285 +1
☔ View full report in Codecov by Sentry. |
74b9b96
to
ad82bdf
Compare
@crenshaw-dev Could you please take a look? |
@crenshaw-dev Could you please take a look on this PR when you will have free time. |
@crenshaw-dev any updates? |
ecaebb6
to
5bf6359
Compare
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
Signed-off-by: Ivan Sokoryan <i.sokoryan@robo.cash>
5bf6359
to
ca2b78c
Compare
Could someone take a look on this PR please? |
return []gitlab.Tag{}, nil | ||
} | ||
if err != nil { | ||
return nil, err |
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 we add more details to the error here?
if resp != nil && resp.StatusCode == http.StatusNotFound { | ||
return []gitlab.Tag{}, nil | ||
} |
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.
Do we get an err
when receiving 404s? If not, can we check for err != nil
first?
for _, tag := range tags { | ||
if tag.Protected { | ||
return tag.Name, nil | ||
} | ||
} |
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 we have more than one protected tags? If yes, should we return the list here?
@@ -110,6 +112,7 @@ spec: | |||
* `topic`: filter projects by topic. A single topic is supported by Gitlab API. Defaults to "" (all topics). | |||
* `tokenRef`: A `Secret` name and key containing the GitLab access token to use for requests. If not specified, will make anonymous requests which have a lower rate limit and can only see public repositories. | |||
* `insecure`: By default (false) - Skip checking the validity of the SCM's certificate - useful for self-signed TLS certificates. | |||
* `latestProtectedTag`: Obtain latest protected tag to use it in deployments. |
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 we add the default value here?
@@ -496,6 +496,8 @@ type SCMProviderGeneratorGitlab struct { | |||
IncludeSharedProjects *bool `json:"includeSharedProjects,omitempty" protobuf:"varint,7,opt,name=includeSharedProjects"` | |||
// Filter repos list based on Gitlab Topic. | |||
Topic string `json:"topic,omitempty" protobuf:"bytes,8,opt,name=topic"` | |||
// Obtain latest protected tag from GitLab project. Default to "false" | |||
LatestProtectedTag bool `json:"latestProtectedTag,omitempty" protobuf:"varint,9,opt,name=latestProtectedTag"` |
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.
Would it be better to rename this to FetchLatestProtectedTag
?
Are there any plans to accept this PR? |
Hello everyone!
This Pull Request add feature to get latest protected tag from GitLab API for SCM provider to use it with ApplicationSet.
In our company we are using simple GitFlow to deploy our applications. It means that we have 3 stages (review/stage/production). On the last stage of deploying we use lastest protected tag in gitlab to deploy our application to production.
We want to use ApplicationSet but without tags it will be not possible to implement it in our GitFlow.
What do you think about this PR? It it possible to have it in the future release or could someone do it in better way?
I have tested it locally and in our test ArgoCD installation. It works great.
Checklist: