如何在Kubernetes上运行SAP Cloud SDK管道

时间:2019-07-10 04:47:41

标签: sap-cloud-sdk

当前,我正在尝试使用位于此处的教程在Kubernetes集群上设置SAP Cloud SDK:

https://blogs.sap.com/2018/09/26/autoscaling-of-sap-s4hana-cloud-sdk-continuous-delivery-toolkit-on-kubernetes/

设置正常,我能够配置和启动管道。它还生成并成功连接到作为代理运行的新POD。但是,在mvn全新安装步骤中,将在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 ---

我知道此功能在博客条目中被标记为试验性的,但是几个月前我能够成功设置这种情况,因此某些情况似乎已经改变。这仍然是运行管道的有效方案吗?任何有关如何进行和进行这项工作的提示将不胜感激!

1 个答案:

答案 0 :(得分:1)

注释中提供的更改可以解决问题。简单更改pipeline_config.yaml以使用其他图像:

https://github.com/SAP/cloud-s4-sdk-book/blob/K8S/pipeline_config.yml#L5

然后一切都顺利了。