summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-09 21:08:15 +0000
committerGerrit Code Review <review@openstack.org>2018-08-09 21:08:15 +0000
commita57fa7a1b866373d2c22319cd62e3d8485863b50 (patch)
tree1d47668eb7e5acde2a61004b0d5dfe96f9ee9f6e
parent2c023c77723a153592982dcecc204d2907639b51 (diff)
parent77622310f3d1f47bd7c7803015b76113025c1322 (diff)
Merge "Add --dry-run to branch-stx"2018.08.0
-rwxr-xr-xrelease/branch-stx.sh70
1 files changed, 44 insertions, 26 deletions
diff --git a/release/branch-stx.sh b/release/branch-stx.sh
index 8a92682..7530825 100755
--- a/release/branch-stx.sh
+++ b/release/branch-stx.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2# branch-stx.sh - create STX branches based on today 2# branch-stx.sh - create STX branches based on today
3# 3#
4# branch-stx.sh [<manifest>] 4# branch-stx.sh [--dry-run] [<manifest>]
5# 5#
6# * get the repo list from stx-manifest in both starlingx and stx-staging remotes 6# * get the repo list from stx-manifest in both starlingx and stx-staging remotes
7# * create a new branch 7# * create a new branch
@@ -21,6 +21,12 @@
21 21
22set -e 22set -e
23 23
24# Grab options
25if [[ "$1" == "--dry-run" ]]; then
26 DRY_RUN=1
27 shift;
28fi
29
24# Where to get the repo list 30# Where to get the repo list
25MANIFEST=${1:-default.xml} 31MANIFEST=${1:-default.xml}
26 32
@@ -53,15 +59,20 @@ defaultbranch=$branch"
53 git add .gitreview 59 git add .gitreview
54 git commit -s -m "Update .gitreview for $branch" 60 git commit -s -m "Update .gitreview for $branch"
55 git show 61 git show
56 git review -t "create-${branch}" 62 if [[ -z $DRY_RUN ]]; then
63 git review -t "create-${branch}"
64 else
65 echo "### skipping review submission to $branch"
66 fi
57} 67}
58 68
59# branch_repo <repo-uri> <sha> <branch-base> 69# branch_repo <remote> <repo-uri> <sha> <branch-base>
60function branch_repo { 70function branch_repo {
61 local repo=$1 71 local remote=$1
62 local sha=$2 72 local repo=$2
63 local branch=$3 73 local sha=$3
64 local tag=$4 74 local branch=$4
75 local tag=$5
65 76
66 local repo_dir=${repo##*/} 77 local repo_dir=${repo##*/}
67 78
@@ -80,6 +91,31 @@ function branch_repo {
80 # tag branch point at $sha 91 # tag branch point at $sha
81 git tag -f $tag $sha 92 git tag -f $tag $sha
82 93
94 # Push the new goodness back up
95 if [[ "$r" == "starlingx" ]]; then
96 # Do the Gerrit way
97
98 # set up gerrit remote
99 git review -s
100
101 # push
102 if [[ -z $DRY_RUN ]]; then
103 git push gerrit $branch
104 else
105 echo "### skipping push to $branch"
106 fi
107
108 update_gitreview $branch
109 else
110 # Do the Github way
111 # push
112 if [[ -z $DRY_RUN ]]; then
113 git push --tags -u origin $branch
114 else
115 echo "### skipping push to $branch"
116 fi
117 fi
118
83 cd - 119 cd -
84} 120}
85 121
@@ -88,24 +124,6 @@ for r in $REMOTES; do
88 # crap, convert github URLs to git: 124 # crap, convert github URLs to git:
89 repos=$(sed -e 's|https://github.com/starlingx-staging|git@github.com:starlingx-staging|g' <<<$repos) 125 repos=$(sed -e 's|https://github.com/starlingx-staging|git@github.com:starlingx-staging|g' <<<$repos)
90 for i in $repos; do 126 for i in $repos; do
91 branch_repo $i HEAD $BRANCH $TAG 127 branch_repo $r $i HEAD $BRANCH $TAG
92 repo_dir=${i##*/}
93 cd $repo_dir
94 if [[ "$r" == "starlingx" ]]; then
95 # Do the Gerrit way
96
97 # set up gerrit remote
98 git review -s
99
100 # push
101 git push gerrit $BRANCH
102
103 update_gitreview $BRANCH
104 else
105 # Do the Github way
106 # push
107 git push --tags -u origin $BRANCH
108 fi
109 cd -
110 done 128 done
111done 129done