[artifactory-replicator] Add DOCKER_OVERWRITE_TAG parameter
- Improve handle boolean variables
- Rename isCheckClean to isActionSpecified
- Remove unsed parameters
Related: PRODX-50457
Change-Id: I7675a922f9b6f1e7884e4a6f438f1ddd2dfa4801
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index c0480c1..bbc26c0 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -1668,7 +1668,6 @@
def envToParam = [
'DESTINATION_USER': '-dst-user',
'ARTIFACT_FILTER': '-artifact-filter',
- 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod',
'ARTIFACT_TYPE': '-artifact-type',
'BINARY_CLEAN': '-bin-cleanup',
'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days',
@@ -1680,9 +1679,8 @@
'SIGNED_IMAGES_PATH': '-signed-images-path',
'DOCKER_CLEAN': '-cleanup',
'DOCKER_OLDER_THAN_DAYS': '-older-than-days',
- 'DOCKER_REPO_PREFIX': '-docker-repo-prefix',
'DOCKER_TAG': '-docker-tag',
- 'FORCE': '-force',
+ 'DOCKER_OVERWRITE_TAG': '-docker-overwrite-tag',
'HELM_CDN_DOMAIN': '-helm-cdn-domain',
'SLACK_CHANNEL': '-slack-channel',
'SLACK_CHANNELS': '-slack-channels',
@@ -1692,27 +1690,24 @@
'SYNC_PATTERN': '-sync-pattern'
]
def cmdParams = ''
- def isCheckClean = false
+ def isActionSpecified = false
for (e in envToParam) {
- if (env[e.key] == null) {
+ if (env[e.key] == null || env[e.key] == 'false') {
continue
- }
- if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN' || e.key == 'BINARY_CLEAN') {
- // Avoid assigning values to boolean options
- if (env[e.key].toBoolean() && !isCheckClean) {
- cmdParams += e.value + ' '
- isCheckClean = true
- }
- } else if (e.key == 'FORCE') {
+ } else if ((e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN' || e.key == 'BINARY_CLEAN') && !isActionSpecified) {
if (env[e.key].toBoolean()) {
+ isActionSpecified = true
cmdParams += e.value + ' '
}
+ } else if (env[e.key] == 'true') {
+ // The value true was specified — consider it as a flag
+ cmdParams += e.value + ' '
} else {
cmdParams += "${e.value} '${env[e.key]}' "
}
}
// No any check or clean was specified - take a default action
- if (!isCheckClean) {
+ if (!isActionSpecified) {
cmdParams += '-replicate'
}
return cmdParams