jenkins-pipeline

Jenkins pipeline docker agent - docker run error - Failed to run image - java.io.IOException

强颜欢笑 提交于 2020-01-25 04:00:07
问题 I have tried used jenkins with docker, both are installed on my machine (w10) and I run docker images with jenkins. But when i followed the example in the jenkins documentation (example from doc) it didn't work. Different pipeline scripts worked when not involving the agent { docker ... } , I also tried adding the docker plugin from the jenkins config interface. pipeline script // Jenkinsfile (Declarative Pipeline) pipeline { agent { docker { image 'maven:3.3.3' } } stages { stage('build') {

Jenkins groovy - How to retrieve tag from latest commit?

半城伤御伤魂 提交于 2020-01-24 13:15:31
问题 To fetch the latest commit from branchName , we run below code: treeMapData = git(branch: branchName, credentialsId: credential, url: "${gitLabServer}/${projectName}/${repo}.git") It is ensured that there is one tag per commit, as per our workflow We want to build the code, only if the commit is tagged. How to retrieve the tag name for that latest commit? 回答1: We can fetch the tags from the repo in case Jenkins hasn't already. git fetch --tags We need to find a tag(s) which point to a

Unable to install suggested plugins of jenkins on docker

眉间皱痕 提交于 2020-01-24 09:32:16
问题 I had launched jenkins through docker, it has been launched in administrator mode. After entering password when i selected to install suggested plugin it fails with most of the installation. Post that when i created jenkins user and navigated to jenkins home page it displays errors as shown in below screenshot. Installed docker and jenkins through below commands sudo yum install docker-ce systemctl start docker docker pull Jenkins docker run -p 8080:8080 jenkins Also when i go to manage

Unable to install suggested plugins of jenkins on docker

三世轮回 提交于 2020-01-24 09:32:06
问题 I had launched jenkins through docker, it has been launched in administrator mode. After entering password when i selected to install suggested plugin it fails with most of the installation. Post that when i created jenkins user and navigated to jenkins home page it displays errors as shown in below screenshot. Installed docker and jenkins through below commands sudo yum install docker-ce systemctl start docker docker pull Jenkins docker run -p 8080:8080 jenkins Also when i go to manage

Jenkins pipeline pass all parameters down to downstream jobs

放肆的年华 提交于 2020-01-24 02:23:38
问题 I have a pipeline job named buildall which looks like this: pipeline { stages { stage("job1") { build job: "job1" } } } The buildall job has 25 parameters. I would like to pass all of buildall 's parameters down to job1 . Is there an easy way I can do that, instead of manually specifying each parameter? In this question: Pipeline pass parameters to downstream jobs a sub-question was asked but never answered: Or even better, is there a less cumbersome way in which I can just pass ALL the

Jenkins pipeline pass all parameters down to downstream jobs

帅比萌擦擦* 提交于 2020-01-24 02:22:09
问题 I have a pipeline job named buildall which looks like this: pipeline { stages { stage("job1") { build job: "job1" } } } The buildall job has 25 parameters. I would like to pass all of buildall 's parameters down to job1 . Is there an easy way I can do that, instead of manually specifying each parameter? In this question: Pipeline pass parameters to downstream jobs a sub-question was asked but never answered: Or even better, is there a less cumbersome way in which I can just pass ALL the

Jenkins pipeline: how to trigger another job and wait for it without using an extra agent/executor

情到浓时终转凉″ 提交于 2020-01-23 17:00:26
问题 I am trying to setup various Jenkins pipelines whose last stage is always to run some acceptance tests. To cut a long story short, acceptance tests and test data (much of which is shared) for all products are checked into the same repository which is about 0.5 GB in size. It therefore seemed best to have a separate job for the acceptance tests and trigger it with a "build" step from each pipeline with the appropriate arguments to run the relevant tests. (It is also sometimes useful to rerun

Jenkins pipeline: how to trigger another job and wait for it without using an extra agent/executor

懵懂的女人 提交于 2020-01-23 16:59:25
问题 I am trying to setup various Jenkins pipelines whose last stage is always to run some acceptance tests. To cut a long story short, acceptance tests and test data (much of which is shared) for all products are checked into the same repository which is about 0.5 GB in size. It therefore seemed best to have a separate job for the acceptance tests and trigger it with a "build" step from each pipeline with the appropriate arguments to run the relevant tests. (It is also sometimes useful to rerun

Multiconfiguration / matrix build pipeline in Jenkins

帅比萌擦擦* 提交于 2020-01-23 06:16:20
问题 What is modern best practice for multi-configuration builds (with Jenkins)? I want to support multiple branches and multiple configurations. For example for each version V1, V2 of the software I want builds targeting platforms P1 and P2. We have managed to set up multi-branch declarative pipelines. Each build has its own docker so its easy to support multiple platforms. pipeline { agent none stages { stage('Build, test and deploy for P1) { agent { dockerfile { filename 'src/main/docker

How catch curl response into variable in Jenkinsfile

↘锁芯ラ 提交于 2020-01-23 05:55:34
问题 I want to curl an URL and capture the response into a variable. when I curl a command and echo its output I get the correct response as below sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;' I want to catch the same response into a variable and use that response for further operation Below is my Jenkinsfile pipeline { agent { label "build_2" } stages { stage('Build') { steps { checkout scm sh 'npm install' } } stage('Build-Image') { steps { echo '.........