Skip to content

Commit

Permalink
changing token strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasSUSE committed Dec 11, 2024
1 parent 0722cc5 commit b53b282
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/images/checkImages.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ func CheckImages() error {
imagesOutsideNamespace := checkPattern(imageTagMap)

// Get a token to access the Docker Hub API
token, err := retrieveToken()
if err != nil {
logrus.Infof("failed to retrieve token, requests will be unauthenticated: %v", err)
}
token := getTokenFromEIO()

// Loop through all images and tags to check if they exist
for image := range imageTagMap {
Expand Down Expand Up @@ -154,3 +151,12 @@ func retrieveCredentials() *TokenRequest {
Password: password,
}
}

func getTokenFromEIO() string {
token := os.Getenv("DOCKERHUB_TOKEN")
if token == "" {
logrus.Infof("DOCKERHUB_TOKEN not set, requests will be unauthenticated")
}

return token
}

0 comments on commit b53b282

Please sign in to comment.