-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(retention) refactor to use go swagger api
Signed-off-by: Ziming Zhang <zziming@vmware.com>
- v2.12.2
- v2.12.2-rc2
- v2.12.2-rc1
- v2.12.1
- v2.12.1-rc3
- v2.12.1-rc2
- v2.12.1-rc1
- v2.12.0
- v2.12.0-rc2
- v2.12.0-rc1
- v2.11.2
- v2.11.2-rc.1
- v2.11.2-rc1
- v2.11.1
- v2.11.1-rc2
- v2.11.1-rc1
- v2.11.0
- v2.11.0-rc3
- v2.11.0-rc2
- v2.11.0-rc1
- v2.10.3
- v2.10.3-rc1
- v2.10.2
- v2.10.2-rc1
- v2.10.1
- v2.10.1-rc1
- v2.10.0
- v2.10.0-rc2
- v2.10.0-rc1
- v2.9.5
- v2.9.5-rc1
- v2.9.4
- v2.9.4-rc1
- v2.9.3
- v2.9.3-rc2
- v2.9.3-rc1
- v2.9.2
- v2.9.2-rc1
- v2.9.1
- v2.9.1-rc1
- v2.9.0
- v2.9.0-rc3
- v2.9.0-rc2
- v2.9.0-rc1
- v2.8.6
- v2.8.6-rc1
- v2.8.5
- v2.8.5-rc1
- v2.8.4
- v2.8.4-rc1
- v2.8.3
- v2.8.3-rc1
- v2.8.2
- v2.8.2-rc1
- v2.8.1
- v2.8.1-rc1
- v2.8.0
- v2.8.0-rc2
- v2.8.0-rc1
- v2.7.4
- v2.7.4-rc1
- v2.7.3
- v2.7.3-rc1
- v2.7.2
- v2.7.2-rc1
- v2.7.1
- v2.7.1-rc1
- v2.7.0
- v2.7.0-rc2
- v2.7.0-rc1
- v2.6.4
- v2.6.4-rc1
- v2.6.3
- v2.6.3-rc1
- v2.6.2
- v2.6.2-rc2
- v2.6.2-rc1
- v2.6.1
- v2.6.1-rc1
- v2.6.0
- v2.6.0-rc3
- v2.6.0-rc2
- v2.6.0-rc1
- v2.5.6
- v2.5.6-rc1
- v2.5.5
- v2.5.5-rc1
- v2.5.4
- v2.5.4-rc1
- v2.5.3
- v2.5.3-rc1
- v2.5.2
- v2.5.2-rc1
- v2.5.1
- v2.5.1-rc1
- v2.5.0
- v2.5.0-rc4
- v2.5.0-rc3
- v2.5.0-rc2
- v2.5.0-rc1
- v2.4.3
- v2.4.3-rc1
- v2.4.2
- v2.4.2-rc1
- v2.4.1
- v2.4.1-rc2
- v2.4.1-rc1
- v2.4.0
- v2.4.0-rc2
- v2.4.0-rc1
- v2.3.5
- v2.3.5-rc1
- v2.3.4
- v2.3.4-rc1
- v2.3.3
- v2.3.3-rc1
- v2.3.2
- v2.3.2-rc1
- v2.3.1
- v2.3.1-rc1
- v2.3.0
- v2.3.0-rc3
- v2.3.0-rc2
- v2.3.0-rc1
- v2.3.0.-rc1
- v2.2.4
- v2.2.4-rc1
- v2.2.3
- v2.2.3-rc1
- v2.2.2
- v2.2.2-rc1
- v2.2.1
- v2.2.1-rc2
- v2.2.1-rc1
- v2.2.0
- v2.2.0-rc4
- v2.2.0-rc3
- v2.2.0-rc2
- v2.2.0-rc1
- src/v2.2.1
- remote-debug-edition
- baseline
Showing
25 changed files
with
1,465 additions
and
1,780 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package retention | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/goharbor/harbor/src/lib/log" | ||
"github.com/goharbor/harbor/src/pkg/scheduler" | ||
) | ||
|
||
func init() { | ||
err := scheduler.RegisterCallbackFunc(SchedulerCallback, retentionCallback) | ||
if err != nil { | ||
log.Fatalf("failed to register retention callback, %v", err) | ||
} | ||
} | ||
|
||
func retentionCallback(ctx context.Context, p string) error { | ||
param := &TriggerParam{} | ||
if err := json.Unmarshal([]byte(p), param); err != nil { | ||
return fmt.Errorf("failed to unmarshal the param: %v", err) | ||
} | ||
_, err := Ctl.TriggerRetentionExec(ctx, param.PolicyID, param.Trigger, false) | ||
return err | ||
} |
Oops, something went wrong.