Skip to content

Commit

Permalink
feat(api): manage tag on ascode entities (#6791)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Jan 18, 2024
1 parent 37a8a90 commit fcf5a37
Show file tree
Hide file tree
Showing 58 changed files with 691 additions and 1,321 deletions.
8 changes: 4 additions & 4 deletions cli/cdsctl/admin_hooks_repository_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func adminHooksRepoEventGetRun(v cli.Values) (interface{}, error) {
EventName string `cli:"event_name"`
VCSServerName string `cli:"vcs_server_name"`
RepositoryName string `cli:"repository_name"`
Branch string `cli:"branch"`
Ref string `cli:"ref"`
Commit string `cli:"commit"`
Path []string `cli:"path"`
Event string `cli:"event"`
Expand All @@ -95,7 +95,7 @@ func adminHooksRepoEventGetRun(v cli.Values) (interface{}, error) {
EventName: event.EventName,
VCSServerName: event.VCSServerName,
RepositoryName: event.RepositoryName,
Branch: event.ExtractData.Branch,
Ref: event.ExtractData.Ref,
Commit: event.ExtractData.Commit,
Path: event.ExtractData.Paths,
Event: string(event.Body),
Expand Down Expand Up @@ -137,7 +137,7 @@ func adminHooksRepoEventListRun(v cli.Values) (cli.ListResult, error) {
Created time.Time `cli:"created"`
EventName string `cli:"event_name"`
Status string `cli:"status"`
Branch string `cli:"branch"`
Ref string `cli:"ref"`
Commit string `cli:"commit"`
}
rs := make([]Result, 0, len(events))
Expand All @@ -147,7 +147,7 @@ func adminHooksRepoEventListRun(v cli.Values) (cli.ListResult, error) {
Status: e.Status,
EventName: e.EventName,
Created: time.Unix(0, e.Created),
Branch: e.ExtractData.Branch,
Ref: e.ExtractData.Ref,
Commit: e.ExtractData.Commit,
})
}
Expand Down
6 changes: 3 additions & 3 deletions cli/cdsctl/experimental_project_repository_analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/spf13/cobra"
"github.com/rockbears/yaml"
"github.com/spf13/cobra"

"github.com/ovh/cds/cli"
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func projectRepositoryGetFunc(v cli.Values) error {
type AnalysisCli struct {
ID string `json:"id"`
Created time.Time `json:"created"`
Branch string `json:"branch"`
Ref string `json:"ref"`
Commit string `json:"commit"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
Expand All @@ -77,7 +77,7 @@ func projectRepositoryGetFunc(v cli.Values) error {
}

resp := AnalysisCli{
Branch: analysis.Branch,
Ref: analysis.Ref,
ID: analysis.ID,
Error: analysis.Data.Error,
Commit: analysis.Commit,
Expand Down
10 changes: 9 additions & 1 deletion cli/cdsctl/experimental_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ var workflowRunCmd = cli.Command{
{
Name: "branch",
},
{
Name: "tag",
},
{
Name: "data",
Default: "{}",
Expand All @@ -236,14 +239,19 @@ func workflowRunFunc(v cli.Values) error {
repoId := v.GetString("repo_identifier")
wkfName := v.GetString("workflow_name")
branch := v.GetString("branch")
tag := v.GetString("tag")
data := v.GetString("data")

if tag != "" && branch != "" {
return fmt.Errorf("you cannot use branch and tag together")
}

var payload map[string]interface{}
if err := json.Unmarshal([]byte(data), &payload); err != nil {
return fmt.Errorf("unable to read json data")
}

run, err := client.WorkflowV2Run(context.Background(), projKey, vcsId, repoId, wkfName, payload, cdsclient.WithQueryParameter("branch", branch))
run, err := client.WorkflowV2Run(context.Background(), projKey, vcsId, repoId, wkfName, payload, cdsclient.WithQueryParameter("branch", branch), cdsclient.WithQueryParameter("tag", tag))
if err != nil {
return err
}
Expand Down
97 changes: 0 additions & 97 deletions contrib/grpcplugins/action/checkout/go.mod

This file was deleted.

Loading

0 comments on commit fcf5a37

Please sign in to comment.