-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcodefresh.yml
191 lines (178 loc) · 7.91 KB
/
codefresh.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
version: '1.0'
steps:
sakai_clone:
type: git-clone
title: Sakai Clone Repository
description: Clone the specific sakai repo you want to test
repo: https://github.com/${{REPO_OWNER}}/${{REPO_NAME}}.git
revision: '${{REPO_REVISION}}'
when:
condition:
all:
notBinaryRelease: '(includes("${{BINARY_RELEASE}}", "$") == true) || ("${{BINARY_RELEASE}}" == "-")'
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
binary_release:
title: Download Sakai Binary Release
description: Download some binary Sakai release to test it without build from source
image: arkban/alpine-aws-wget:latest
working_directory: ${{main_clone}}
commands:
- rm -rf ./tomcat/target
- mkdir -p ./tomcat/target
- mkdir -p ./binaries
- test ! -f ./binaries/sakai-bin-${{BINARY_RELEASE}}.tar.gz && wget -O ./binaries/sakai-bin-${{BINARY_RELEASE}}.tar.gz http://source.sakaiproject.org/release/${{BINARY_RELEASE}}/artifacts/sakai-bin-${{BINARY_RELEASE}}.tar.gz --no-check-certificate ; echo "Sakai Binary Release ${{BINARY_RELEASE}} already download."
- tar xzvC ./tomcat/target -f ./binaries/sakai-bin-${{BINARY_RELEASE}}.tar.gz
when:
condition:
all:
useBinaryRelease: '(includes("${{BINARY_RELEASE}}", "$") == false) && ("${{BINARY_RELEASE}}" != "-")'
clean_tomcat:
title: Clean Tomcat Deployment
description: Clear all tomcat folders
image: arkban/alpine-aws-wget:latest
working_directory: ${{main_clone}}
commands:
- rm -rf ./tomcat/target
when:
condition:
all:
notBinaryRelease: '(includes("${{BINARY_RELEASE}}", "$") == true) || ("${{BINARY_RELEASE}}" == "-")'
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
mvn_enc:
title: Encrypt Maven Settings For Oracle Download
description: Make necessary steps to be able to download jdbc driver from oracle maven repository
image: maven:3.2.3-jdk-8
working_directory: ${{main_clone}}
environment:
- MASTER_PASSWORD=${{MASTER_PASSWORD}}
- ORACLE_USER=${{ORACLE_USER}}
- ORACLE_PASS=${{ORACLE_PASS}}
- DEBUG_ENC=${{DEBUG_ENC}}
commands:
- ./maven/mvnsecurity.sh
when:
condition:
all:
existsMasterPassword: 'includes("${{MASTER_PASSWORD}}", "$") == false'
oracleDatabase: '"${{SAKAI_DB_DRIVER}}" == "oracle" || "${{SAKAI_DB_DRIVER}}" == "all"'
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
build_wait:
title: Build Wait For Database Code
description: Create a small java program that test database availability
image: maven:latest
working_directory: ${{main_clone}}
environment:
- MAVEN_OPTS=-Dmaven.repo.local=/codefresh/volume/.m2/repository
commands:
- cp ./maven/settings.xml /root/.m2/settings.xml
- cp ./maven/settings-security.xml /root/.m2/settings-security.xml
- mvn -f wait -P${{SAKAI_DB_DRIVER}} clean install
- mkdir -p ./tomcat/target/lib/
- cp wait/target/*.jar tomcat/target/lib/
when:
condition:
all:
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
build_code:
title: Build Sakai Code Skiping Tests
description: Classic Sakai build from code step without test execution
image: maven:latest
working_directory: ${{sakai_clone}}
environment:
- MAVEN_OPTS=-Dmaven.repo.local=/codefresh/volume/.m2/repository -Dmaven.tomcat.home=/codefresh/volume/sakai-codefresh/tomcat/target
commands:
- mvn -DskipTests=true clean install sakai:deploy
when:
condition:
all:
notBinaryRelease: '(includes("${{BINARY_RELEASE}}", "$") == true) || ("${{BINARY_RELEASE}}" == "-")'
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
build_dockerfile:
title: Build Dockerfile
description: Create dockerfile to build Sakai image
image: arkban/alpine-aws-wget:latest
working_directory: ${{main_clone}}
commands:
- touch ./tomcat/sakai/local.properties
- touch ./tomcat/sakai/sakai.properties
- touch ./tomcat/sakai/placeholder.properties
- echo 'org.quartz.jobStore.isClustered = true' > ./tomcat/sakai/sakai.quartz.properties
- echo 'FROM ${{TOMCAT_IMAGE}}' > ./tomcat/Dockerfile
- echo '' >> ./tomcat/Dockerfile
- cat ./tomcat/dockerfile_base >> ./tomcat/Dockerfile
- cat ./tomcat/dockerfile_sakai >> ./tomcat/Dockerfile
- echo 'EXPOSE 8080' >> ./tomcat/Dockerfile
when:
condition:
all:
notSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == true) || ("${{SAKAI_BASE_TAG}}" == "-")'
build_experimental_dockerfile:
title: Build Dockerfile For Experimental
description: Create dockerfile to build Sakai image with experimental properties
image: arkban/alpine-aws-wget:latest
working_directory: ${{main_clone}}
commands:
- touch ./tomcat/sakai/local.properties
- touch ./tomcat/sakai/sakai.properties
- touch ./tomcat/sakai/placeholder.properties
- echo 'org.quartz.jobStore.isClustered = true' > ./tomcat/sakai/sakai.quartz.properties
- wget -O ./tomcat/sakai/${{PROPERTIES_FILE}} ${{EXPERIMENTAL_PROPS}} --no-check-certificate
- echo 'FROM ${{SAKAI_BASE_TAG}}' > ./tomcat/Dockerfile
- echo '' >> ./tomcat/Dockerfile
- cat ./tomcat/dockerfile_sakai >> ./tomcat/Dockerfile
- echo 'EXPOSE 8080' >> ./tomcat/Dockerfile
when:
condition:
all:
isSakaiExperimental: '(includes("${{SAKAI_BASE_TAG}}", "$") == false) && ("${{SAKAI_BASE_TAG}}" != "-")'
build_database_image:
title: Building Database Image For Oracle
description: Build the database image in case you want to use Oracle
type: build
working_directory: ${{main_clone}}/oracle/
dockerfile: '${{DB_VERSION}}'
image_name: '${{DB_IMAGE}}'
tag: '${{DB_VERSION}}'
metadata:
set:
- database: '${{DB_IMAGE}}'
- version: '${{DB_VERSION}}'
when:
condition:
all:
noSkipOracleBuild: '"${{SKIP_ORACLE_BUILD}}" != "true"'
oracleDatabase: '("${{SAKAI_DB_DRIVER}}" == "oracle" || "${{SAKAI_DB_DRIVER}}" == "all") && (includes("${{DB_VERSION}}","oracle") == true)'
build_image:
title: Building Docker Sakai Image
description: Build docker image with sakai binary code ready to run
type: build
working_directory: ${{main_clone}}/tomcat/
dockerfile: Dockerfile
image_name: '${{SAKAI_IMAGE_NAME}}'
tag: '${{SAKAI_TAG}}'
metadata:
set:
- repo: '${{REPO_OWNER}}/${{REPO_NAME}}'
- revision: '${{REPO_REVISION}}'
- tag: '${{SAKAI_TAG}}'
- server: '${{TOMCAT_IMAGE}}'
- driver: '${{SAKAI_DB_DRIVER}}'
- bin_release: '${{BINARY_RELEASE}}'
- base_image: '${{SAKAI_BASE_TAG}}'
- experimental: '${{EXPERIMENTAL_PROPS}}'
- properties: '${{PROPERTIES_FILE}}'
launch_sakai_composition:
title: Launch Sakai Server Composition
description: Run Sakai composition
type: launch-composition
composition: docker-compose.yml
composition_variables:
- DATABASE_DRIVER=${{SAKAI_DB_DRIVER}}
- DATABASE_IMAGE=${{DB_IMAGE}}:${{DB_VERSION}}
- SAKAI_IMAGE=${{SAKAI_IMAGE_NAME}}:${{SAKAI_TAG}}
environment_name: '${{CF_REPO_NAME}}_${{CF_BRANCH}}'
entry_point: sakai
when:
condition:
all:
noSkipOracleBuild: '"${{SKIP_LAUNCH}}" != "true"'