-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathexample-springboot.sh
executable file
·67 lines (57 loc) · 1.9 KB
/
example-springboot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash -e
#
# NOTE: For the very first deployment please follow
# the steps in the README for the target platform setup.
#
# The periodic regeneration is configured as a scheduled
# pipeline in GitLab > CI/CD > Schedules.
#
# To run this field test locally, see the instructions
# in the /tests/README.rst document.
GITLAB_PROJECT_NAME="appuio%2Fexample-springboot"
BASEDIR=$(dirname $0)
source ${BASEDIR}/include/logging.sh
source ${BASEDIR}/include/api/gitlab.sh
log 1 'Delete existing merge requests, Git tags, etc.'
for IID in $(gitlab GET 'merge_requests?state=all&scope=all' \
| sed -E -e 's/"iid":([0-9]*),/\n\1\n/g' | sed -e '/^[^0-9].*$/d'); do
echo 'Delete MR !'${IID}' ...'
gitlab DELETE merge_requests/$IID
done
for TAG in $(gitlab GET repository/tags \
| sed -E -e 's/"name":"([^"]*)",/\n\1\n/g' | sed -E -e '/^(\[|")/d'); do
echo 'Delete Git tag '${TAG}' ...'
gitlab DELETE repository/tags/$TAG
done
log 2 'Create demo project from scratch and push it'
tox -e cookiecutter -- \
project_name="Example SpringBoot" \
project_description="Spring Boot Hello World" \
vcs_platform=GitLab.com \
vcs_account=appuio \
ci_service=.gitlab-ci.yml \
cloud_platform=APPUiO \
cloud_account="[email protected]" \
environment_strategy=dedicated \
deployment_strategy=gitops \
framework=SpringBoot \
license=GPL-3 \
push=force \
${*} \
--no-input
cd /tmp/painless-generated-projects/example-springboot
log 3 'Prepare feature branch'
# TODO: reuse existing code
log 4 'Add an untested feature'
# TODO: reuse existing code
log 5 'Create merge request'
# TODO: as existing code (see Example Django)
log 6 'Allow pipeline to build and push an image'
for minutes in $(seq 13 -1 1); do
echo "- Waiting... ($minutes' remaining)"
sleep 1m
done
log 7 'Trigger production release'
git checkout main
git tag 1.0.0
git push --tags --force