Skip to content

Commit 30d69f0

Browse files
committed
Conditional proxy settings via PROXY_ENABLED. Simply generation
1 parent 07a2672 commit 30d69f0

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ private String getContainerFile() {
213213
* altDeploymentDirectory to be used by default.
214214
*/
215215
private String getMavenSetup() {
216-
String result = """
216+
217+
return """
217218
echo "MAVEN_HOME:$MAVEN_HOME"
218219
PATH="${MAVEN_HOME}/bin:$PATH"
219220
@@ -278,14 +279,18 @@ private String getMavenSetup() {
278279
</altDeploymentRepository>
279280
</properties>
280281
</profile>
282+
<profile>
283+
<id>PROXY_ENABLED</id>
284+
<activation>
285+
<activeByDefault>true</activeByDefault>
286+
</activation>
287+
<properties>
288+
<PROXY_ENABLED>false</PROXY_ENABLED>
289+
</properties>
290+
</profile>
281291
</profiles>
282292
283293
<interactiveMode>false</interactiveMode>
284-
""";
285-
286-
// This block is only needed when running outside of JBS
287-
if (isEmpty(System.getenv("jvm-build-service"))) {
288-
result += """
289294
<!--
290295
Needed for Maven 3.9+. Switched to native resolver
291296
https://maven.apache.org/guides/mini/guide-resolver-transport.html
@@ -304,13 +309,12 @@ private String getMavenSetup() {
304309
</configuration>
305310
</server>
306311
</servers>
307-
308312
<proxies>
309313
<proxy>
310314
<id>indy-http</id>
311-
<active>true</active>
315+
<active>${PROXY_ENABLED}</active>
312316
<protocol>http</protocol>
313-
<host>indy-generic-proxy</host>
317+
<host>domain-proxy</host>
314318
<port>80</port>
315319
<!-- <username>build-ADDTW3JAGHYAA+tracking</username> -->
316320
<username>${BUILD_ID}+tracking</username>
@@ -319,19 +323,16 @@ private String getMavenSetup() {
319323
</proxy>
320324
<proxy>
321325
<id>indy-https</id>
322-
<active>true</active>
326+
<active>${PROXY_ENABLED}</active>
323327
<protocol>https</protocol>
324-
<host>indy-generic-proxy</host>
328+
<host>domain-proxy</host>
325329
<port>80</port>
326330
<username>${BUILD_ID}+tracking</username>
327331
<password>${ACCESS_TOKEN}</password>
328332
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
329333
</proxy>
330334
</proxies>
331-
""";
332-
}
333335
334-
result += """
335336
</settings>
336337
EOF
337338
@@ -368,8 +369,6 @@ private String getMavenSetup() {
368369
</toolchains>
369370
EOF
370371
""".formatted(javaVersion);
371-
372-
return result;
373372
}
374373

375374

0 commit comments

Comments
 (0)