jenkins-pipeline

How to pass credentials for jenkins to push a docker image to my own registry?

痞子三分冷 提交于 2020-01-16 06:05:54
问题 JHipster now uses the maven-jib-plugin. Before that, my jenkins server running in a docker-container was able to build a docker image with the *.war-file and push it to my own docker-registry with a pipeline using a 'Jenkinsfile' (for gradle, but I switched to Maven now), and after job completion another job pulled the newly build docker-image into a new docker-container on my server by executing shell scripts on the remote host using ssh. The stages for this task were: def dockerImage stage(

Groovy @Delegate class annotations are not supported in the pipeline shared library jenkins

喜欢而已 提交于 2020-01-16 05:21:25
问题 jenkins ver. 2.89.4 workflow-cps ver 2.42 When i try to run a pipeline that loads the library, i get the following exception: Unsupported expression for CPS transformation @ line -1, column -1 The Groovy class to which the link is referenced: final class Bindings implements Serializable{ @Delegate private final Map map Bindings(Map map) { this.map = map } @Override boolean containsKey(Object key) { return true } @Override Object get(Object key) { return map.getOrDefault(key, null) } } You can

Missing required property 'OutputPath' for project type 'PackageReference'

南笙酒味 提交于 2020-01-16 04:28:05
问题 I'm trying to run the following command thru Jenkins Pipeline bat 'nuget restore mySolution.sln -MSBuildPath "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin"' but i'm getting error saying Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'. Input files: C:\Program Files (x86)\Jenkins\workspace\My Project Build Pipeline\myProject\myProject.csproj. I tried bat label: '', script: '"C:\\Package tools\\nuget.exe" restore "C:\\Program Files (x86)\\Jenkins\

How to build a Jenkins job from pipeline ignoring if the job doesn't exist?

走远了吗. 提交于 2020-01-16 04:02:07
问题 I'm trying to build a job from my Jenkins pipeline like this: build job:"${jobName}", propagate:false, wait:false Here ${jobName} is a multi branch pipeline job and as such may sometimes not exist in my workflow. This step marks my build as failed if the job doesn't exist. Is there a way to simply ignore and move on if the job doesn't exist? I tried to check whether the given job exist or not like this: if(jenkins.model.Jenkins.instance.getItem("${jobName}") != null) { println("Preparing to

Jenkins Pipeline Get Current Stage Status After Using catchError

烂漫一生 提交于 2020-01-16 01:17:11
问题 This is a follow-up to my earlier question: Set a stage status in Jenkins Pipelines It turns out I can keep a pipeline as SUCCESS but can mark an individual stage as UNSTABLE if I want via catchError like this: node() { stage("Stage 1") { catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { sh 'exit 1' } } } If I want to get the current status of the pipeline itself, I can use currentBuild.getCurrentResult() but I don't see a currentStage analog to this. I'm interested in trying out

Isolate the name of a repository branch in Jenkinsfile

好久不见. 提交于 2020-01-15 17:42:55
问题 What specific changes need to be made to the Jenkinsfile below in order to isolate the name of the branch of the commit into a variable that can be printed out in the logs? In the case below, the name of the branch is GWS-43-getissueforcommit . Here are the specifics: Jenkinsfile: The following Jenkinsfile prints out the branch name in the midst of the output produced by running the checkout(scm).GIT_ASKPASS command, but this information is lost when the subsequent line of code ( sh "echo

Isolate the name of a repository branch in Jenkinsfile

安稳与你 提交于 2020-01-15 17:40:29
问题 What specific changes need to be made to the Jenkinsfile below in order to isolate the name of the branch of the commit into a variable that can be printed out in the logs? In the case below, the name of the branch is GWS-43-getissueforcommit . Here are the specifics: Jenkinsfile: The following Jenkinsfile prints out the branch name in the midst of the output produced by running the checkout(scm).GIT_ASKPASS command, but this information is lost when the subsequent line of code ( sh "echo

Isolate the name of a repository branch in Jenkinsfile

情到浓时终转凉″ 提交于 2020-01-15 17:39:17
问题 What specific changes need to be made to the Jenkinsfile below in order to isolate the name of the branch of the commit into a variable that can be printed out in the logs? In the case below, the name of the branch is GWS-43-getissueforcommit . Here are the specifics: Jenkinsfile: The following Jenkinsfile prints out the branch name in the midst of the output produced by running the checkout(scm).GIT_ASKPASS command, but this information is lost when the subsequent line of code ( sh "echo

Execute Jenkins Pipeline from inside DSL

让人想犯罪 __ 提交于 2020-01-15 11:35:28
问题 I do have a pipeline, p1, configured with 3 parameters, param1 as ChoiceParam, and param2 and param3 as runParameters, that retrieve different build-ids to pass them as versions. I do also have annother pipeline, p2, from which i'd like to run p1. p2 does also have the same parameters configured, so, inside the dsl, i need to call p1 with params1,params2,params3 , as params should be inherited in p2 But i'm unable, as i've tried any single way i can think of. Can anyone help me ? p2: build()

Triggers on specific stage Jenkins Pipeline

試著忘記壹切 提交于 2020-01-15 09:43:14
问题 I'm using Jenkins since a little moment now, but I wanted to do something and I can't find how to do it... In deed, I want to trigger my projects with two differents way: every 4 hours and for every commit. But for each case, I don't want that all my Jenkinsfile is executed, only some specific stages. Is it possible to do that with Declarative Pipelines ? Thanks in advance 回答1: Unfortunately this is not available out of the box yet. Cloudbees has a proprietary plugin called "checkpoints"