[ Cmii ] [ Octopus ] - real project

This commit is contained in:
zeaslity
2024-02-04 09:52:04 +08:00
parent a83e7da008
commit 19378b9b79
10 changed files with 220 additions and 114 deletions

View File

@@ -188,6 +188,7 @@ func ImageTagFromListAndPushToCHarbor(referenceImageList []string, targetHarborH
pushResult := ImagePushToOctopusKindHarbor(targetImageName)
if pushResult == nil {
errorPushImageNameList = append(errorPushImageNameList, cmiiImageFullName)
continue
}
scanner := bufio.NewScanner(pushResult)
for scanner.Scan() {
@@ -265,7 +266,6 @@ func ImagePullCMiiFromFileJson(filePathName string) {
func ImagePullFromFullNameList(fullImageNameList []string) (errorPullImageList []string) {
for _, dep := range fullImageNameList {
loginToDockerHub()
pullResult := ImagePullFromCmiiHarbor(dep)
if pullResult == nil {
@@ -451,16 +451,20 @@ func convertCMiiImageMapToList(cmiiImageVersionMap map[string]string) (fullImage
return fullImageNameList
}
func loginToDockerHub() {
func loginToDockerHub(HarborFullHost string) {
if HarborFullHost == "" {
HarborFullHost = "https://registry-1.docker.io"
}
login, err := apiClient.RegistryLogin(context.TODO(), types.AuthConfig{
Username: "icederce",
Password: "loveff.cxc.23",
Auth: "aWNlZGVyY2U6bG92ZWZmLmN4Yy4yMw==",
ServerAddress: "https://registry-1.docker.io",
ServerAddress: HarborFullHost,
})
if err != nil {
log.ErrorF("[loginToDockerHub] - login failed !")
log.ErrorF("[loginToDockerHub] - login to %s failed !", HarborFullHost)
}
log.DebugF("[loginToDockerHub] - login is %s", login.Status)