diff --git a/pkg/provider/gitlab.go b/pkg/provider/gitlab.go index 3e114606470a47be92032a4b0441d1224978ccae..611c8047ae4c12e21797aa2b7095b1cb8a9fbf31 100644 --- a/pkg/provider/gitlab.go +++ b/pkg/provider/gitlab.go @@ -19,7 +19,7 @@ type GitLabRepository struct { } func (repo *GitLabRepository) Init(config map[string]string) error { - gitlabBaseUrl := config["gitlabBaseUrl"] + gitlabBaseUrl := config["gitlab_baseurl"] if gitlabBaseUrl == "" { gitlabBaseUrl = os.Getenv("CI_SERVER_URL") } @@ -32,17 +32,17 @@ func (repo *GitLabRepository) Init(config map[string]string) error { return errors.New("gitlab token missing") } - branch := config["gitlabBranch"] + branch := config["gitlab_branch"] if branch == "" { branch = os.Getenv("CI_COMMIT_BRANCH") } - projectID := config["gitlabProjectID"] + projectID := config["gitlab_projectid"] if projectID == "" { projectID = os.Getenv("CI_PROJECT_ID") } if projectID == "" { - return fmt.Errorf("gitlabProjectID is required") + return fmt.Errorf("gitlab_projectid is required") } repo.projectID = projectID diff --git a/pkg/provider/gitlab_test.go b/pkg/provider/gitlab_test.go index 11e883a6b3fc77fc7711c4f110a76df2644e9554..49b5177a128a3c9b3c21e870f9f4d1bb9eea6a89 100644 --- a/pkg/provider/gitlab_test.go +++ b/pkg/provider/gitlab_test.go @@ -24,16 +24,16 @@ func TestNewGitlabRepository(t *testing.T) { repo = &GitLabRepository{} err = repo.Init(map[string]string{ - "token": "token", - "gitlabProjectID": "1", + "token": "token", + "gitlab_projectid": "1", }) require.NoError(err) repo = &GitLabRepository{} err = repo.Init(map[string]string{ - "gitlabBaseUrl": "https://mygitlab.com", - "token": "token", - "gitlabProjectID": "1", + "gitlab_baseurl": "https://mygitlab.com", + "token": "token", + "gitlab_projectid": "1", }) require.NoError(err) require.Equal("https://mygitlab.com/api/v4/", repo.client.BaseURL().String(), "invalid custom instance initialization") @@ -117,10 +117,10 @@ func getNewGitlabTestRepo(t *testing.T) (*GitLabRepository, *httptest.Server) { ts := httptest.NewServer(http.HandlerFunc(GitlabHandler)) repo := &GitLabRepository{} err := repo.Init(map[string]string{ - "gitlabBaseUrl": ts.URL, - "token": "gitlab-examples-ci", - "gitlabBranch": "", - "gitlabProjectID": strconv.Itoa(GITLAB_PROJECT_ID), + "gitlab_baseurl": ts.URL, + "token": "gitlab-examples-ci", + "gitlab_branch": "", + "gitlab_projectid": strconv.Itoa(GITLAB_PROJECT_ID), }) require.NoError(t, err)