-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
121 lines (112 loc) · 4.8 KB
/
Jenkinsfile
File metadata and controls
121 lines (112 loc) · 4.8 KB
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
#!groovy
@Library([
'pipe-build-lib',
'ces-build-lib',
'dogu-build-lib'
]) _
String clientSecret = ''
def pipe = new com.cloudogu.sos.pipebuildlib.DoguPipe(this, [
doguName : 'cas',
shellScripts : ['''
resources/startup.sh
resources/logging.sh
resources/create-sa.sh
resources/remove-sa.sh
resources/test-password-logging.sh
resources/pre-upgrade.sh
resources/post-upgrade.sh
resources/upgrade-notification.sh
resources/util.sh
'''
],
doBatsTests : true,
runIntegrationTests: true,
doSonarTests : true,
dependencies : ['nginx', 'cas'],
defaultBranch : "master"
])
pipe.setBuildProperties()
pipe.addDefaultStages()
com.cloudogu.ces.dogubuildlib.EcoSystem ecoSystem = pipe.ecoSystem
pipe.insertStageAfter('Bats Tests', 'Gradle Build & Test') {
String gradleDockerImage = 'eclipse-temurin:21-jdk-alpine'
com.cloudogu.ces.cesbuildlib.Gradle gradlew = new com.cloudogu.ces.cesbuildlib.GradleWrapperInDocker(this, gradleDockerImage)
dir('app') {
gradlew "clean build"
gradlew 'test'
junit allowEmptyResults: true, testResults: '**/build/test-results/test/TEST-*.xml'
}
}
pipe.insertStageBefore('Setup', 'Start OIDC-Provider') {
// launching and setting up keycloak, adding test user, group, scope mapping etc
ecoSystem.vagrant.sshOut """
cd /dogu/integrationTests/keycloak/ && \
./kc-down.sh && \
./kc-up.sh -H ${ecoSystem.externalIP} && \
./kc-setup.sh -H ${ecoSystem.externalIP} && \
./kc-add-user.sh && \
./kc-group.sh
"""
// retrieve secret from setup
clientSecret = ecoSystem.vagrant.sshOut """
cd /dogu/integrationTests/keycloak/
cat kc_out.env | \
grep CLIENT_SECRET= kc_out.env | cut -d'=' -f2-
"""
echo "clientSecret length: ${clientSecret.size()}"
}
pipe.overrideStage('Setup') {
ecoSystem.loginBackend('cesmarvin-setup')
ecoSystem.setup([registryConfig:"""
"cas": {
"forgot_password_text": "Contact your admin",
"legal_urls": {
"privacy_policy": "https://www.triology.de/",
"terms_of_service": "https://docs.cloudogu.com/",
"imprint": "https://cloudogu.com/"
},
"oidc": {
"enabled": "true",
"discovery_uri": "http://${ecoSystem.externalIP}:9000/auth/realms/Test/.well-known/openid-configuration",
"client_id": "cas",
"display_name": "cas",
"optional": "true",
"scopes": "openid email profile groups",
"allowed_groups": "testers",
"attribute_mapping": "email:mail,family_name:surname,given_name:givenName,preferred_username:username,name:displayName,groups:externalGroups"
}
},
"_global": {
"password-policy": {
"must_contain_capital_letter": "true",
"must_contain_lower_case_letter": "true",
"must_contain_digit": "true",
"must_contain_special_character": "true",
"min_length": "14"
}
}
""", registryConfigEncrypted:"""
"cas" : {
"oidc": {
"client_secret": "${clientSecret}"
}
}
"""])
}
pipe.overrideStage('Integration Tests') {
echo "Create custom dogu to access OAuth endpoints for the integration tests"
ecoSystem.vagrant.ssh "sudo docker cp /dogu/integrationTests/services/ cas:/etc/cas/services/production/"
ecoSystem.vagrant.sshOut "sudo docker exec cas ls /etc/cas/services/production"
// Wait for Service-Watch start delay (see: cas.service-registry.schedule.start-delay)
sleep time: 30, unit: 'SECONDS'
ecoSystem.runCypressIntegrationTests([
cypressImage : "cypress/included:13.13.2",
enableVideo : params.EnableVideoRecording,
enableScreenshots: params.EnableScreenshotRecording])
// run special non-encrypted password test
echo "Run unencrypted password test script"
ecoSystem.vagrant.sshOut 'chmod +x /dogu/resources/test-password-logging.sh'
def testreport = ecoSystem.vagrant.sshOut "sudo /dogu/resources/test-password-logging.sh ${ecoSystem.externalIP}"
echo "${testreport}"
}
pipe.run()