X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Frelease-job.sh;h=6510ce5b26a1ff073772f7b9b1859893f9dc15b5;hb=refs%2Fchanges%2F15%2F16715%2F2;hp=31721d11ecc253a4df7d133ce1aed491f05d8630;hpb=5c8d53b2aca8d051b3e20a21b6e6a88cc57a9930;p=releng%2Fglobal-jjb.git diff --git a/shell/release-job.sh b/shell/release-job.sh index 31721d11..6510ce5b 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -82,9 +82,47 @@ nexus_release(){ done } + container_release_file(){ echo "---> Processing container release" - # Container-release code is addressed in a new feature patchset. + local lfn_umbrella + lfn_umbrella="$(echo "$GERRIT_HOST" | awk -F"." '{print $2}')" + + + for namequoted in $(cat $release_file | yq '.containers[].name'); do + versionquoted=$(cat $release_file | yq ".containers[] |select(.name=="$namequoted") |.version") + + #Remove extra yaml quotes + name="${namequoted#\"}" + name="${name%\"}" + version="${versionquoted#\"}" + version="${version%\"}" + + echo "$name" + echo "$version" + echo "---> INFO: Merge will release $name $version as $VERSION" + #Pull from public, to see if we have already tagged this. + if docker pull "$DOCKER_REGISTRY":10002/"$lfn_umbrella"/"$name":"$VERSION"; then + echo "---> OK: $VERSION is already released for image $name, Continuing..." + else + echo "---> OK: $VERSION not found in releases, release will be prepared. Continuing..." + docker pull "$DOCKER_REGISTRY":10001/"$lfn_umbrella"/"$name":"$version" + container_image_id="$(docker images | grep $name | grep $version | awk '{print $3}')" + echo "---> INFO: Merge will run the following commands:" + echo "docker tag $container_image_id $DOCKER_REGISTRY:10002/$lfn_umbrella/$name:$VERSION" + echo "docker push $DOCKER_REGISTRY:10002/$lfn_umbrella/$name:$VERSION" + if [[ "$JOB_NAME" =~ "merge" ]]; then + docker tag "$container_image_id" "$DOCKER_REGISTRY":10002/"$lfn_umbrella"/"$name":"$VERSION" + docker push "$DOCKER_REGISTRY":10002/"$lfn_umbrella"/"$name":"$VERSION" + fi + echo "#########################" + fi + done + + ref="$(niet ".ref" "$release_file")" + echo "---> INFO: Merge will tag ref: $ref" + git checkout "$ref" + tag } maven_release_file(){ @@ -113,8 +151,7 @@ if [ "${LOGS_SERVER}" == 'None' ]; then exit 1 fi -RELEASE_FILE="${RELEASE_FILE:-True}" -if [[ "$RELEASE_FILE" == "True" ]]; then +if $USE_RELEASE_FILE ; then release_files=$(git diff-tree --no-commit-id -r "$GERRIT_PATCHSET_REVISION" --name-only -- "releases/" ".releases/") if (( $(grep -c . <<<"$release_files") > 1 )); then @@ -127,7 +164,7 @@ if [[ "$RELEASE_FILE" == "True" ]]; then fi else - echo "This is job is built with parameters, no release file needed" + echo "This job is built with parameters, no release file needed. Continuing..." release_file="None" fi @@ -173,12 +210,14 @@ echo "DISTRIBUTION_TYPE: $DISTRIBUTION_TYPE" if [[ "$DISTRIBUTION_TYPE" == "maven" ]]; then wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/release-schema.yaml RELEASE_SCHEMA="release-schema.yaml" - if [[ "$RELEASE_FILE" == "True" ]]; then + if $USE_RELEASE_FILE ; then verify_schema fi maven_release_file elif [[ "$DISTRIBUTION_TYPE" == "container" ]]; then - # Container-release code is addressed in a new feature patchset. + wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/release-container-schema.yaml + RELEASE_SCHEMA="release-container-schema.yaml" + verify_schema container_release_file else echo "---> ERROR: distribution_type: $DISTRIBUTION_TYPE not supported" @@ -188,4 +227,3 @@ fi ########################################## echo "########### End Script release-job.sh ###################################" -