Skip to content

Commit

Permalink
fix(cli): prefer constant over name (#3608)
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman authored Feb 3, 2023
1 parent f1fc4bd commit bfe30df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cli/internal/ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ func Name() string {
return Info().Name
}

// Constant returns the name of the CI vendor as a constant
func Constant() string {
return Info().Constant
}

// Info returns information about a CI vendor
func Info() Vendor {
// check both the env var key and value
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (c *ApiClient) PutArtifact(hash string, artifactBody []byte, duration int,
}
req.Header.Set("User-Agent", c.UserAgent())
if ci.IsCi() {
req.Header.Set("x-artifact-client-ci", ci.Name())
req.Header.Set("x-artifact-client-ci", ci.Constant())
}
if tag != "" {
req.Header.Set("x-artifact-tag", tag)
Expand Down Expand Up @@ -403,7 +403,7 @@ func (c *ApiClient) RecordAnalyticsEvents(events []map[string]interface{}) error
}
req.Header.Set("User-Agent", c.UserAgent())
if ci.IsCi() {
req.Header.Set("x-artifact-client-ci", ci.Name())
req.Header.Set("x-artifact-client-ci", ci.Constant())
}
resp, err := c.HttpClient.Do(req)
if resp != nil && resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down

0 comments on commit bfe30df

Please sign in to comment.