-
Notifications
You must be signed in to change notification settings - Fork 12
/
pipeline.yml
108 lines (106 loc) · 3.41 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
stages:
- name: RapidAssemble
inputs:
- type: git
branch: master
triggers:
- type: commit
jobs:
- name: WrapPresent
type: builder
artifact_dir: ''
- name: PEP8 Test
type: tester
fail_stage: true
script: source ./macreduce/tests/pep8_style_tests.sh
enable_tests: true
test_file_pattern: flake8.xml
- name: Nose Unit Tests
type: tester
fail_stage: true
script: source ./macreduce/tests/nose_unit_tests.sh
enable_tests: true
test_file_pattern: nosetests.xml
- name: SameDayDelivery
inputs:
- type: job
stage: RapidAssemble
job: WrapPresent
jobs:
- name: SetupServices
type: deployer
target:
url: ${CF_TARGET_URL}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
application: ${CF_APP}
script: |-
#!/bin/bash
##########
# Colors##
##########
Green='\e[0;32m'
Red='\e[0;31m'
Yellow='\e[0;33m'
Cyan='\e[0;36m'
no_color='\e[0m' # No Color
beer='\xF0\x9f\x8d\xba'
delivery='\xF0\x9F\x9A\x9A'
beers='\xF0\x9F\x8D\xBB'
eyes='\xF0\x9F\x91\x80'
cloud='\xE2\x98\x81'
litter='\xF0\x9F\x9A\xAE'
fail='\xE2\x9B\x94'
harpoons='\xE2\x87\x8C'
tools='\xE2\x9A\x92'
present='\xF0\x9F\x8E\x81'
#############
if [ -n "$(echo ${CF_TARGET_URL} | grep ng.bluemix.net)" ]; then
echo -e "${tools}${Cyan} Detected Region: US South${no_color}"
export CF_REGION=US
elif [ -n "$(echo ${CF_TARGET_URL} | grep eu-gb.bluemix.net)" ]; then
echo -e "${tools}${Cyan} Detected Region: United Kingdom${no_color}"
export CF_REGION=UK
elif [ -n "$(echo ${CF_TARGET_URL} | grep au-syd.bluemix.net)" ]; then
echo -e "${tools}${Cyan} Detected Region: Sydney${no_color}"
export CF_REGION=AU
fi
if [ ${CF_REGION} == "US" ] || [ ${CF_REGION} == "UK" ]; then
echo -e "${tools}${Yellow} Pre-creating Experimental Redis Service named [${Cyan}everedis${Yellow}]${no_color}"
echo -e "${tools}${Red} For production usage, a Redis by Compose service instance is strongly recommended${no_color}"
t=0
until [ $t -ge 5 ]
do
cf create-service redis 100 everedis > /dev/null 2>&1 && break
t=$[$t+1]
sleep 15
done
else
echo -e "${tools}${Yellow} RedisCloud service not available in this region${no_color}"
fi
if [ ${CF_REGION} == "US" ] || [ ${CF_REGION} == "UK" ]; then
echo -e "${tools}${Yellow} Pre-creating Experimental MongoDB Service named [${Cyan}evemongo${Yellow}]${no_color}"
echo -e "${tools}${Red} For production usage, a MongoDB by Compose service instance is strongly recommended${no_color}"
t=0
until [ $t -ge 5 ]
do
cf create-service mongodb 100 evemongo > /dev/null 2>&1 && break
t=$[$t+1]
sleep 15
done
else
echo -e "${tools}${Yellow} Experimental MongoDB service not available in this region${no_color}"
fi
- name: DeliverPresent
type: deployer
target:
url: ${CF_TARGET_URL}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
application: ${CF_APP}
script: |-
#!/bin/bash
cf push "${CF_APP}" -b https://github.com/cloudfoundry/python-buildpack
# View logs
#cf logs "${CF_APP}" --recent