Skip to content

Commit

Permalink
check: issue with new convention naming
Browse files Browse the repository at this point in the history
check stage, will do no provide any BUILD_JOB_NAME
so pending state will remain forever in pending and block the process
in gitlab

Signed-off-by: Jonathan  Monnet <jmonnet@baylibre.com>
  • Loading branch information
Baylibrejmonnet committed Jun 2, 2022
1 parent 3b48abe commit 6ba9eec
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
16 changes: 8 additions & 8 deletions pkg/check/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ func (command *Command) Run(request Request) (Response, error) {
continue
}

target := request.Source.GetTargetURL()
name := request.Source.GetPipelineName()
// target := request.Source.GetTargetURL()
// name := request.Source.GetPipelineName()

options := gitlab.SetCommitStatusOptions{
Name: &name,
TargetURL: &target,
State: gitlab.Pending,
}
// options := gitlab.SetCommitStatusOptions{
// Name: &name,
// TargetURL: &target,
// State: gitlab.Pending,
// }

_, _, _ = command.client.Commits.SetCommitStatus(mr.SourceProjectID, mr.SHA, &options)
// _, _, _ = command.client.Commits.SetCommitStatus(mr.SourceProjectID, mr.SHA, &options)

versions = append(versions, pkg.Version{ID: mr.IID, UpdatedAt: updatedAt})

Expand Down
2 changes: 2 additions & 0 deletions pkg/check/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
. "github.com/DrummyFloyd/gitlab-merge-request-resource/pkg"
)

// cas ou pas de number donc list merge request

type Request struct {
Source Source `json:"source"`
Version Version `json:"version,omitempty"`
Expand Down
34 changes: 19 additions & 15 deletions pkg/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ import (
"regexp"
"strings"
"time"

"github.com/xanzy/go-gitlab"
)

type Source struct {
URI string `json:"uri"`
PrivateToken string `json:"private_token"`
Insecure bool `json:"insecure"`
SkipWorkInProgress bool `json:"skip_work_in_progress,omitempty"`
SkipDrafts bool `json:"skip_drafts,omitempty"`
SkipNotMergeable bool `json:"skip_not_mergeable,omitempty"`
SkipTriggerComment bool `json:"skip_trigger_comment,omitempty"`
ConcourseUrl string `json:"concourse_url,omitempty"`
PipelineName string `json:"pipeline_name,omitempty"`
Labels []string `json:"labels,omitempty"`
TargetBranch string `json:"target_branch,omitempty"`
SourceBranch string `json:"source_branch,omitempty"`
Sort string `json:"sort,omitempty"`
Paths []string `json:"paths,omitempty"`
IgnorePaths []string `json:"ignore_paths,omitempty"`
URI string `json:"uri"`
MrIID int `json:"mr_iid"`
PrivateToken string `json:"private_token"`
Insecure bool `json:"insecure"`
SkipWorkInProgress bool `json:"skip_work_in_progress,omitempty"`
SkipDrafts bool `json:"skip_drafts,omitempty"`
SkipNotMergeable bool `json:"skip_not_mergeable,omitempty"`
SkipTriggerComment bool `json:"skip_trigger_comment,omitempty"`
ConcourseUrl string `json:"concourse_url,omitempty"`
PipelineName string `json:"pipeline_name,omitempty"`
Labels []string `json:"labels,omitempty"`
TargetBranch string `json:"target_branch,omitempty"`
SourceBranch string `json:"source_branch,omitempty"`
Sort string `json:"sort,omitempty"`
Paths []string `json:"paths,omitempty"`
IgnorePaths []string `json:"ignore_paths,omitempty"`
States []gitlab.EventTypeValue `json:"states,omitempty"`
}

type Version struct {
Expand Down

0 comments on commit 6ba9eec

Please sign in to comment.