-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Single Active Replication #21347
Open
bupd
wants to merge
22
commits into
goharbor:main
Choose a base branch
from
container-registry:feat/add-job-skipper
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+178
−9
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a90c66d
add checkConcurrency gocraft/work middleware WIP
239595e
add jobs skipper WIP
ad38815
add skip If Running option in Replication policy
bupd dd55f50
Add Skip if running checkbox in replication & update swagger
bupd cef5984
update mocks & lint
bupd f50e1c2
rename skip if running to single active replication
bupd 9d9b400
fix lint
bupd c0ffee8
make skip as final status
bupd c0ffee1
update UI and message
bupd cd8c84f
Merge branch 'main' into feat/add-job-skipper
bupd 51763e1
adds observations manager
380d27f
fixes execution not found error
6c81e0f
bugfix
207a7a0
skip executions based on database lookup
ae83efe
fix execution skip
bupd ef0c2d3
cleanup & fix linter errors
e9d7032
Merge branch 'main' into feat/add-job-skipper
bupd cafec6f
cleanup unneeded changes
bupd cafe6f5
add tests for Single Active Replication
bupd bd43b88
Merge branch 'main' into feat/add-job-skipper
bupd 14f8c56
Merge branch 'main' into feat/add-job-skipper
bupd 0082e7e
Merge branch 'main' into feat/add-job-skipper
bupd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -49,6 +49,8 @@ type ExecutionManager interface { | |
// In other cases, the execution status can be calculated from the referenced tasks automatically | ||
// and no need to update it explicitly | ||
MarkDone(ctx context.Context, id int64, message string) (err error) | ||
// MarkSkipped marks the status of the specified execution as skipped. | ||
MarkSkipped(ctx context.Context, id int64, message string) (err error) | ||
// MarkError marks the status of the specified execution as error. | ||
// It must be called to update the execution status when failed to create tasks. | ||
// In other cases, the execution status can be calculated from the referenced tasks automatically | ||
|
@@ -139,6 +141,17 @@ func (e *executionManager) UpdateExtraAttrs(ctx context.Context, id int64, extra | |
return e.executionDAO.Update(ctx, execution, "ExtraAttrs", "UpdateTime") | ||
} | ||
|
||
func (e *executionManager) MarkSkipped(ctx context.Context, id int64, message string) error { | ||
now := time.Now() | ||
return e.executionDAO.Update(ctx, &dao.Execution{ | ||
ID: id, | ||
Status: job.SkippedStatus.String(), | ||
StatusMessage: message, | ||
UpdateTime: now, | ||
EndTime: now, | ||
}, "Status", "StatusMessage", "UpdateTime", "EndTime") | ||
} | ||
|
||
Comment on lines
+144
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function used to mark the duplicate executions as skipped. |
||
func (e *executionManager) MarkDone(ctx context.Context, id int64, message string) error { | ||
now := time.Now() | ||
return e.executionDAO.Update(ctx, &dao.Execution{ | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "Lade die Ressourcen von der entfernten Registry auf den lokalen Harbor runter.", | ||
"DESTINATION_NAMESPACE": "Spezifizieren des Ziel-Namespace. Wenn das Feld leer ist, werden die Ressourcen unter dem gleichen Namespace abgelegt wie in der Quelle.", | ||
"OVERRIDE": "Spezifizieren, ob die Ressourcen am Ziel überschrieben werden sollen, falls eine Ressource mit gleichem Namen existiert.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "E-Mail sollte eine gültige E-Mail-Adresse wie [email protected] sein.", | ||
"USER_NAME": "Darf keine Sonderzeichen enthalten und sollte kürzer als 255 Zeichen sein.", | ||
"FULL_NAME": "Maximale Länge soll 20 Zeichen sein.", | ||
|
@@ -560,6 +561,7 @@ | |
"ALLOWED_CHARACTERS": "Erlaubte Sonderzeichen", | ||
"TOTAL": "Gesamt", | ||
"OVERRIDE": "Überschreiben", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "Aktiviere Regel", | ||
"OVERRIDE_INFO": "Überschreiben", | ||
"OPERATION": "Operation", | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "Pull the resources from the remote registry to the local Harbor.", | ||
"DESTINATION_NAMESPACE": "Specify the destination namespace. If empty, the resources will be put under the same namespace as the source.", | ||
"OVERRIDE": "Specify whether to override the resources at the destination if a resource with the same name exists.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "Email should be a valid email address like [email protected].", | ||
"USER_NAME": "Cannot contain special characters and maximum length should be 255 characters.", | ||
"FULL_NAME": "Maximum length should be 20 characters.", | ||
|
@@ -560,6 +561,7 @@ | |
"ALLOWED_CHARACTERS": "Allowed special characters", | ||
"TOTAL": "Total", | ||
"OVERRIDE": "Override", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "Enable rule", | ||
"OVERRIDE_INFO": "Override", | ||
"OPERATION": "Operation", | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "Pull de recursos del remote registry al local Harbor.", | ||
"DESTINATION_NAMESPACE": "Especificar el namespace de destino. Si esta vacio, los recursos se colocan en el mismo namespace del recurso.", | ||
"OVERRIDE": "Especifique si desea anular los recursos en el destino si existe un recurso con el mismo nombre.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "El email debe ser una dirección válida como [email protected].", | ||
"USER_NAME": "Debe tener una longitud máxima de 255 caracteres y no puede contener caracteres especiales.", | ||
"FULL_NAME": "La longitud máxima debería ser de 20 caracteres.", | ||
|
@@ -560,6 +561,7 @@ | |
"ALLOWED_CHARACTERS": "Caracteres Especiales Permitidos", | ||
"TOTAL": "Total", | ||
"OVERRIDE": "Sobreescribir", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "Activar regla", | ||
"OVERRIDE_INFO": "Sobreescribir", | ||
"CURRENT": "Actual", | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "Pull les ressources du registre distant vers le Harbor local.", | ||
"DESTINATION_NAMESPACE": "Spécifier l'espace de nom de destination. Si vide, les ressources seront placées sous le même espace de nom que la source.", | ||
"OVERRIDE": "Spécifier s'il faut remplacer les ressources dans la destination si une ressource avec le même nom existe.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "L'e-mail doit être une adresse e-mail valide comme [email protected].", | ||
"USER_NAME": "Ne peut pas contenir de caractères spéciaux et la longueur maximale est de 255 caractères.", | ||
"FULL_NAME": "La longueur maximale est de 20 caractères.", | ||
|
@@ -560,6 +561,7 @@ | |
"ALLOWED_CHARACTERS": "Caractères spéciaux autorisés", | ||
"TOTAL": "Total", | ||
"OVERRIDE": "Surcharger", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "Activer la règle", | ||
"OVERRIDE_INFO": "Surcharger", | ||
"OPERATION": "Opération", | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "원격 레지스트리의 리소스를 로컬 'Harbor'로 가져옵니다.", | ||
"DESTINATION_NAMESPACE": "대상 네임스페이스를 지정합니다. 비어 있으면 리소스는 소스와 동일한 네임스페이스에 배치됩니다.", | ||
"OVERRIDE": "동일한 이름의 리소스가 있는 경우 대상의 리소스를 재정의할지 여부를 지정합니다.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "이메일은 [email protected]과 같은 유효한 이메일 주소여야 합니다.", | ||
"USER_NAME": "특수 문자를 포함할 수 없으며 최대 길이는 255자입니다.", | ||
"FULL_NAME": "최대 길이는 20자입니다.", | ||
|
@@ -557,6 +558,7 @@ | |
"ALLOWED_CHARACTERS": "허용되는 특수 문자", | ||
"TOTAL": "총", | ||
"OVERRIDE": "Override", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "규칙 활성화", | ||
"OVERRIDE_INFO": "Override", | ||
"OPERATION": "작업", | ||
|
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"PULL_BASED": "Trazer recursos do repositório remoto para o Harbor local.", | ||
"DESTINATION_NAMESPACE": "Especificar o namespace de destino. Se vazio, os recursos serão colocados no mesmo namespace que a fonte.", | ||
"OVERRIDE": "Sobrescrever recursos no destino se já existir com o mesmo nome.", | ||
"SINGLE_ACTIVE_REPLICATION": "Specify whether to defer execution until the previous active execution finishes, avoiding the execution of the same replication rules multiple times in parallel.", | ||
"EMAIL": "Deve ser um endereço de e-mail válido como [email protected].", | ||
"USER_NAME": "Não pode conter caracteres especiais. Tamanho máximo de 255 caracteres.", | ||
"FULL_NAME": "Tamanho máximo de 20 caracteres.", | ||
|
@@ -558,6 +559,7 @@ | |
"ALLOWED_CHARACTERS": "Símbolos permitidos", | ||
"TOTAL": "Total", | ||
"OVERRIDE": "Sobrescrever", | ||
"SINGLE_ACTIVE_REPLICATION": "Single active replication", | ||
"ENABLED_RULE": "Habiltar regra", | ||
"OVERRIDE_INFO": "Sobrescrever", | ||
"CURRENT": "atual", | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core logic lies here.