File tree 1 file changed +19
-7
lines changed
1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change 14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
- set -x
17
+ set -xe
18
18
shopt -s globstar
19
19
20
+ app_version=" "
21
+
20
22
delete_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
23
27
}
24
28
handle_error () {
25
29
errcode=$? # Remember the error code so we can exit with it after cleanup
26
30
27
31
# Clean up
28
32
delete_app_version
29
33
30
- exit $errcode
34
+ exit ${ errcode}
31
35
}
32
36
trap handle_error ERR
33
37
@@ -36,10 +40,18 @@ shellcheck ./**/*.sh
36
40
37
41
# Find all jenkins.sh's and run them.
38
42
find . -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]/ } "
39
45
(
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} " &
42
54
)
43
55
done
44
56
45
- delete_app_version
57
+ wait
You can’t perform that action at this time.
0 commit comments