How do I use containers that run with one command and then exit with the Jenkins Kubernetes Plugin?

10/24/2019

I'm using a setup with Jenkins setup in Kubernetes, plugin included (via the official helm chart) and I'm trying to use containers that run once with a command and then exit. Specifically: https://hub.docker.com/r/gophernet/traceroute

The pods do not spin up correctly, though and just keep creating and deleting themselves— the build never finishes or fails.

How can I use images like this?

I have tried changing the command and sh'ing in but nothing changes.

podTemplate(containers: [
    containerTemplate(name: 'traceroute', image: 'gophernet/traceroute', ttyEnabled: true, command: "example.com"),
    ]) {

    node(POD_LABEL) {
        container('traceroute') {}
    }
}

Ideally I should be able to call it somewhere in a pipeline.

-- superNES64
containers
docker
jenkins
kubernetes-jenkins-plugin
kubernetes-pod

0 Answers