[ Server ] [ Harbor ] - sync projects - 7
This commit is contained in:
@@ -289,18 +289,15 @@ func (hOp *HarborOperator) SyncProjectExec(funcArgs []string) (bool, []string) {
|
|||||||
// 在源 Harbor 中创建复制策略
|
// 在源 Harbor 中创建复制策略
|
||||||
log.Info("[Harbor Sync Project ] - Start To Sync Project !")
|
log.Info("[Harbor Sync Project ] - Start To Sync Project !")
|
||||||
|
|
||||||
policies, err := targetClient.ListReplicationPolicies(ctx)
|
policies, _ := targetClient.ListReplicationPolicies(ctx)
|
||||||
if err != nil {
|
if policies != nil {
|
||||||
return false, []string{
|
for _, policy := range policies {
|
||||||
"[Harbor Sync Project ] - get exists replication policy failed !",
|
if policy.Name == octopusReplicationPolicy.Name {
|
||||||
}
|
err := targetClient.DeleteReplicationPolicyByID(ctx, policy.ID)
|
||||||
}
|
if err != nil {
|
||||||
for _, policy := range policies {
|
return false, []string{
|
||||||
if policy.Name == octopusReplicationPolicy.Name {
|
"[Harbor Sync Project ] - delete exists replication policy failed !",
|
||||||
err := targetClient.DeleteReplicationPolicyByID(ctx, policy.ID)
|
}
|
||||||
if err != nil {
|
|
||||||
return false, []string{
|
|
||||||
"[Harbor Sync Project ] - delete exists replication policy failed !",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user