Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming for ACCESS_TOKEN #2250

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
},
}},
}
// 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,
},
},

Check warning on line 622 in pkg/reconciler/dependencybuild/dependencybuild.go

View check run for this annotation

Codecov / codecov/patch

pkg/reconciler/dependencybuild/dependencybuild.go#L615-L622

Added lines #L615 - L622 were not covered by tests
},
}, pr.Spec.TaskRunTemplate.PodTemplate.Env...)
}

Check warning on line 624 in pkg/reconciler/dependencybuild/dependencybuild.go

View check run for this annotation

Codecov / codecov/patch

pkg/reconciler/dependencybuild/dependencybuild.go#L624

Added line #L624 was not covered by tests
}

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