-
Notifications
You must be signed in to change notification settings - Fork 432
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(api): add git.tag support #3200
Conversation
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
engine/worker/builtin_gitclone.go
Outdated
@@ -233,7 +236,7 @@ func gitClone(w *currentWorker, params *[]sdk.Parameter, url string, dir string, | |||
gitURLSSH := sdk.ParameterValue(*params, "git.url") | |||
gitURLHTTP := sdk.ParameterValue(*params, "git.http_url") | |||
if gitURLSSH == url || gitURLHTTP == url { | |||
extractInfo(w, dir, params, clone.Branch, clone.CheckoutCommit, sendLog) | |||
extractInfo(w, dir, params, clone.Tag, clone.Branch, clone.CheckoutCommit, sendLog) |
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.
Error return value of extractInfo
is not checked
engine/worker/builtin_gitclone.go
Outdated
@@ -207,6 +209,7 @@ func gitClone(w *currentWorker, params *[]sdk.Parameter, url string, dir string, | |||
|
|||
git.LogFunc = log.Info | |||
|
|||
sendLog(fmt.Sprintf("cloneOpts ---> %+v\n", *clone)) |
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.
to delete
engine/worker/builtin_gitclone.go
Outdated
sendLog(fmt.Sprintf("git.branch: %s", branch)) | ||
} | ||
|
||
if tag != "" && tag != "{{.git.tag}}" { |
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.
check tag != "{{.git.tag}}" to remove. .git.tag is not a default value on action GitClone
sdk/repositories_manager.go
Outdated
//VCSTag represents tag known by the repositories manager | ||
type VCSTag struct { | ||
Tag string `json:"tag"` | ||
Sha string `json:"sha"` |
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.
should be great to have a comment for the difference between Sha and Hash here
missing :
|
engine/worker/builtin_gitclone.go
Outdated
@@ -24,6 +24,7 @@ func runGitClone(w *currentWorker) BuiltInAction { | |||
password := sdk.ParameterFind(&a.Parameters, "password") | |||
branch := sdk.ParameterFind(&a.Parameters, "branch") | |||
defaultBranch := sdk.ParameterValue(*params, "git.default_branch") | |||
tag := sdk.ParameterValue(*params, "git.tag") |
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.
tag have to be retrieve from a.Parameter, not params
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
CDS Report it#5566.0 ✘
|
func (c *vcsClient) CommitsBetweenRefs(ctx context.Context, fullname, base, head string) ([]sdk.VCSCommit, error) { | ||
var commits []sdk.VCSCommit | ||
path := fmt.Sprintf("/vcs/%s/repos/%s/commits?base=%s&head=%s", c.name, fullname, url.QueryEscape(base), url.QueryEscape(head)) | ||
if code, err := c.doJSONRequest(context.Background(), "GET", path, nil, &commits); err != 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.
context.Background => ctx
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Add support of git tag in CDS.
cc @Alkorin
@ovh/cds