[Agent][Deploy] - update cmii frontend
This commit is contained in:
@@ -2,6 +2,7 @@ package image
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"wdd.io/agent-common/utils"
|
||||
)
|
||||
@@ -10,10 +11,10 @@ var DefaultHarborOperator *HarborOperator
|
||||
|
||||
func TestHarborOperator_BuildOperator(t *testing.T) {
|
||||
harborOperator := &HarborOperator{
|
||||
HarborHost: "http://harbor.wdd.io",
|
||||
HarborPort: "8033",
|
||||
HarborUser: "",
|
||||
HarborPass: "",
|
||||
HarborHost: "http://harbor.cdcyy.com.cn",
|
||||
HarborPort: "",
|
||||
HarborUser: "rad02_drone",
|
||||
HarborPass: "Drone@1234",
|
||||
HarborClient: nil,
|
||||
}
|
||||
|
||||
@@ -32,7 +33,7 @@ func TestHarborOperator_RepoListAll(t *testing.T) {
|
||||
TestHarborOperator_BuildOperator(t)
|
||||
|
||||
//repoListAll := DefaultHarborOperator.RepoListAll("ran")
|
||||
repoListAll := DefaultHarborOperator.RepoListAll("rancher")
|
||||
repoListAll := DefaultHarborOperator.RepoListAll("cmii")
|
||||
|
||||
utils.BeautifulPrint(repoListAll)
|
||||
|
||||
@@ -54,11 +55,43 @@ func TestHarborOperator_ArtifactListAll(t *testing.T) {
|
||||
artifactListAll := DefaultHarborOperator.ArtifactListAll("cmii", "cmii-uav-user")
|
||||
|
||||
for _, artifact := range artifactListAll {
|
||||
//if len(artifact.Tags) == 0 {
|
||||
// fmt.Println(artifact.Digest)
|
||||
//}
|
||||
for _, tag := range artifact.Tags {
|
||||
fmt.Println(tag.Name)
|
||||
}
|
||||
}
|
||||
utils.BeautifulPrint(artifactListAll)
|
||||
//utils.BeautifulPrint(artifactListAll)
|
||||
|
||||
}
|
||||
|
||||
func TestHarborOperator_CmiiHarborCleanUp(t *testing.T) {
|
||||
TestHarborOperator_BuildOperator(t)
|
||||
|
||||
//repoListAll := DefaultHarborOperator.RepoListAll("ran")
|
||||
repoListAll := DefaultHarborOperator.RepoListAll("cmii")
|
||||
|
||||
for _, repo := range repoListAll {
|
||||
repoName := strings.TrimPrefix(repo.Name, "cmii/")
|
||||
artifactListAll := DefaultHarborOperator.ArtifactListAll("cmii", repoName)
|
||||
|
||||
for _, artifact := range artifactListAll {
|
||||
//if len(artifact.Tags) == 0 {
|
||||
// fmt.Println(artifact.Digest)
|
||||
//}
|
||||
for _, tag := range artifact.Tags {
|
||||
if strings.Contains(tag.Name, "snapshot") || strings.Contains(tag.Name, "validation") || strings.Contains(tag.Name, "beta") || strings.Contains(tag.Name, "staging") || strings.Contains(tag.Name, "test") {
|
||||
fmt.Println(tag.Name)
|
||||
fmt.Println(artifact.Digest)
|
||||
fmt.Println()
|
||||
DefaultHarborOperator.ArtifactDeleteOne("cmii", repoName, artifact.Digest)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//utils.BeautifulPrint(artifactListAll)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user