[ Server ] [ Harbor ] - sync projects - 6
This commit is contained in:
@@ -289,17 +289,19 @@ 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 !")
|
||||||
|
|
||||||
existReplicationPolicy, err := targetClient.GetReplicationPolicyByName(ctx, octopusReplicationPolicy.Name)
|
policies, err := targetClient.ListReplicationPolicies(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, []string{
|
return false, []string{
|
||||||
"[Harbor Sync Project ] - get exists replication policy failed !",
|
"[Harbor Sync Project ] - get exists replication policy failed !",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if existReplicationPolicy != nil {
|
for _, policy := range policies {
|
||||||
err := targetClient.DeleteReplicationPolicyByID(ctx, existReplicationPolicy.ID)
|
if policy.Name == octopusReplicationPolicy.Name {
|
||||||
if err != nil {
|
err := targetClient.DeleteReplicationPolicyByID(ctx, policy.ID)
|
||||||
return false, []string{
|
if err != nil {
|
||||||
"[Harbor Sync Project ] - delete exists replication policy failed !",
|
return false, []string{
|
||||||
|
"[Harbor Sync Project ] - delete exists replication policy failed !",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user