How can I trigger another job from a jenkins pipeline (jenkinsfile) with GitHub Org Plugin?

How can I trigger build of another job from inside the Jenkinsfile? I assume that this job is another repository under the same github organization, one that already has its own Jenkins file. I also want to do this only if the branch name is master, as it doesn’t make sense to trigger downstream builds … Read more

Jenkins: Can comments be added to a Jenkinsfile?

Are comments possible in a Jenkinsfile? If so, what’s the syntax? I am using the declarative pipeline syntax. I want to comment out the “post” section below until my SMTP server is working. pipeline { agent { label ‘docker-build-slave’ } environment { IMAGE = ‘registry.gitlab.com/XXXXX/bible-server’ DOCKER_REGISTRY_CREDENTIALS = credentials(‘DOCKER_REGISTRY_CREDENTIALS’) } options { timeout(10) } stages { … Read more

How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

I have something like this on a Jenkinsfile (Groovy) and I want to record the stdout and the exit code in a variable in order to use the information later. sh “ls -l” How can I do this, especially as it seems that you cannot really run any kind of groovy code inside the Jenkinsfile? … Read more

Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins. I configured a new job with below pipeline script. node { stage(‘Build’) { docker.image(‘maven:3.3.3’).inside { sh ‘mvn –version’ } } } But it fails with below error. 33 Answers 33 The user jenkins needs to be added … Read more

Error “The input device is not a TTY”

I am running the following command from my Jenkinsfile. However, I get the error “The input device is not a TTY”. docker run -v $PWD:/foobar -it cloudfoundry/cflinuxfs2 /foobar/script.sh Is there a way to run the script from the Jenkinsfile without doing interactive mode? I basically have a file called script.sh that I would like to … Read more