cloudapi: Make container name and tag optional

If the user does not pass a name, use the distribution as a name
A provided tag is used only if name is provided. It
The tag's default is a generated using UUID to avoid collisions
This commit is contained in:
Ygal Blum 2022-08-01 18:47:20 +03:00 committed by Tom Gundersen
parent 1847a6ae05
commit ca32d7b729
4 changed files with 122 additions and 117 deletions

View file

@ -71,8 +71,7 @@ function createReqFile() {
"ref": "${OSTREE_REF}"
},
"upload_options": {
"name": "${DISTRO}-${IMAGE_TYPE}",
"tag": "${CI_COMMIT_REF_SLUG}"
"name": "${DISTRO}-${IMAGE_TYPE}"
}
}
}
@ -80,10 +79,10 @@ EOF
}
function checkUploadStatusOptions() {
local IMAGE_URL
IMAGE_URL=$(echo "$UPLOAD_OPTIONS" | jq -r '.url')
local IMAGE_URL_WITHOUT_TAG
IMAGE_URL_WITHOUT_TAG=$(echo "$UPLOAD_OPTIONS" | jq -r '.url' | awk -F ":" '{print $1}')
test "${IMAGE_URL}" = "${CI_REGISTRY}/${CI_PROJECT_PATH}/${DISTRO}-${IMAGE_TYPE}:${CI_COMMIT_REF_SLUG}"
test "${IMAGE_URL_WITHOUT_TAG}" = "${CI_REGISTRY}/${CI_PROJECT_PATH}/${DISTRO}-${IMAGE_TYPE}"
}
function verify() {