2 # SPDX-License-Identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
12 GIT_URL=${GIT_URL:-https://gerrit.opnfv.org/gerrit}
13 STREAM=${STREAM:-'nostream'}
14 RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM")
16 echo "--> Verifying $RELEASE_FILES."
17 for release_file in $RELEASE_FILES; do
18 # Verify the release file schema
19 python releases/scripts/verify_schema.py \
20 -s releases/schema.yaml \
23 # Verify tag for each repo exist and are attached to commits on stable-branch
24 while read -r repo tag ref
26 echo "--> Cloning $repo"
27 if [ ! -d $repo ]; then
28 git clone $GIT_URL/$repo.git $repo
30 pushd $repo &> /dev/null
32 echo "--> Checking for tag: $tag"
33 if ! (git tag -l | grep $tag &> /dev/null); then
34 echo "$tag does not exist"
41 echo "--> Checking if $ref is on stable/$STREAM"
42 if ! (git branch -a --contains $ref | grep "stable/$STREAM"); then
43 echo "--> ERROR: $ref for $repo is not on stable/$STREAM!"
44 # If the tag exists but is on the wrong ref, there's nothing
45 # we can do. But if the tag neither exists nor is on the
46 # correct branch we need to fail the verification.
47 if [ $TAG_EXISTS = false ]; then
51 if [[ $TAG_EXISTS = false && "$JOB_NAME" =~ "merge" ]]; then
52 # If the tag doesn't exist and we're in a merge job,
53 # everything has been verified up to this point and we
54 # are ready to create the tag.
55 git config --global user.name "jenkins-ci"
56 git config --global user.email "jenkins-opnfv-ci@opnfv.org"
57 echo "--> Creating $tag tag for $repo at $ref"
58 git tag -am "$tag" $tag $ref
59 echo "--> Pushing tag"
60 echo "[noop] git push origin $tag"
62 # For non-merge jobs just output the ref info.
63 git show -s --format="%h %s %d" $ref
68 echo "--> Done verifing $repo"
69 done < <(python releases/scripts/repos.py -f $release_file)