Skip to content

Commit 15b7bfd

Browse files
Vishal Takbalasankarc
andcommitted
Merge branch 'fix-ci-job-token-header' into 'main'
Fix headers passed when using CI_JOB_TOKEN See merge request https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/6075 Merged-by: Vishal Tak <vtak@gitlab.com> Approved-by: Vishal Tak <vtak@gitlab.com> Reviewed-by: GitLab Duo <gitlab-duo@gitlab.com> Co-authored-by: Balasankar "Balu" C <balasankar@gitlab.com>
2 parents fc199fd + 983525a commit 15b7bfd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

magefiles/pulp/releases.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net/http"
77
"os"
88
"slices"
9-
"strings"
109
"time"
1110

1211
"github.com/samber/lo"
@@ -49,6 +48,11 @@ var (
4948
branches = []string{"stable", "unstable"}
5049
)
5150

51+
var tokenHeaders = map[string]string{
52+
"CI_JOB_TOKEN": "JOB-TOKEN",
53+
"PRIVATE_TOKEN": "PRIVATE-TOKEN",
54+
}
55+
5256
func Releases(dist, branch string) ([]string, error) {
5357
if err := validateInputs(dist, branch); err != nil {
5458
return nil, err
@@ -100,7 +104,8 @@ func getToken() (string, string, error) {
100104
return "", "", fmt.Errorf("%s cannot be empty", tokenType)
101105
}
102106

103-
tokenType = strings.ReplaceAll(tokenType, "_", "-")
107+
// Translate token type to required headers
108+
tokenType = tokenHeaders[tokenType]
104109

105110
return tokenType, tokenValue, nil
106111
}

0 commit comments

Comments
 (0)