Category : jenkins-declarative-pipeline

I would like to use Jenkins docker.Image.run() to run GitVersion. From a bash shell, if I run docker run –rm -v "$(pwd):/repo" gittools/gitversion:5.6.6 /repo …a JSON-format string gets sent to stdout. I’d like my Jenkinsfile to consume this stdout. I know that I can run this docker container from my Jenkinsfile as follows: pipeline { ..

Read more

In a Jenkinsfile using declarative syntax, I need a Docker agent to be able to talk to previously created MySQL Docker container. The first docker container is a MySQL container with a random port, started with –net jenkins. jenkins is a bridge network. The Docker agent container should also be on the same network, but ..

Read more

I am trying to push docker image to artifactory using jenkins declarative pipeline. Below is my code : stage(‘Push Image to Artifactory’) { steps { script{ def buildInfo = Artifactory.newBuildInfo() def server = Artifactory.newServer url: ‘artifactory.org’, credentialsId: ‘artifactsId’ def rtDocker = Artifactory.docker server: server def tagDockerApp = "artifactory.org/docker-repository/venus:1.0.3" docker.build(tagDockerApp) buildInfo = rtDocker.push(tagDockerApp,’docker-local-repository’,buildInfo) // Publish build ..

Read more

I have a declarative Jenkins pipeline. I am trying to pass Jenkins build parameters like jira_id and repository name along with credentials to the dockerfile as arguments. However, on execution, the dockerfile is not able to receive any arguments as passed below. May I please know the correct way of doing it? Jenkinsfile Stage stage(‘Create ..

Read more

I’d like to run govc commands in a Jenkins pipeline. Running the govc container manually works: docker pull vmware/govc && docker run -e GOVC_USERNAME=$GOVC_USERNAME -e GOVC_PASSWORD=$GOVC_PASSWORD -e GOVC_INSECURE=$GOVC_INSECURE vmware/govc find -u=$GOVC_URL / -type m For some reason the short environment variable passing version (-e ENV_VAR) doesn’t work with this image and I must enter GOVC_URL ..

Read more