Skip to content

Commit cdc8b73

Browse files
authored
Merge pull request #2250 from rnc/TOKEN
Renaming for ACCESS_TOKEN
2 parents 4dd1abf + dec502d commit cdc8b73

File tree

4 files changed

+31
-42
lines changed

4 files changed

+31
-42
lines changed

deploy/tasks/maven-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ spec:
2828
- name: MVN_PASSWORD
2929
description: Name of the secret holding the Maven repository password
3030
type: string
31+
- name: ACCESS_TOKEN
32+
description: Access token for OAuth.
33+
type: string
34+
default: ""
3135
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
3236
description: Name of the processor image. Useful to override for development.
3337
type: string
@@ -71,6 +75,8 @@ spec:
7175
secretKeyRef:
7276
name: $(params.MVN_PASSWORD)
7377
key: mavenpassword
78+
- name: ACCESS_TOKEN
79+
value: $(params.ACCESS_TOKEN)
7480
args:
7581
- deploy
7682
- --directory=/var/workdir/deployment

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

Lines changed: 15 additions & 25 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
@@ -243,9 +244,6 @@ private String getMavenSetup() {
243244
<profiles>
244245
<profile>
245246
<id>secondary</id>
246-
<activation>
247-
<activeByDefault>true</activeByDefault>
248-
</activation>
249247
<repositories>
250248
<repository>
251249
<id>artifacts</id>
@@ -269,9 +267,6 @@ private String getMavenSetup() {
269267
</profile>
270268
<profile>
271269
<id>local-deployment</id>
272-
<activation>
273-
<activeByDefault>true</activeByDefault>
274-
</activation>
275270
<properties>
276271
<altDeploymentRepository>
277272
local::file://${JBS_WORKDIR}/artifacts
@@ -280,12 +275,12 @@ private String getMavenSetup() {
280275
</profile>
281276
</profiles>
282277
283-
<interactiveMode>false</interactiveMode>
284-
""";
278+
<activeProfiles>
279+
<activeProfile>secondary</activeProfile>
280+
<activeProfile>local-deployment</activeProfile>
281+
</activeProfiles>
285282
286-
// This block is only needed when running outside of JBS
287-
if (isEmpty(System.getenv("jvm-build-service"))) {
288-
result += """
283+
<interactiveMode>false</interactiveMode>
289284
<!--
290285
Needed for Maven 3.9+. Switched to native resolver
291286
https://maven.apache.org/guides/mini/guide-resolver-transport.html
@@ -298,40 +293,37 @@ private String getMavenSetup() {
298293
<httpHeaders>
299294
<property>
300295
<name>Authorization</name>
301-
<value>Bearer ${accessToken}</value>
296+
<value>Bearer ${ACCESS_TOKEN}</value>
302297
</property>
303298
</httpHeaders>
304299
</configuration>
305300
</server>
306301
</servers>
307-
308302
<proxies>
309303
<proxy>
310304
<id>indy-http</id>
311-
<active>true</active>
305+
<!-- TODO: Until domain-proxy is implemented disable this - probably needs conditional activation but settings profiles don't support interpolation -->
306+
<active>false</active>
312307
<protocol>http</protocol>
313-
<host>indy-generic-proxy</host>
308+
<host>domain-proxy</host>
314309
<port>80</port>
315310
<!-- <username>build-ADDTW3JAGHYAA+tracking</username> -->
316311
<username>${BUILD_ID}+tracking</username>
317-
<password>${MVN_TOKEN}</password>
312+
<password>${ACCESS_TOKEN}</password>
318313
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
319314
</proxy>
320315
<proxy>
321316
<id>indy-https</id>
322-
<active>true</active>
317+
<active>false</active>
323318
<protocol>https</protocol>
324-
<host>indy-generic-proxy</host>
319+
<host>domain-proxy</host>
325320
<port>80</port>
326321
<username>${BUILD_ID}+tracking</username>
327-
<password>${MVN_TOKEN}</password>
322+
<password>${ACCESS_TOKEN}</password>
328323
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
329324
</proxy>
330325
</proxies>
331-
""";
332-
}
333326
334-
result += """
335327
</settings>
336328
EOF
337329
@@ -368,8 +360,6 @@ private String getMavenSetup() {
368360
</toolchains>
369361
EOF
370362
""".formatted(javaVersion);
371-
372-
return result;
373363
}
374364

375365

pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ const (
4949
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
5050
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
5151
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml"
52-
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
52+
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/TOKEN/deploy/tasks/maven-deployment.yaml"
5353
)

pkg/reconciler/dependencybuild/dependencybuild.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -611,24 +611,17 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
611611
},
612612
}},
613613
}
614-
// Setting a default environment variable to represent being run inside the operator
615-
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
616-
PodTemplate: &pod.Template{
617-
Env: []v1.EnvVar{
618-
{
619-
Name: util.ControllerNamespace,
620-
Value: util.ControllerDeploymentName,
621-
},
622-
},
623-
},
624-
}
625614
if orasOptions != "" {
626-
pr.Spec.TaskRunTemplate.PodTemplate.Env = append([]v1.EnvVar{
627-
{
628-
Name: "ORAS_OPTIONS",
629-
Value: orasOptions,
615+
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
616+
PodTemplate: &pod.Template{
617+
Env: []v1.EnvVar{
618+
{
619+
Name: "ORAS_OPTIONS",
620+
Value: orasOptions,
621+
},
622+
},
630623
},
631-
}, pr.Spec.TaskRunTemplate.PodTemplate.Env...)
624+
}
632625
}
633626

634627
if jbsConfig.Annotations != nil && jbsConfig.Annotations[jbsconfig.CITests] == "true" {

0 commit comments

Comments
 (0)