Skip to content

Commit c835240

Browse files
committed
Merge branch 'release/1.0.1'
2 parents ff3f75a + 399b3e8 commit c835240

File tree

6 files changed

+49
-60
lines changed

6 files changed

+49
-60
lines changed

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pipeline {
33
agent {
44
kubernetes {
55
yamlFile 'kubernetesPod.yaml'
6+
workspaceVolume dynamicPVC(accessModes: 'ReadWriteOnce', requestsSize: '40Gi')
67
}
78
}
89

@@ -20,7 +21,7 @@ pipeline {
2021

2122
configFileProvider([configFile(fileId: 'maven-settings-rsb', variable: 'MAVEN_SETTINGS_RSB')]) {
2223

23-
sh 'mvn -B -s $MAVEN_SETTINGS_RSB -U clean install deploy -DskipTests=true'
24+
sh 'mvn -B -s $MAVEN_SETTINGS_RSB -Dmaven.repo.local=/home/jenkins/agent/m2 -U clean install deploy -DskipTests=true'
2425

2526
}
2627
}

kubernetesPod.yaml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ metadata:
55
labels:
66
ci: containerproxy-build
77
spec:
8-
volumes:
9-
- name: maven-repo
10-
emptyDir: {}
8+
securityContext:
9+
fsGroup: 65534
1110
containers:
12-
- name: containerproxy-build
13-
image: 196229073436.dkr.ecr.eu-west-1.amazonaws.com/openanalytics/containerproxy-build
14-
securityContext:
15-
privileged: true
16-
command: ["sh"]
17-
args: ["/usr/src/app/docker-entrypoint.sh"]
18-
tty: true
19-
volumeMounts:
20-
- mountPath: ~/.m2
21-
name: maven-repo
22-
resources:
23-
requests:
24-
memory: "2Gi"
25-
cpu: "1.0"
26-
limits:
27-
memory: "4Gi"
28-
cpu: "1.5"
11+
- name: containerproxy-build
12+
image: 196229073436.dkr.ecr.eu-west-1.amazonaws.com/openanalytics/containerproxy-build
13+
securityContext:
14+
privileged: true
15+
command: [ "sh" ]
16+
args: [ "/usr/src/app/docker-entrypoint.sh" ]
17+
tty: true
18+
volumeMounts:
19+
- name: workspace-volume
20+
subPath: docker
21+
mountPath: /var/lib/docker
22+
resources:
23+
requests:
24+
ephemeral-storage: "20Gi"
25+
memory: "2Gi"
26+
cpu: "1.0"
27+
limits:
28+
memory: "4Gi"
29+
cpu: "1.5"
30+
ephemeral-storage: "20Gi"

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>eu.openanalytics</groupId>
77
<artifactId>containerproxy</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.0.1</version>
99
<name>ContainerProxy</name>
1010
<packaging>jar</packaging>
1111

src/main/java/eu/openanalytics/containerproxy/auth/impl/SimpleAuthenticationBackend.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*/
2121
package eu.openanalytics.containerproxy.auth.impl;
2222

23+
import java.util.ArrayList;
2324
import java.util.Arrays;
25+
import java.util.List;
2426

2527
import javax.inject.Inject;
2628

@@ -73,13 +75,24 @@ private SimpleUser loadUser(int index) {
7375
String userName = environment.getProperty(String.format("proxy.users[%d].name", index));
7476
if (userName == null) return null;
7577
String password = environment.getProperty(String.format("proxy.users[%d].password", index));
76-
String[] roles = environment.getProperty(String.format("proxy.users[%d].groups", index), String[].class);
77-
if (roles == null) {
78-
roles = new String[0];
78+
79+
// method 1: single property with comma seperated groups
80+
String[] groups = environment.getProperty(String.format("proxy.users[%d].groups", index), String[].class);
81+
if (groups != null) {
82+
groups = Arrays.stream(groups).map(String::toUpperCase).toArray(String[]::new);
83+
return new SimpleUser(userName, password, groups);
7984
} else {
80-
roles = Arrays.stream(roles).map(s -> s.toUpperCase()).toArray(i -> new String[i]);
85+
// method 2: YAML array
86+
List<String> groupsList = new ArrayList<>();
87+
int groupIndex = 0;
88+
String group = environment.getProperty(String.format("proxy.users[%d].groups[%d]", index, groupIndex));
89+
while (group != null) {
90+
groupsList.add(group.toUpperCase());
91+
groupIndex++;
92+
group = environment.getProperty(String.format("proxy.users[%d].groups[%d]", index, groupIndex));
93+
}
94+
return new SimpleUser(userName, password, groupsList.toArray(new String[0]));
8195
}
82-
return new SimpleUser(userName, password, roles);
8396
}
8497

8598
private static class SimpleUser {

src/main/java/eu/openanalytics/containerproxy/spec/expression/SpecExpressionResolver.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
package eu.openanalytics.containerproxy.spec.expression;
2222

23-
import eu.openanalytics.containerproxy.ContainerProxyException;
2423
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
2524
import org.springframework.context.ApplicationContext;
2625
import org.springframework.context.ConfigurableApplicationContext;
@@ -34,9 +33,7 @@
3433
import org.springframework.expression.Expression;
3534
import org.springframework.expression.ExpressionException;
3635
import org.springframework.expression.ExpressionParser;
37-
import org.springframework.expression.ParseException;
3836
import org.springframework.expression.ParserContext;
39-
import org.springframework.expression.spel.SpelEvaluationException;
4037
import org.springframework.expression.spel.standard.SpelExpressionParser;
4138
import org.springframework.expression.spel.support.StandardEvaluationContext;
4239
import org.springframework.expression.spel.support.StandardTypeConverter;
@@ -48,6 +45,7 @@
4845
import java.util.Map;
4946
import java.util.concurrent.ConcurrentHashMap;
5047
import java.util.stream.Collectors;
48+
import java.util.stream.Stream;
5149

5250
/**
5351
* Note: inspired by org.springframework.context.expression.StandardBeanExpressionResolver
@@ -136,11 +134,14 @@ public List<String> evaluateToList(List<String> expressions, SpecExpressionConte
136134
if (expressions == null) return null;
137135
return expressions.stream()
138136
.flatMap((el) -> {
139-
List<String> result = evaluate(el, context, List.class);
137+
Object result = evaluate(el, context, Object.class);
140138
if (result == null) {
141139
result = new ArrayList<>();
142140
}
143-
return result.stream();
141+
if (result instanceof List) {
142+
return ((List<Object>) result).stream().map(Object::toString);
143+
}
144+
return Stream.of(result.toString());
144145
})
145146
.collect(Collectors.toList());
146147
}

src/main/java/eu/openanalytics/containerproxy/util/BadRequestException.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)