Add flag to create metadata structure if absent
This patch adds --create flag to artifact
metadata update command to force creation of artifact
metadata structure if not present. Moreover
the obsote "precreateKeyReleaseMetadataFile" function is
removed
Change-Id: I663ed60eeb4f9fdf6e0b1500fdafabe980cdeebb
Related-PROD: PROD-34227
diff --git a/src/com/mirantis/mk/ReleaseWorkflow.groovy b/src/com/mirantis/mk/ReleaseWorkflow.groovy
index bfb1155..10de202 100644
--- a/src/com/mirantis/mk/ReleaseWorkflow.groovy
+++ b/src/com/mirantis/mk/ReleaseWorkflow.groovy
@@ -69,27 +69,6 @@
}
/**
- * Pre-create release metadata directory structure
- *
- * @param key metadata key
- * @param metadataDir metadata directory
- * @param dirdepth the level at which YAML file should be created
- */
-
-def precreateKeyReleaseMetadataFile(String key, String metadataDir, Integer dirdepth = 0) {
- common.infoMsg("This method is deprecated and should not be used with new metadata app")
- def keySize = key.split(':').size() - 1
- if (dirdepth > 0 && dirdepth - 1 <= keySize) {
- def dirPath = metadataDir + '/' + key.split(':')[0..dirdepth - 1].join('/')
- sh "if ! test -d \"${dirPath}\" ; then mkdir -p \"${dirPath}\"; fi"
- if (dirdepth - 1 != keySize) {
- def pathToDummyFile = dirPath + '/' + key.split(':')[dirdepth] + '.yml'
- sh "if ! test -f \"${pathToDummyFile}\" ; then touch \"${pathToDummyFile}\"; fi"
- }
- }
-}
-
-/**
* Update release metadata value and upload CR to release metadata repository
*
* @param key metadata key (Several keys could be passed joined by ';' character)
@@ -165,7 +144,7 @@
if (keyArr.size() == valueArr.size()) {
docker.image(toxDockerImage).inside("--volume ${repoDir}:/workspace") {
for (i in 0..keyArr.size()-1) {
- sh "cd /workspace && tox -qq -e metadata -- update --key '${keyArr[i]}' --value '${valueArr[i]}'"
+ sh "cd /workspace && tox -qq -e metadata -- update --create --key '${keyArr[i]}' --value '${valueArr[i]}'"
}
}
}