jenkins从helm图表,不工作jdk配置

qoefvg9y  于 5个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(79)

我通过Helm Chart安装了最新版本的Jenkins。
gitlab和git webhook的集成很好。
尝试gradle build,它faliure与jdk问题.
安装adoptium jdk17 jenkins pod和jenkins configure


的数据
也默认jdk17.和adoptium jdk路径是正确的.

而jenkins item jdk configure是default jdk。



下面是jenkins build console的输出,java版本是jdk11,但是java home默认是jdk17。



整个控制台输出以下。

Running as SYSTEM
Agent default-1sxpg is provisioned from template default
---
apiVersion: "v1"
kind: "Pod"
metadata:
  labels:
    jenkins/jenkins-jenkins-agent: "true"
    jenkins/label-digest: "500b4f18aee87616849e4f4c2435020898e34aa0"
    jenkins/label: "jenkins-jenkins-agent"
  name: "default-1sxpg"
  namespace: "jenkins"
spec:
  containers:
  - args:
    - "********"
    - "default-1sxpg"
    env:
    - name: "JENKINS_SECRET"
      value: "********"
    - name: "JENKINS_TUNNEL"
      value: "jenkins-agent.jenkins.svc.cluster.local:50000"
    - name: "JENKINS_AGENT_NAME"
      value: "default-1sxpg"
    - name: "JENKINS_NAME"
      value: "default-1sxpg"
    - name: "JENKINS_AGENT_WORKDIR"
      value: "/home/jenkins/agent"
    - name: "JENKINS_URL"
      value: "http://jenkins.jenkins.svc.cluster.local:80/"
    image: "jenkins/inbound-agent:3107.v665000b_51092-15"
    imagePullPolicy: "IfNotPresent"
    name: "jnlp"
    resources:
      limits:
        memory: "512Mi"
        cpu: "512m"
      requests:
        memory: "512Mi"
        cpu: "512m"
    tty: false
    volumeMounts:
    - mountPath: "/home/jenkins/agent"
      name: "workspace-volume"
      readOnly: false
    workingDir: "/home/jenkins/agent"
  nodeSelector:
    kubernetes.io/os: "linux"
  restartPolicy: "Never"
  serviceAccountName: "default"
  volumes:
  - emptyDir:
      medium: ""
    name: "workspace-volume"

Building remotely on default-1sxpg (jenkins-jenkins-agent) in workspace /home/jenkins/agent/workspace/USER TEST
The recommended git tool is: NONE
using credential jenkins_gitlab_userid
Cloning the remote Git repository
Cloning repository http://gitlab.em2study.com/em2/user.git
 > git init /home/jenkins/agent/workspace/USER TEST # timeout=10
Fetching upstream changes from http://gitlab.em2study.com/em2/user.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials jenkins gitlab userid
 > git fetch --tags --force --progress -- http://gitlab.em2study.com/em2/user.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url http://gitlab.em2study.com/em2/user.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision 953356eb86a78f8258a8cb8a7484511222107e3f (refs/remotes/origin/main)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 953356eb86a78f8258a8cb8a7484511222107e3f # timeout=10
Commit message: "123"
 > git rev-list --no-walk 953356eb86a78f8258a8cb8a7484511222107e3f # timeout=10
[USER TEST] $ /bin/sh -xe /tmp/jenkins6040822211157154585.sh
+ java --version
openjdk 11.0.19 2023-04-18
OpenJDK Runtime Environment Temurin-11.0.19+7 (build 11.0.19+7)
OpenJDK 64-Bit Server VM Temurin-11.0.19+7 (build 11.0.19+7, mixed mode)
+ echo /opt/java/openjdk
/opt/java/openjdk
[Gradle] - Launching build.
Unpacking https://services.gradle.org/distributions/gradle-8.5-bin.zip to /home/jenkins/agent/tools/hudson.plugins.gradle.GradleInstallation/gradle_gitlab on default-1sxpg
[USER TEST] $ /home/jenkins/agent/tools/hudson.plugins.gradle.GradleInstallation/gradle_gitlab/bin/gradle clean build

Welcome to Gradle 8.5!

Here are the highlights of this release:
 - Support for running on Java 21
 - Faster first use with Kotlin DSL
 - Improved error and warning messages

For more details see https://docs.gradle.org/8.5/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'user'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.4.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.4
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.4 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 47s
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE```

字符串

nwo49xxi

nwo49xxi1#

这是如此简单的情况下.只是 Helm 值.yaml添加此选项

agent:
  image: "jenkins/inbound-agent"
  tag: "3107.v665000b_51092-15-jdk17"

字符串

相关问题