From 96a871d37152ec6edfb1f9912c157447795f3bbe Mon Sep 17 00:00:00 2001 From: zeaslity Date: Thu, 16 Nov 2023 11:58:13 +0800 Subject: [PATCH] [ Server ] [ Harbor ] - sync projects - 10 --- agent-go/executor/HarborExecutor.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/agent-go/executor/HarborExecutor.go b/agent-go/executor/HarborExecutor.go index 5b62fb2..9a59378 100644 --- a/agent-go/executor/HarborExecutor.go +++ b/agent-go/executor/HarborExecutor.go @@ -322,6 +322,24 @@ func (hOp *HarborOperator) SyncProjectExec(funcArgs []string) (bool, []string) { } } + realOctopusReplicationPolicy, err := targetClient.GetReplicationPolicyByName(ctx, octopusReplicationPolicyName) + if err != nil { + return false, []string{ + "[Harbor Sync Project ] - failed to get the realOctopusReplicationPolicy!", + err.Error(), + } + } + + err = targetClient.TriggerReplicationExecution(ctx, &model.StartReplicationExecution{ + PolicyID: realOctopusReplicationPolicy.ID, + }) + if err != nil { + return false, []string{ + "[Harbor Sync Project ] - failed to start the harbor sync execution !", + err.Error(), + } + } + return true, nil } func (hOp *HarborOperator) Command(baseFuncName string, funcArgs ...string) []string {