-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.yml
45 lines (45 loc) · 1.85 KB
/
pipeline.yml
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
pipeline:
- stage_name: check required command and setup env
stage_type: command
command: |
for d in $(echo "docker mvn git bundle");do
command -v $d >/dev/null 2>&1 ||
{ echo "Pipeline requires command $d but it's not installed. Aborting." >&2; exit 1;}
done
bundle install
- stage_name: build docker image
stage_type: command
command: cd base && docker build -t base .
run_after:
- stage_name: run docker container
stage_type: command
command: cd base && ./run.sh node01
run_after:
- stage_name: apply ansible playbook
stage_type: command
command: |
cd vendor &&
git clone https://github.com/ainoya/ansible-examples.git &&
cd ansible-examples/tomcat-standalone &&
TARGET=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' node01) &&
sed -ie "s/{{ host }}/${TARGET}/g" hosts &&
export PYTHONUNBUFFERED=1 &&
export ANSIBLE_HOST_KEY_CHECKING=False
ansible-playbook -i hosts site.yml -T 30 -c ssh 2>&1
run_after:
- stage_name: validate container with serverspec
stage_type: command
command: sleep 10 && bundle exec rake spec 2>&1
- stage_name: maven test app
stage_type: command
command: |
cd vendor &&
git clone https://github.com/ainoya/spring-petclinic.git &&
cd spring-petclinic &&
mvn test 2>&1 > /dev/null
- stage_name: deploy app
stage_type: command
command: cd vendor/spring-petclinic && mvn tomcat7:deploy 2>&1
- stage_name: validate app container with serverspec
stage_type: command
command: bundle exec rake spec