Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautam committed Nov 20, 2019
1 parent d047fd5 commit ec17f08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/utils/ext_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func GetResourceOfType(url string, cred *RegistryAuth, bearerToken string, targe
req.SetBasicAuth(cred.User, cred.Password)
}

if bearerToken != "" {
if len(bearerToken) > 0 {
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+bearerToken)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhook/quay_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (qw *QuayWebhook) Run() {
qr := &QuayRepo{}
json.NewDecoder(r.Body).Decode(qr)
for _, registry := range qw.registryAuths {
if strings.Contains(qr.DockerURL, registry.URL) {
if strings.Contains(qr.DockerURL, registry.URL) && len(registry.Token) > 0 {
qw.webhook(registry.Token, qr)
}
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func (qw *QuayWebhook) webhook(bearerToken string, qr *QuayRepo) {
url = fmt.Sprintf("%s/tag", url)
err := utils.GetResourceOfType(url, nil, bearerToken, rt)
if err != nil {
log.Errorf("Webhook: Error in getting docker repo: %e", err)
log.Errorf("Webhook: Error in getting docker repo: %+v", err)
}

for _, tagDigest := range rt.Tags {
Expand Down

0 comments on commit ec17f08

Please sign in to comment.