How to run the SAP Cloud SDK Pipeline on Kubernetes

不羁岁月 提交于 2019-12-13 00:34:49

问题


Currently, I am trying to set up the SAP Cloud SDK on a Kubernetes cluster using the tutorial found here:

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

The setup works fine and I am able to configure and start a pipeline. It also spawns and connects successfully to a new POD running as an agent. However, during the mvn clean install step, a container execution is done on the POD, but this for some unkown reason fails.

I followed the troubleshooting hints in the tutorial, especially checking the connectivity with the Kubernetes cluster via the test Jenkinsfile, but that runs through successfully and does not seem to be the problem. I also tried to check the logs of the container-exec container on the POD, but nothing is returned (for the jnlp container I get the log showing the successful connection).

In the build pipeline the following log statements are given:

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 ---

I know the feature is marked as experimental in the blog entry, but I was able to successfully set up such a scenario some months back, so someting seems to have changed. Is this still a valid scenario to operate the pipeline? Any hints on how to proceed and make this work would be really appreciated!


回答1:


The provided change in the comments did the trick. A simple change of the pipeline_config.yaml to use a different image:

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

Afterwards everything ran through just fine.



来源:https://stackoverflow.com/questions/56963559/how-to-run-the-sap-cloud-sdk-pipeline-on-kubernetes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!