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

feat(api): add git.tag support #3200

Merged
merged 11 commits into from Aug 17, 2018
Merged

feat(api): add git.tag support #3200

merged 11 commits into from Aug 17, 2018

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Aug 14, 2018

  1. Description
    Add support of git tag in CDS.
  2. Related issues
  3. About tests
  4. Mentions
    cc @Alkorin

@ovh/cds

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
@bnjjj bnjjj added the feature label Aug 14, 2018
@bnjjj bnjjj requested a review from yesnault August 14, 2018 11:52
@@ -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)

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

@@ -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))
Copy link
Member

Choose a reason for hiding this comment

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

to delete

sendLog(fmt.Sprintf("git.branch: %s", branch))
}

if tag != "" && tag != "{{.git.tag}}" {
Copy link
Member

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

//VCSTag represents tag known by the repositories manager
type VCSTag struct {
Tag string `json:"tag"`
Sha string `json:"sha"`
Copy link
Member

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

@yesnault
Copy link
Member

yesnault commented Aug 14, 2018

missing :

  • some documentation too
  • GitClone SQL to add tag in parameter (advanced parameter?)
  • git.tag in default payload
  • suggest.go : missing git.tag in variable suggestion

@@ -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")
Copy link
Member

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 <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
@ovh-cds
Copy link
Collaborator

ovh-cds commented Aug 14, 2018

CDS Report it#5566.0 ✘

  • w-it

    • w-it ✘
      Unit Tests Report
  • Platform model admin [tests/cli_admin_platform_model.yml]

  • Application Command TestSuite [tests/cli_application.yml]

  • Environment Command TestSuite [tests/cli_environment.yml]

  • Pipeline Command TestSuite [tests/cli_pipeline.yml]

  • Pipeline Export / Import Command TestSuite [tests/cli_pipeline_export_import.yml]

  • Action Command TestSuite with cdsctl [tests/clictl_action.yml]

  • Broadcast Command TestSuite [tests/clictl_admin_broadcast.yml]

  • Plugins Command TestSuite with cdsctl [tests/clictl_admin_plugin_and_platforms.yml]

  • Action Command TestSuite with cdsctl [tests/clictl_admin_services.yml]

  • Application Command TestSuite with CDS ctl [tests/clictl_application.yml]

  • Environement Command TestSuite with CDS ctl [tests/clictl_environment.yml]

  • Group Command TestSuite [tests/clictl_group.yml]

  • Pipeline Command TestSuite with CDS ctl [tests/clictl_pipeline.yml]

  • Project Command TestSuite with CDS ctl [tests/clictl_project.yml]

  • Token Command TestSuite with CDS ctl [tests/clictl_token.yml]

  • User Command TestSuite [tests/clictl_user.yml]

  • Version Command TestSuite [tests/clictl_version.yml]

  • Worker Command TestSuite [tests/clictl_worker_model.yml]

  • Create a simple workflow (ITSCWRKFLW3) and run it [tests/sc_workflow_create_run_join.yml]

  • Create a simple workflow (ITSCWRKFLW1) and pull it [tests/sc_workflow_create_simple.yml]

  • Create a simple workflow (ITSCWRKFLW6) and run it to test gitClone action [tests/sc_workflow_git_clone_tag.yml]

    • import pipeline ✘
    • import workflow ✘
    • run workflow ✘
    • check workflow ✘
  • Workflow (ITSCWRKFLW5) should use the worker key install command [tests/sc_workflow_key_install.yml]

  • Workflow (ITSCWRKFLW4) should use the worker cache command [tests/sc_workflow_run_cache.yml]

  • Create a simple workflow (ITSCWRKFLW2) and run it [tests/sc_workflow_run_simple.yml]

  • Create a simple workflow (ITSCWRKFLW2) run it and then stop it [tests/sc_workflow_stop_simple.yml]

  • Create a simple workflow (ITSCWRKFLW2), update it and run it [tests/sc_workflow_update_run.yml]

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 {
Copy link
Member

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 <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
@fsamin fsamin merged commit d4cac55 into master Aug 17, 2018
@bnjjj bnjjj deleted the feat_git_tag branch August 17, 2018 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants