1

got some questions running SAP Project Piper on Kubernetes. We did the setup like described in

https://sap.github.io/jenkins-library/guidedtour/

I assumed that a build will run "out-of-the-box"... but it isn't. Invoking a mtaBuild results in a message ... Cannot connect to docker daemon ... permission denied

Not sure if we have to set env variable ON_K8S. If we set it ... the build is waiting forever for a node to come up.

Is there any setup guide for Kubernetes? Do we have to configure a pod Template in the Jenkins configuration and work with container("container_name") in the Jenkinsfile ?

Is the Jenkins agent https://hub.docker.com/r/ppiper/jenkins-agent-k8s already preconfigured? Do we have to set it over env variable?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
T1mey
  • 13
  • 2

1 Answers1

3

Updated answer:

The cx-server scripts are not made for running in Kubernetes, they are built for a "plain docker" setup (a linux server/vm with docker installed).

For scaling on Kubernetes, two options are available:

Using the jenkins master image in a pod as described in this blog post, or using it in a "plain docker" setup and optionally having additional agents on kubernetes.

Additional documentation on this topic is here

Florian Wilhelm
  • 600
  • 4
  • 17
  • I try to deliver more details. We just setup the ppiper cx-server-companion and configured it. The image runs in kubernetes. Jenkins is coming up without any problems. As in the first link described we setup a first build with a minimal of a Jenkinsfile using "general purpose pipeline". Just checkout, which is working fine and mtaBuild. The mtaBuild is failing. – T1mey Mar 03 '20 at 16:25
  • Does the blog post help? It describes a setup for a different pipeline, but I think it should still be valid for your use case. On the other hand I'm not sure if the general purpose pipeline is built in a way that it supports k8s. Have you tried running something in the dockerExecuteOnKubernetes step manually? does that work? cf https://sap.github.io/jenkins-library/steps/dockerExecuteOnKubernetes/#example-1-run-a-closure-in-a-single-container-pod – Florian Wilhelm Mar 03 '20 at 16:32
  • I will try out and come back to you ... I found no setting in the general purpose pipeline to override the jnlpAgent with 'custom-jenkins-agent-k8s:latest'. Maybe this can be reached by setting env variable as described here: https://sap.github.io/jenkins-library/steps/dockerExecuteOnKubernetes/ – T1mey Mar 03 '20 at 16:41