Skip to content

Commit

Permalink
Merge pull request #2250 from rnc/TOKEN
Browse files Browse the repository at this point in the history
Renaming for ACCESS_TOKEN
  • Loading branch information
rnc authored Oct 30, 2024
2 parents 4dd1abf + dec502d commit cdc8b73
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 42 deletions.
6 changes: 6 additions & 0 deletions deploy/tasks/maven-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ spec:
- name: MVN_PASSWORD
description: Name of the secret holding the Maven repository password
type: string
- name: ACCESS_TOKEN
description: Access token for OAuth.
type: string
default: ""
- name: JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE
description: Name of the processor image. Useful to override for development.
type: string
Expand Down Expand Up @@ -71,6 +75,8 @@ spec:
secretKeyRef:
name: $(params.MVN_PASSWORD)
key: mavenpassword
- name: ACCESS_TOKEN
value: $(params.ACCESS_TOKEN)
args:
- deploy
- --directory=/var/workdir/deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ private String getContainerFile() {
* altDeploymentDirectory to be used by default.
*/
private String getMavenSetup() {
String result = """

return """
echo "MAVEN_HOME:$MAVEN_HOME"
PATH="${MAVEN_HOME}/bin:$PATH"
Expand Down Expand Up @@ -243,9 +244,6 @@ private String getMavenSetup() {
<profiles>
<profile>
<id>secondary</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>artifacts</id>
Expand All @@ -269,9 +267,6 @@ private String getMavenSetup() {
</profile>
<profile>
<id>local-deployment</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<altDeploymentRepository>
local::file://${JBS_WORKDIR}/artifacts
Expand All @@ -280,12 +275,12 @@ private String getMavenSetup() {
</profile>
</profiles>
<interactiveMode>false</interactiveMode>
""";
<activeProfiles>
<activeProfile>secondary</activeProfile>
<activeProfile>local-deployment</activeProfile>
</activeProfiles>
// This block is only needed when running outside of JBS
if (isEmpty(System.getenv("jvm-build-service"))) {
result += """
<interactiveMode>false</interactiveMode>
<!--
Needed for Maven 3.9+. Switched to native resolver
https://maven.apache.org/guides/mini/guide-resolver-transport.html
Expand All @@ -298,40 +293,37 @@ private String getMavenSetup() {
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${accessToken}</value>
<value>Bearer ${ACCESS_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<proxies>
<proxy>
<id>indy-http</id>
<active>true</active>
<!-- TODO: Until domain-proxy is implemented disable this - probably needs conditional activation but settings profiles don't support interpolation -->
<active>false</active>
<protocol>http</protocol>
<host>indy-generic-proxy</host>
<host>domain-proxy</host>
<port>80</port>
<!-- <username>build-ADDTW3JAGHYAA+tracking</username> -->
<username>${BUILD_ID}+tracking</username>
<password>${MVN_TOKEN}</password>
<password>${ACCESS_TOKEN}</password>
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
</proxy>
<proxy>
<id>indy-https</id>
<active>true</active>
<active>false</active>
<protocol>https</protocol>
<host>indy-generic-proxy</host>
<host>domain-proxy</host>
<port>80</port>
<username>${BUILD_ID}+tracking</username>
<password>${MVN_TOKEN}</password>
<password>${ACCESS_TOKEN}</password>
<nonProxyHosts>${PROXY_URL}|localhost</nonProxyHosts>
</proxy>
</proxies>
""";
}
result += """
</settings>
EOF
Expand Down Expand Up @@ -368,8 +360,6 @@ private String getMavenSetup() {
</toolchains>
EOF
""".formatted(javaVersion);

return result;
}


Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ const (
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/TOKEN/deploy/tasks/maven-deployment.yaml"
)
25 changes: 9 additions & 16 deletions pkg/reconciler/dependencybuild/dependencybuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,24 +611,17 @@ func (r *ReconcileDependencyBuild) handleStateBuilding(ctx context.Context, db *
},
}},
}
// Setting a default environment variable to represent being run inside the operator
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
PodTemplate: &pod.Template{
Env: []v1.EnvVar{
{
Name: util.ControllerNamespace,
Value: util.ControllerDeploymentName,
},
},
},
}
if orasOptions != "" {
pr.Spec.TaskRunTemplate.PodTemplate.Env = append([]v1.EnvVar{
{
Name: "ORAS_OPTIONS",
Value: orasOptions,
pr.Spec.TaskRunTemplate = tektonpipeline.PipelineTaskRunTemplate{
PodTemplate: &pod.Template{
Env: []v1.EnvVar{
{
Name: "ORAS_OPTIONS",
Value: orasOptions,
},
},
},
}, pr.Spec.TaskRunTemplate.PodTemplate.Env...)
}
}

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

0 comments on commit cdc8b73

Please sign in to comment.