Skip to content

Commit e365a99

Browse files
author
Maksim Likharev
authored
sync 06/06/2019 (#25)
* adding group for the subscription/approval events (#22) * Bump to version 1.0.0-rc.5 * Fixes Haufe-Lexware/wicked.haufe.io#196 * Fixes Haufe-Lexware/wicked.haufe.io#198 * Bump to version 1.0.0-rc.6 * Update docker group to adapt to new Jenkins * Use classical pipeline again (test) * Try this on the RD jenkins * Allow loading of javascript file in static content (#24) * Change back to "docker" agent * Take out SonarQube for the time being
1 parent 35379d7 commit e365a99

File tree

5 files changed

+96
-87
lines changed

5 files changed

+96
-87
lines changed

Jenkinsfile

+76-76
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
pipeline {
2-
agent {
3-
docker {
4-
image 'haufelexware/wicked.build-agent:latest'
5-
// Add docker group
6-
args '--group-add 125'
7-
}
8-
}
9-
triggers {
10-
pollSCM "H/10 * * * *"
11-
upstream(upstreamProjects: "wicked.env/" + env.BRANCH_NAME.replaceAll("/", "%2F"), threshold: hudson.model.Result.SUCCESS)
12-
}
1+
// pipeline {
2+
// agent {
3+
// docker {
4+
// image 'haufelexware/wicked.build-agent:latest'
5+
// // Add docker group
6+
// args '--group-add 999'
7+
// }
8+
// }
9+
// triggers {
10+
// pollSCM "H/10 * * * *"
11+
// upstream(upstreamProjects: "wicked.env/" + env.BRANCH_NAME.replaceAll("/", "%2F"), threshold: hudson.model.Result.SUCCESS)
12+
// }
1313

14-
stages {
15-
stage('SonarQube analysis') {
16-
steps {
17-
script {
18-
sh 'id'
19-
def dockerTag = env.BRANCH_NAME.replaceAll('/', '-')
20-
if (dockerTag == 'next') {
21-
// requires SonarQube Scanner 2.8+
22-
def scannerHome = tool 'wicked-sonar';
23-
withSonarQubeEnv('sonar') {
24-
sh "${scannerHome}/bin/sonar-scanner"
25-
}
26-
} else {
27-
echo 'Skipping SonarQube, not "next" branch.'
28-
}
29-
}
30-
}
31-
}
14+
// stages {
15+
// stage('SonarQube analysis') {
16+
// steps {
17+
// script {
18+
// sh 'id'
19+
// def dockerTag = env.BRANCH_NAME.replaceAll('/', '-')
20+
// if (dockerTag == 'next') {
21+
// // requires SonarQube Scanner 2.8+
22+
// def scannerHome = tool 'wicked-sonar';
23+
// withSonarQubeEnv('sonar') {
24+
// sh "${scannerHome}/bin/sonar-scanner"
25+
// }
26+
// } else {
27+
// echo 'Skipping SonarQube, not "next" branch.'
28+
// }
29+
// }
30+
// }
31+
// }
3232

33-
stage('Build and Push') {
34-
steps {
35-
script {
36-
withCredentials([
37-
usernamePassword(credentialsId: 'dockerhub_wicked', usernameVariable: 'DOCKER_REGISTRY_USER', passwordVariable: 'DOCKER_REGISTRY_PASSWORD')
38-
]) {
39-
env.DOCKER_TAG = env.BRANCH_NAME.replaceAll('/', '-')
40-
sh './build.sh --push'
41-
}
42-
}
43-
}
44-
}
45-
}
46-
}
33+
// stage('Build and Push') {
34+
// steps {
35+
// script {
36+
// withCredentials([
37+
// usernamePassword(credentialsId: 'dockerhub_wicked', usernameVariable: 'DOCKER_REGISTRY_USER', passwordVariable: 'DOCKER_REGISTRY_PASSWORD')
38+
// ]) {
39+
// env.DOCKER_TAG = env.BRANCH_NAME.replaceAll('/', '-')
40+
// sh './build.sh --push'
41+
// }
42+
// }
43+
// }
44+
// }
45+
// }
46+
// }
4747

48-
// properties([
49-
// pipelineTriggers([
50-
// [$class: "SCMTrigger", scmpoll_spec: "H/10 * * * *"],
51-
// [$class: 'jenkins.triggers.ReverseBuildTrigger', upstreamProjects: "wicked.env/" + env.BRANCH_NAME.replaceAll("/", "%2F"), threshold: hudson.model.Result.SUCCESS]
52-
// ])
53-
// ])
48+
properties([
49+
pipelineTriggers([
50+
[$class: "SCMTrigger", scmpoll_spec: "H/10 * * * *"],
51+
[$class: 'jenkins.triggers.ReverseBuildTrigger', upstreamProjects: "wicked.env/" + env.BRANCH_NAME.replaceAll("/", "%2F"), threshold: hudson.model.Result.SUCCESS]
52+
])
53+
])
5454

55-
// node('docker') {
55+
node('docker') {
5656

57-
// stage('Checkout') {
58-
// checkout scm
59-
// }
57+
stage('Checkout') {
58+
checkout scm
59+
}
6060

61-
// def dockerTag = env.BRANCH_NAME.replaceAll('/', '-')
61+
def dockerTag = env.BRANCH_NAME.replaceAll('/', '-')
6262

63-
// echo 'Building docker tag: ' + dockerTag
64-
// env.DOCKER_TAG = dockerTag
63+
echo 'Building docker tag: ' + dockerTag
64+
env.DOCKER_TAG = dockerTag
6565

66-
// stage('SonarQube analysis') {
67-
// if (dockerTag == 'next') {
68-
// // requires SonarQube Scanner 2.8+
69-
// def scannerHome = tool 'wicked-sonar';
70-
// withSonarQubeEnv('sonar') {
71-
// sh "${scannerHome}/bin/sonar-scanner"
72-
// }
73-
// } else {
74-
// echo 'Skipping SonarQube, not "next" branch.'
75-
// }
76-
// }
66+
// stage('SonarQube analysis') {
67+
// if (dockerTag == 'next') {
68+
// // requires SonarQube Scanner 2.8+
69+
// def scannerHome = tool 'wicked-sonar';
70+
// withSonarQubeEnv('sonar') {
71+
// sh "${scannerHome}/bin/sonar-scanner"
72+
// }
73+
// } else {
74+
// echo 'Skipping SonarQube, not "next" branch.'
75+
// }
76+
// }
7777

78-
// stage('Build and Push') {
79-
// withCredentials([
80-
// usernamePassword(credentialsId: 'dockerhub_wicked', usernameVariable: 'DOCKER_REGISTRY_USER', passwordVariable: 'DOCKER_REGISTRY_PASSWORD')
81-
// ]) {
78+
stage('Build and Push') {
79+
withCredentials([
80+
usernamePassword(credentialsId: 'dockerhub_wicked', usernameVariable: 'DOCKER_REGISTRY_USER', passwordVariable: 'DOCKER_REGISTRY_PASSWORD')
81+
]) {
8282

83-
// sh './build.sh --push'
83+
sh './build.sh --push'
8484

85-
// }
86-
// }
87-
// }
85+
}
86+
}
87+
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.0-rc.4",
2+
"version": "1.0.0-rc.6",
33
"private": true,
44
"main": "bin/api",
55
"dependencies": {
@@ -27,4 +27,4 @@
2727
"esversion": 6
2828
},
2929
"name": "portal-api"
30-
}
30+
}

routes/applications.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function isValidRedirectUri(redirectUri) {
115115
if (!redirectUri) {
116116
return false;
117117
}
118-
if (typeof(redirectUri) !== 'string') {
118+
if (typeof (redirectUri) !== 'string') {
119119
return false;
120120
}
121121
let url = null;
@@ -130,14 +130,17 @@ function isValidRedirectUri(redirectUri) {
130130
return false;
131131
}
132132

133-
if ((redirectUri.indexOf('#') < 0) &&
134-
(
135-
(redirectUri.startsWith('https://') && (redirectUri !== 'https://')) ||
136-
(redirectUri.startsWith('http://localhost')) ||
137-
(redirectUri.startsWith('http://127.0.0.1')) ||
138-
(redirectUri.startsWith('http://portal.local')) ||
139-
(redirectUri.startsWith('http://') && process.env.NODE_ENV.indexOf('local') >= 0) // Allow unsafe redirects for local development
140-
)
133+
if (process.env.ALLOW_ANY_REDIRECT_URI && process.env.ALLOW_ANY_REDIRECT_URI !== '') {
134+
// https://github.com/Haufe-Lexware/wicked.haufe.io/issues/196
135+
return true;
136+
}
137+
138+
if (
139+
(redirectUri.startsWith('https://') && (redirectUri !== 'https://')) ||
140+
(redirectUri.startsWith('http://localhost')) ||
141+
(redirectUri.startsWith('http://127.0.0.1')) ||
142+
(redirectUri.startsWith('http://portal.local')) ||
143+
(redirectUri.startsWith('http://') && process.env.NODE_ENV.indexOf('local') >= 0) // Allow unsafe redirects for local development
141144
) {
142145
return true;
143146
}

routes/content.js

+1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ content.isPublic = function (uriName) {
180180
return uriName.endsWith('jpg') ||
181181
uriName.endsWith('jpeg') ||
182182
uriName.endsWith('png') ||
183+
uriName.endsWith('js') ||
183184
uriName.endsWith('gif') ||
184185
uriName.endsWith('css');
185186
};

routes/swagger-utils.js

+5
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ function lookupAuthMethod(globalSettings, apiId, authMethodRef) {
287287
warn(`lookupAuthMethodConfig: Auth method ${authMethodRef} is not enabled, skipping.`);
288288
return null;
289289
}
290+
291+
if (authMethodOrig.protected) {
292+
info(`lookupAuthMethodConfig: Auth method ${authMethodRef} is protected, skipping.`);
293+
return null;
294+
}
290295

291296
const authMethod = utils.clone(authMethodOrig);
292297
const endpoints = [

0 commit comments

Comments
 (0)