目前,我正在尝试使用此处找到的教程在 Kubernetes 集群上设置 SAP Cloud SDK:
设置工作正常,我能够配置和启动管道。它还会生成并成功连接到作为代理运行的新 POD。但是,在 mvn clean install 步骤中,容器执行在 POD 上完成,但由于某些未知原因而失败。
我按照教程中的故障排除提示进行操作,特别是通过测试 Jenkinsfile 检查与 Kubernetes 集群的连接性,但是运行成功并且似乎不是问题。我还尝试检查 POD 上 container-exec 容器的日志,但没有返回任何内容(对于 jnlp 容器,我得到的日志显示连接成功)。
在构建管道中,给出了以下日志语句:
16:44:02 --- Begin library step of: dockerExecute ---
expected to call com.sap.piper.analytics.Telemetry$_getInstance_closure1.call but wound up catching com.sap.piper.analytics.Telemetry.piperOsDefaultReporting; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
[Pipeline] timeout
16:44:02 Timeout set to expire in 10 sec
[Pipeline] {
[Pipeline] httpRequest
[Pipeline] }
[Pipeline] // timeout
[Pipeline] echo
16:44:02 --- Begin library step of: dockerExecuteOnKubernetes ---
expected to call com.sap.piper.analytics.Telemetry$_getInstance_closure1.call but wound up catching com.sap.piper.analytics.Telemetry.piperOsDefaultReporting; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/
[Pipeline] timeout
16:44:02 Timeout set to expire in 10 sec
[Pipeline] {
[Pipeline] httpRequest
[Pipeline] }
[Pipeline] // timeout
[Pipeline] stash
16:44:05 Stashed 115 file(s)
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
16:44:20 Still waiting to schedule task
16:44:20 ‘dynamic-agent-7eb57391-be34-4e11-b2e7-e4c3c79e8da1-3lnfp-lwv8q’ is offline
16:44:26 Agent dynamic-agent-7eb57391-be34-4e11-b2e7-e4c3c79e8da1-3lnfp-lwv8q is provisioned from template Kubernetes Pod Template
16:44:26 Agent specification [Kubernetes Pod Template] (7eb57391-be34-4e11-b2e7-e4c3c79e8da1):
16:44:26 yaml:
16:44:26 {
16:44:26 "apiVersion": "v1",
16:44:26 "kind": "Pod",
16:44:26 "metadata": {
16:44:26 "lables": "7eb57391-be34-4e11-b2e7-e4c3c79e8da1"
16:44:26 },
16:44:26 "spec": {
16:44:26 "containers": [
16:44:26 {
16:44:26 "name": "jnlp",
16:44:26 "image": "s4sdk/jenkins-agent-k8s:latest"
16:44:26 },
16:44:26 {
16:44:26 "name": "container-exec",
16:44:26 "image": "maven:3.5-jdk-8-alpine",
16:44:26 "imagePullPolicy": "IfNotPresent",
16:44:26 "env": [
16:44:26
16:44:26 ],
16:44:26 "command": [
16:44:26 "/usr/bin/tail",
16:44:26 "-f",
16:44:26 "/dev/null"
16:44:26 ]
16:44:26 }
16:44:26 ],
16:44:26 "securityContext": {
16:44:26
16:44:26 }
16:44:26 }
16:44:26 }
16:44:26
16:44:27 Running on dynamic-agent-7eb57391-be34-4e11-b2e7-e4c3c79e8da1-3lnfp-lwv8q in /home/piper/workspace/address-manager_master
[Pipeline] {
[Pipeline] echo
16:44:27 ContainerConfig: [name:container-exec]
[Pipeline] container
[Pipeline] {
[Pipeline] echo
16:44:27 Unstash content: workspace-7eb57391-be34-4e11-b2e7-e4c3c79e8da1
[Pipeline] unstash
[Pipeline] echo
16:44:31 [INFO][dockerExecute] Executing inside a Kubernetes Pod
[Pipeline] sh
16:49:39 process apparently never started in /home/piper/workspace/address-manager_master@tmp/durable-bc02ec77
16:49:39 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] sh
16:54:47 process apparently never started in /home/piper/workspace/address-manager_master@tmp/durable-1f05b1bc
16:54:47 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] echo
16:54:47 script returned exit code -2
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] unstash
[Pipeline] echo
16:54:48 No such saved stash ‘container-7eb57391-be34-4e11-b2e7-e4c3c79e8da1’
[Pipeline] libraryResource
[Pipeline] echo
16:54:48 ----------------------------------------------------------
16:54:48 --- An error occurred in the library step: dockerExecuteOnKubernetes
16:54:48 ----------------------------------------------------------
16:54:48
16:54:48 The following parameters were available to the step:
16:54:48 ***
16:54:48 [script:Script1@1f99bbb0, dockerImage:maven:3.5-jdk-8-alpine, dockerPullImage:true, stashContent:[]]
16:54:48 ***
16:54:48
16:54:48 The error was:
16:54:48 ***
16:54:48 hudson.AbortException: script returned exit code -2
16:54:48 ***
16:54:48
16:54:48 Further information:
16:54:48 * Documentation of library step dockerExecuteOnKubernetes: https://sap.github.io/jenkins-library/steps/dockerExecuteOnKubernetes/
16:54:48 * Source code of library step dockerExecuteOnKubernetes: https://github.com/SAP/jenkins-library/blob/master/vars/dockerExecuteOnKubernetes.groovy
16:54:48 * Library documentation: https://sap.github.io/jenkins-library/
16:54:48 * Library repository: https://github.com/SAP/jenkins-library/
16:54:48
16:54:48 ----------------------------------------------------------
16:54:48 --- End library step of: dockerExecuteOnKubernetes ---
我知道该功能在博客条目中被标记为实验性的,但几个月前我能够成功设置这样的场景,所以有些东西似乎已经改变了。这仍然是运营管道的有效方案吗?任何有关如何进行和完成这项工作的提示将不胜感激!