2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2019 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> release-job.sh"
14 # shellcheck disable=SC1090
17 # Version controlled by JJB_VERSION
18 lf-activate-venv lftools pip idna==2.9 lftools jsonschema twine yq readline
20 # show installed versions
21 python -m pip --version
26 set_variables_common(){
27 echo "INFO: Setting common variables"
28 if [[ -z ${LOGS_SERVER:-} ]] && [[ -z ${CDN_URL:-} ]]; then
29 echo "ERROR: LOGS_SERVER or CDN_URL not defined"
32 NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/"
33 # Verify if using release file or parameters
34 if $USE_RELEASE_FILE ; then
35 release_files=$(git diff-tree -m --no-commit-id -r "$GIT_COMMIT" "$GIT_COMMIT^1" \
36 --name-only -- "releases/" ".releases/")
37 if (( $(grep -c . <<<"$release_files") > 1 )); then
38 echo "INFO: RELEASE FILES ARE AS FOLLOWS: $release_files"
39 echo "ERROR: Adding multiple release files in the same commit"
40 echo "ERROR: OR rename/amend/delete of existing files is not supported."
43 release_file="$release_files"
44 echo "INFO: RELEASE FILE: $release_files"
47 echo "INFO: This job is built with parameters, no release file needed."
51 if [[ -z ${LOG_DIR:-} ]]; then
52 LOG_DIR=$(yq -r ".log_dir" "$release_file")
54 if [[ -n ${LOGS_SERVER:-} ]]; then
55 logs_url="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}"
56 elif [[ -n ${CDN_URL:-} ]]; then
57 logs_url="https://${CDN_URL:-}/logs/${NEXUS_PATH}${LOG_DIR}"
59 logs_url=${logs_url%/} # strip any trailing '/'
61 # Jenkins parameter drop-down defaults DISTRIBUTION_TYPE to None
62 # in the contain/maven release job; get value from release yaml.
63 # Packagecloud and PyPI jobs set the appropriate value.
64 DISTRIBUTION_TYPE="${DISTRIBUTION_TYPE:-None}"
65 if [[ $DISTRIBUTION_TYPE == "None" ]]; then
66 if ! DISTRIBUTION_TYPE=$(yq -r ".distribution_type" "$release_file"); then
67 echo "ERROR: Failed to get distribution_type from $release_file"
72 PATCH_DIR=$(mktemp -d)
74 TAG_RELEASE="${TAG_RELEASE:-None}"
75 if [[ $TAG_RELEASE == "None" ]]; then
76 if grep -q "tag_release" $release_file ; then
77 TAG_RELEASE=$(yq -r .tag_release "$release_file")
83 # Displaying Release Information (Common variables)
84 printf "\t%-30s\n" RELEASE_ENVIRONMENT_INFO:
85 printf "\t%-30s %s\n" RELEASE_FILE: "$release_file"
86 printf "\t%-30s %s\n" LOGS_SERVER: "${LOGS_SERVER:-None}"
87 printf "\t%-30s %s\n" CDN_URL: "${CDN_URL:-None}"
88 printf "\t%-30s %s\n" NEXUS_PATH: "$NEXUS_PATH"
89 printf "\t%-30s %s\n" JENKINS_HOSTNAME: "$JENKINS_HOSTNAME"
90 printf "\t%-30s %s\n" SILO: "$SILO"
91 printf "\t%-30s %s\n" PROJECT: "$PROJECT"
92 printf "\t%-30s %s\n" PROJECT-DASHED: "${PROJECT//\//-}"
93 printf "\t%-30s %s\n" TAG_RELEASE: "$TAG_RELEASE"
94 printf "\t%-30s %s\n" DISTRIBUTION_TYPE: "$DISTRIBUTION_TYPE"
95 printf "\t%-30s %s\n" OVERRIDE_SEMVER_REGEX: "${OVERRIDE_SEMVER_REGEX:-None}"
98 set_variables_maven(){
99 echo "INFO: Setting maven variables"
100 if [[ -z ${VERSION:-} ]]; then
101 VERSION=$(yq -r ".version" "$release_file")
103 if [[ -z ${GIT_TAG:-} ]]; then
104 if grep -q "git_tag" "$release_file" ; then
105 GIT_TAG=$(yq -r ".git_tag" "$release_file")
110 if [[ -z ${LOG_DIR:-} ]]; then
111 LOG_DIR=$(yq -r ".log_dir" "$release_file")
114 # Continuing displaying Release Information (Maven)
115 printf "\t%-30s\n" RELEASE_MAVEN_INFO:
116 printf "\t%-30s %s\n" VERSION: "$VERSION"
117 printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
118 printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
119 printf "\t%-30s %s\n" LOGS_URL: "$logs_url"
122 set_variables_container(){
123 echo "INFO: Setting container variables"
124 if [[ -z ${VERSION:-} ]]; then
125 VERSION=$(yq -r ".container_release_tag" "$release_file")
127 if [[ -z ${GIT_TAG:-} ]]; then
128 if grep -q "git_tag" "$release_file" ; then
129 GIT_TAG=$(yq -r ".git_tag" "$release_file")
134 if grep -q "container_pull_registry" "$release_file" ; then
135 CONTAINER_PULL_REGISTRY=$(yq -r ".container_pull_registry" "$release_file")
137 if grep -q "container_push_registry" "$release_file" ; then
138 CONTAINER_PUSH_REGISTRY=$(yq -r ".container_push_registry" "$release_file")
140 # Make sure both pull and push registries are defined
141 if [ -z ${CONTAINER_PULL_REGISTRY+x} ] || [ -z ${CONTAINER_PUSH_REGISTRY+x} ]; then
142 echo "ERROR: CONTAINER_PULL_REGISTRY and CONTAINER_PUSH_REGISTRY need to be defined"
145 ref=$(yq -r ".ref" "$release_file")
147 # Continuing displaying Release Information (Container)
148 printf "\t%-30s\n" RELEASE_CONTAINER_INFO:
149 printf "\t%-30s %s\n" CONTAINER_RELEASE_TAG: "$VERSION"
150 printf "\t%-30s %s\n" CONTAINER_PULL_REGISTRY: "$CONTAINER_PULL_REGISTRY"
151 printf "\t%-30s %s\n" CONTAINER_PUSH_REGISTRY: "$CONTAINER_PUSH_REGISTRY"
152 printf "\t%-30s %s\n" GIT_REF_TO_TAG: "$ref"
153 printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
156 set_variables_pypi(){
157 echo "INFO: Setting pypi variables"
158 if [[ -z ${LOG_DIR:-} ]]; then
159 LOG_DIR=$(yq -r ".log_dir" "$release_file")
162 if [[ -z ${PYPI_PROJECT:-} ]]; then
163 PYPI_PROJECT=$(yq -r ".pypi_project" "$release_file")
165 if [[ -z ${PYTHON_VERSION:-} ]]; then
166 PYTHON_VERSION=$(yq -r ".python_version" "$release_file")
168 if [[ -z ${VERSION:-} ]]; then
169 VERSION=$(yq -r ".version" "$release_file")
171 if [[ -z ${GIT_TAG:-} ]]; then
172 if grep -q "git_tag" "$release_file" ; then
173 GIT_TAG=$(yq -r ".git_tag" "$release_file")
179 # Continuing displaying Release Information (pypi)
180 printf "\t%-30s\n" RELEASE_PYPI_INFO:
181 printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
182 printf "\t%-30s %s\n" LOGS_URL: "$logs_url"
183 printf "\t%-30s %s\n" PYPI_INDEX: "$PYPI_INDEX" # from job configuration
184 printf "\t%-30s %s\n" PYPI_PROJECT: "$PYPI_PROJECT"
185 printf "\t%-30s %s\n" PYTHON_VERSION: "$PYTHON_VERSION"
186 printf "\t%-30s %s\n" VERSION: "$VERSION"
187 printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
190 set_variables_packagecloud(){
191 echo "INFO: Setting packagecloud variables"
192 if [[ -z ${VERSION:-} ]]; then
193 VERSION=$(yq -r ".version" "$release_file")
195 if [[ -z ${GIT_TAG:-} ]]; then
196 if grep -q "git_tag" $release_file ; then
197 GIT_TAG=$(yq -r ".git_tag" "$release_file")
202 if [[ -z ${LOG_DIR:-} ]]; then
203 LOG_DIR=$(yq -r ".log_dir" "$release_file")
205 if [[ -z ${REF:-} ]]; then
206 REF=$(yq -r ".ref" "$release_file")
208 if [[ -z ${PACKAGE_NAME:-} ]]; then
209 PACKAGE_NAME=$(yq -r ".package_name" "$release_file")
212 printf "\t%-30s %s\n" PACKAGE_NAME: "$PACKAGE_NAME"
213 printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
214 printf "\t%-30s %s\n" LOGS_URL: "$logs_url"
215 printf "\t%-30s %s\n" GIT_REF_TO_TAG: "$REF"
216 printf "\t%-30s %s\n" VERSION: "$VERSION"
217 printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
220 set_variables_artifact(){
221 echo "INFO: Setting artifact variables"
222 if [[ -z ${VERSION:-} ]]; then
223 VERSION=$(yq -r ".version" "$release_file")
225 if [[ -z ${GIT_TAG:-} ]]; then
226 if grep -q "git_tag" $release_file ; then
227 GIT_TAG=$(yq -r ".git_tag" "$release_file")
232 if [[ -z ${REF:-} ]]; then
233 REF=$(yq -r ".ref" "$release_file")
236 printf "\t%-30s\n" RELEASE_ARTIFACT_INFO:
237 printf "\t%-30s %s\n" GERRIT_REF_TO_TAG: "$REF"
238 printf "\t%-30s %s\n" VERSION: "$VERSION"
239 printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
243 echo "INFO: Verifying $release_file against schema $release_schema"
244 lftools schema verify "$release_file" "$release_schema"
249 # Override the regex for projects that do not follow https://semver.org
250 OVERRIDE_SEMVER_REGEX="${OVERRIDE_SEMVER_REGEX:-None}"
251 if [[ $OVERRIDE_SEMVER_REGEX == "None" ]]; then
252 # Use the semver regex taken from https://github.com/fsaintjacques/semver-tool
253 semver_regex="^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$"
255 semver_regex="${OVERRIDE_SEMVER_REGEX}"
258 # Verify SemVer "#.#.#" (SemVer) or "v#.#.#"
259 echo "INFO: Verifying version $VERSION"
260 if [[ $VERSION =~ $semver_regex ]]; then
261 echo "INFO: The version $VERSION is valid"
263 echo "ERROR: The version $VERSION is not valid"
264 echo "ERROR: Valid versions are \"#.#.#\" (SemVer) or \"v#.#.#\""
265 echo "ERROR: Valid version will be matched against \"${semver_regex}\""
266 echo "ERROR: Refer to https://semver.org/ for more details on SemVer"
267 echo "ERROR: Refer SemVer examples from https://github.com/fsaintjacques/semver-tool/#examples"
272 verify_version_match_release(){
273 echo "INFO: Fetching console log from $logs_url"
274 wget -P /tmp "${logs_url}/"console.log.gz
275 echo "INFO: Searching for uploaded step and version $VERSION in job log"
276 if zgrep "Successfully uploaded" /tmp/console.log.gz | grep "$VERSION"; then
277 echo "INFO: found expected strings in job log"
279 echo "ERROR: Defined version in release file does not match staging repo artifacts version to be released"
280 echo "ERROR: Please make sure maven stage job log dir and release version are both correct"
285 # check prerequisites to detect mistakes in the release YAML file
286 verify_pypi_match_release(){
287 echo "INFO: Fetching console log from $logs_url"
288 wget -q -P /tmp "${logs_url}/"console.log.gz
289 echo "INFO: Searching for uploaded step, project $PYPI_PROJECT and version $VERSION in job log"
290 # pypi-upload.sh generates success message with file list
291 if zgrep -i "uploaded" /tmp/console.log.gz | grep "$PYPI_PROJECT" | grep "$VERSION" ; then
292 echo "INFO: found expected strings in job log"
294 echo "ERROR: failed to find expected strings in job log"
299 verify_packagecloud_match_release(){
300 echo "INFO: Fetching console log from $logs_url"
301 wget -q -P /tmp "${logs_url}/"console.log.gz
302 echo "INFO: Searching for uploaded step, package name $PACKAGE_NAME and version $VERSION in job log"
303 if zgrep -E "Pushing.*$PACKAGE_NAME.*$VERSION.*success\!" /tmp/console.log.gz; then
304 echo "INFO: found expected strings in job log"
306 echo "ERROR: failed to find expected strings in job log"
311 # sigul is only available on Centos
312 # TODO: write tag-github-repo function
314 if [[ $TAG_RELEASE == false ]]; then
315 echo "INFO: Skipping code repo tag"
319 if [[ -z ${GERRIT_URL:-} ]]; then
325 echo "INFO: tag repo with $GIT_TAG"
326 # Import public signing key
327 gpg --import "$SIGNING_PUBKEY"
328 if type=$(git cat-file -t "$GIT_TAG"); then
329 if [[ $type == "tag" ]]; then
330 echo "INFO: Repo already has signed tag $GIT_TAG, nothing to do"
332 echo "ERROR: Repo has lightweight tag $GIT_TAG, blocks push of signed tag"
336 echo "INFO: Repo has not yet been tagged $GIT_TAG"
337 git tag -am "${PROJECT//\//-} $GIT_TAG" "$GIT_TAG"
338 sigul --batch -c "$SIGUL_CONFIG" sign-git-tag "$SIGUL_KEY" "$GIT_TAG" < "$SIGUL_PASSWORD"
339 echo "INFO: Showing latest signature for $PROJECT:"
340 echo "INFO: git tag -v $GIT_TAG"
341 git tag -v "$GIT_TAG"
343 ########## Merge Part ##############
344 if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then
345 echo "INFO: Running merge, pushing tag"
346 if [[ $GIT_REPO_BASE == "gerrit" ]]; then
347 gerrit_ssh=$(echo "$GERRIT_URL" | awk -F"/" '{print $3}')
348 git remote set-url origin ssh://"$RELEASE_USERNAME"@"$gerrit_ssh":29418/"$PROJECT"
349 echo -e "Host $gerrit_ssh\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
350 chmod 600 ~/.ssh/config
352 git remote set-url origin "$GIT_CLONE_URL""$RELEASE_USERNAME"/"$PROJECT".git
354 git config user.name "$RELEASE_USERNAME"
355 git config user.email "$RELEASE_EMAIL"
356 git push origin "$GIT_TAG"
362 echo "INFO: Processing nexus release"
363 for staging_url in $(zcat "$PATCH_DIR"/staging-repo.txt.gz | awk -e '{print $2}'); do
364 # extract the domain name from URL
365 NEXUS_URL=$(echo "$staging_url" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
366 echo "INFO: NEXUS_URL: $NEXUS_URL"
367 # extract the staging repo from URL
368 STAGING_REPO=${staging_url#*repositories/}
369 echo "INFO: Running Nexus Verify"
370 lftools nexus release -v --server https://"$NEXUS_URL" "$STAGING_REPO"
371 echo "INFO: Merge will run:"
372 echo "lftools nexus release --server https://$NEXUS_URL $STAGING_REPO"
375 #Run the loop twice, to catch errors on either nexus repo
376 if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then
377 for staging_url in $(zcat "$PATCH_DIR"/staging-repo.txt.gz | awk -e '{print $2}'); do
378 NEXUS_URL=$(echo "$staging_url" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
379 STAGING_REPO=${staging_url#*repositories/}
380 echo "INFO: Promoting $STAGING_REPO on $NEXUS_URL."
381 lftools nexus release --server https://"$NEXUS_URL" "$STAGING_REPO"
386 container_release_file(){
387 echo "INFO: Processing container release"
390 lfn_umbrella="$(echo "$GERRIT_URL" | awk -F"." '{print $2}')"
392 for namequoted in $(yq '.containers[].name' $release_file); do
393 versionquoted=$(yq ".containers[] |select(.name==$namequoted) |.version" $release_file)
395 #Remove extra yaml quotes
396 name="${namequoted#\"}"
398 version="${versionquoted#\"}"
399 version="${version%\"}"
403 echo "INFO: Merge will release $name $version as $VERSION"
404 # Attempt to pull from releases registry to see if the image has been released.
405 if docker pull "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION"; then
406 echo "INFO: $VERSION is already released for image $name, Continuing..."
408 echo "INFO: $VERSION not found in releases, release will be prepared. Continuing..."
409 docker pull "$CONTAINER_PULL_REGISTRY"/"$lfn_umbrella"/"$name":"$version"
410 container_image_id=$(docker images | grep "$name" | grep "$version" | awk '{print $3}')
411 echo "INFO: Merge will run the following commands:"
412 echo "docker tag $container_image_id $CONTAINER_PUSH_REGISTRY/$lfn_umbrella/$name:$VERSION"
413 echo "docker push $CONTAINER_PUSH_REGISTRY/$lfn_umbrella/$name:$VERSION"
414 if [[ "$JOB_NAME" =~ "merge" ]]; then
415 docker tag "$container_image_id" "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION"
416 docker push "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION"
418 echo "#########################"
422 echo "INFO: Merge will tag ref: $ref"
427 maven_release_file(){
428 echo "INFO: Processing maven release"
429 echo "INFO: wget -P $PATCH_DIR ${logs_url}/staging-repo.txt.gz"
430 wget -P "$PATCH_DIR" "${logs_url}/"staging-repo.txt.gz
432 echo "INFO: wget ${logs_url}/patches/{${PROJECT//\//-}.bundle,taglist.log.gz}"
433 wget "${logs_url}"/patches/{"${PROJECT//\//-}".bundle,taglist.log.gz}
434 gunzip taglist.log.gz
435 cat "$PATCH_DIR"/taglist.log
437 git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")"
438 git fetch "$PATCH_DIR/${PROJECT//\//-}.bundle"
439 git merge --ff-only FETCH_HEAD
444 # calls pip to download binary and source distributions from the specified index,
445 # which requires a recent-in-2019 version. Uploads the files it received.
447 echo "INFO: Processing pypi release"
450 pip_pfx="pip download -d $tgtdir --no-deps --python-version $PYTHON_VERSION -i $PYPI_INDEX"
451 module="$PYPI_PROJECT==$VERSION"
452 pip_bin="$pip_pfx $module"
453 echo "INFO: downloading binary: $pip_bin"
455 echo "WARN: failed to download binary distribution"
457 pip_src="$pip_pfx --no-binary=:all: $module"
458 echo "INFO: downloading source: $pip_src"
460 echo "WARN: failed to download source distribution"
462 echo "INFO: Checking files in $tgtdir"
463 # shellcheck disable=SC2012
464 filecount=$(ls $tgtdir | wc -l)
465 if [[ $filecount = 0 ]] ; then
466 echo "ERROR: no files downloaded"
469 # shellcheck disable=SC2046
470 echo "INFO: downloaded $filecount distributions: " $(ls $tgtdir)
473 if [[ ! "$JOB_NAME" =~ "merge" ]] ; then
474 echo "INFO: not a merge job, not uploading files"
478 cmd="twine upload -r $REPOSITORY $tgtdir/*"
480 echo "INFO: dry-run is set, echoing command only"
483 echo "INFO: uploading $filecount distributions to repo $REPOSITORY"
489 packagecloud_verify(){
490 echo "INFO: Verifying $1 exists in staging..."
491 if [[ $1 == $(curl --netrc-file ~/packagecloud_api --silent \
492 https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
493 | yq -r .[].filename) ]]; then
494 echo "INFO: $1 exists in staging!"
495 echo "INFO: Existing package location: https://packagecloud.io$(curl \
496 --netrc-file ~/packagecloud_api --silent \
497 https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
498 | yq -r .[].package_html_url)"
500 echo "ERROR: $1 does not exist in staging"
505 packagecloud_promote(){
506 echo "INFO: Preparing to promote $1..."
507 promote_url="https://packagecloud.io$(curl --netrc-file ~/packagecloud_api \
508 --silent https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
509 | yq -r .[].promote_url)"
510 echo "INFO: Promoting $1 from staging to release"
511 curl --netrc-file ~/packagecloud_api -X POST -F \
512 destination="$2/release" "$promote_url" \
513 | echo "INFO: Promoted package location: \
514 https://packagecloud.io$(yq -r .package_html_url)"
519 artifact_release_file(){
520 echo "INFO: Processing artifact release"
522 ORG=$(echo "$NEXUS_URL" | awk -F'.' '{print $2}')
524 for namequoted in $(yq '.artifacts[].name' $release_file); do
525 pathquoted=$(yq ".artifacts[] |select(.name==$namequoted) |.path" $release_file)
527 #Remove extra yaml quotes
528 name="${namequoted#\"}"
530 path="${pathquoted#\"}"
535 echo "INFO: Merge will post artifact: $name"
536 # Attempt to pull from releases to see if the artifact has been released.
537 if "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"$name"; then
538 echo "INFO: $name is already released as version:$VERSION, Continuing..."
540 echo "INFO: $name not found in releases, release will be prepared. Continuing..."
541 wget "${path}"/"${name}" -o artifacts/"${name}"
542 if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then
543 #lftools sign sigul artifacts
544 curl -v -u <NEXUSUSER>:<NEXUSPASS> --upload-file "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \;
546 echo "#########################"
551 ############################## End Function Declarations ################################
553 # Set common environment variables
556 # Determine the type of release:
557 # - artifact, release-artifact-schema.yaml
558 # - container, release-container-schema.yaml
559 # - maven, release-schema.yaml
560 # - pypi, release-pypi-schema.yaml
561 # - packagecloud, release-packagecloud-schema.yaml
563 case $DISTRIBUTION_TYPE in
566 if $USE_RELEASE_FILE ; then
567 release_schema="release-artifact-schema.yaml"
568 echo "INFO: Fetching schema $release_schema"
569 wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/${release_schema}
572 set_variables_artifact
574 artifact_release_file
578 if $USE_RELEASE_FILE ; then
579 release_schema="release-schema.yaml"
580 echo "INFO: Fetching schema $release_schema"
581 wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/$release_schema
586 verify_version_match_release
591 if $USE_RELEASE_FILE ; then
592 release_schema="release-container-schema.yaml"
593 echo "INFO: Fetching schema $release_schema"
594 wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/${release_schema}
597 set_variables_container
599 container_release_file
603 if $USE_RELEASE_FILE ; then
604 release_schema="release-pypi-schema.yaml"
605 echo "INFO: Fetching schema $release_schema"
606 wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/${release_schema}
611 verify_pypi_match_release
616 if $USE_RELEASE_FILE ; then
617 release_schema="release-packagecloud-schema.yaml"
618 packagecloud_account=$(cat "$ACCOUNT_NAME_FILE")
619 echo "INFO: Fetching schema $release_schema"
620 wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/${release_schema}
623 set_variables_packagecloud
624 verify_packagecloud_match_release
625 for name in $(yq -r '.packages[].name' $release_file); do
627 packagecloud_verify "$package" "$packagecloud_account"
628 if [[ "$JOB_NAME" =~ "merge" ]] && ! $DRY_RUN; then
629 packagecloud_promote "$package" "$packagecloud_account"
635 echo "ERROR: distribution_type: $DISTRIBUTION_TYPE not supported"
640 echo "---> release-job.sh ends"