X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Freleng%2Freleng-release-create-branch.sh;h=663ff19e73f9e0bc879e2663924f66ef868baab4;hb=c04f88ca91b7612c70bcae9c8a70a98d5bd46c6e;hp=ec8365340886885118e2d36d38309117cd2e6d06;hpb=71e3c19841704f65956e23407223bd3792664e48;p=releng.git diff --git a/jjb/releng/releng-release-create-branch.sh b/jjb/releng/releng-release-create-branch.sh index ec8365340..663ff19e7 100644 --- a/jjb/releng/releng-release-create-branch.sh +++ b/jjb/releng/releng-release-create-branch.sh @@ -10,8 +10,8 @@ set -xe # Configure the git user/email as we'll be pushing up changes -git config user.name "jenkins-ci" -git config user.email "jenkins-opnfv-ci@opnfv.org" +git config --global user.name "jenkins-ci" +git config --global user.email "jenkins-opnfv-ci@opnfv.org" # Ensure we are able to generate Commit-IDs for new patchsets curl -kLo .git/hooks/commit-msg https://gerrit.opnfv.org/gerrit/tools/hooks/commit-msg @@ -26,12 +26,25 @@ STREAM=${STREAM:-'nostream'} RELEASE_FILES=$(git diff HEAD^1 --name-only -- "releases/$STREAM") for release_file in $RELEASE_FILES; do - python releases/scripts/create_branch.py -f $release_file + + while read -r repo branch ref; do + + echo "$repo" "$branch" "$ref" + branches="$(git ls-remote "https://gerrit.opnfv.org/gerrit/$repo.git" "refs/heads/$branch")" + + if ! [ -z "$branches" ]; then + echo "refs/heads/$branch already exists at $ref ($branches)" + else + ssh -n -f -p 29418 gerrit.opnfv.org gerrit create-branch "$repo" "$branch" "$ref" + fi + + done < <(python releases/scripts/repos.py -b -f "$release_file") + python releases/scripts/create_jobs.py -f $release_file NEW_FILES=$(git status --porcelain --untracked=no | cut -c4-) if [ -n "$NEW_FILES" ]; then git add $NEW_FILES - git commit -m "Create Stable Branch Jobs for $(basename $release_file .yaml)" + git commit -sm "Create Stable Branch Jobs for $(basename $release_file .yaml)" git push origin HEAD:refs/for/master fi done