-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
71 lines (63 loc) · 2.22 KB
/
Jenkinsfile
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
#!/usr/bin/env groovy
properties([
disableConcurrentBuilds(),
])
def allowed_branch_names = [
'development': 'development',
'mango_flow': 'development',
'devops-image-build-refactor': 'development',
'main': 'latest',
'hotfix/invalid-sessions-hardening': 'development'
]
def deploy_tier = [
'development': 'test',
'main': 'quality',
]
def publish = allowed_branch_names.containsKey(env.BRANCH_NAME)
def tag = ""
def tier = ""
if (publish) {
tag = allowed_branch_names[env.BRANCH_NAME]
if (deploy_tier.containsKey(env.BRANCH_NAME)) {
tier = deploy_tier[env.BRANCH_NAME]
}
}
// default for branche of extra packes from git(ea) repos: development
extraPackageBranch = 'development'
if ( env.BRANCH_NAME == 'main' ) {
extraPackageBranch = 'main'
}
node() {
deleteDir() // start from a clean sheet
checkout scm // check out the base repo
// now fetch the extra repos we want to include
dir('extra-packages') {
sh "git clone --single-branch -b ${extraPackageBranch} https://gitea.icts.kuleuven.be/foz/mangoflow-custom-tasks.git"
sh "git clone --single-branch -b ${extraPackageBranch} https://gitea.icts.kuleuven.be/foz/mango-flow.git"
sh "git clone --single-branch -b ${extraPackageBranch} https://gitea.icts.kuleuven.be/foz/mango-audit.git"
sh "git clone --single-branch -b ${extraPackageBranch} https://gitea.icts.kuleuven.be/foz/mango-opensearch.git"
}
sh 'cp -rf extra-packages/mango-flow/src/mango_flow src/plugins'
sh 'cp -rf extra-packages/mango-audit/src/mango_audit src/plugins'
sh 'cp -rf extra-packages/mango-opensearch/src/mango_open_search src/plugins'
// followed by the custom tasks
sh 'cp -rf extra-packages/mangoflow-custom-tasks/src/fogcoa_validation.py src/plugins/mango_flow/tasks'
sh 'find src/plugins'
stash name: 'mango_plugins', includes: 'src/plugins/**/*'
// static analysis
sonarScanner {}
buildDockerImage {
namespace = 'foz'
imageName = 'mango'
imageTag = tag
noPublish = !publish
unstash = 'mango_plugins'
}
}
if (tier!="") {
stage("Deploy") {
build job: '/team-faciliteiten-voor-onderzoek/gitea/nomadjobs/mango-portal/', wait: true, parameters: [
[$class: 'StringParameterValue', name: 'Environment', value: tier]
]
}
}