File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- set -x
17+ set -xe
1818shopt -s globstar
1919
20+ app_version=" "
21+
2022delete_app_version () {
21- yes | gcloud --project=" $GOOGLE_PROJECT_ID " \
22- app versions delete " $GOOGLE_VERSION_ID "
23+ if [ -n " ${app_version} " ] || [ $# -gt 0 ]; then
24+ yes | gcloud --project=" ${GOOGLE_PROJECT_ID} " \
25+ app versions delete " ${1-${app_version} } "
26+ fi
2327}
2428handle_error () {
2529 errcode=$? # Remember the error code so we can exit with it after cleanup
2630
2731 # Clean up
2832 delete_app_version
2933
30- exit $errcode
34+ exit ${ errcode}
3135}
3236trap handle_error ERR
3337
@@ -36,10 +40,18 @@ shellcheck ./**/*.sh
3640
3741# Find all jenkins.sh's and run them.
3842find . -mindepth 2 -maxdepth 5 -name jenkins.sh -type f | while read path; do
43+ dir=" ${path%/ jenkins.sh} "
44+ app_version=" jenkins-${dir// [^a-z]/ } "
3945 (
40- pushd " ${path% jenkins.sh} "
41- /bin/bash ./jenkins.sh
46+ pushd " ${dir} "
47+ # Need different app versions because flex can't deploy over an existing
48+ # version
49+ GOOGLE_VERSION_ID=" ${app_version} " /bin/bash ./jenkins.sh
50+ echo " Return code: $? "
51+
52+ # Clean up the app version in the background
53+ nohup delete_app_version " ${app_version} " &
4254 )
4355done
4456
45- delete_app_version
57+ wait
You can’t perform that action at this time.
0 commit comments