i am trying a pipeline job where my first stage job returns a list of values which i should use to make list of parallel jobs in the second stage for each of the value
Hi , I used this following ; my first part itself is not working where i want to save the return values from my first stage and use them in second stage. i tried several methods none worked. my first stage job just echo " 123 234 345" ; i tried setting environment variable also setenv versions="123 234 345" echo $versions // Powered by Infostretch env.BAR=123 timestamps { node ('mem1') { stage ('Team/getactivebranch - Build') { // Shell build step def job = build job: '/Team/getactivebranch/' , parameters: [] env.BAR=321 } def checklog2 = job.rawBuild.log println (checklog2) } } echo "env.BAR is '${BAR}'" // Powered by Infostretch env.BAR=123 timestamps { node ('mem1') { stage ('Teamgetactivebranch - Build') { // Shell build step def job = build job: '/Team/getactivebranch/' , parameters: [] env.BAR=321 } println (job.getResult()) } } echo "env.BAR is '${BAR}'" // Powered by Infostretch env.BAR=123 timestamps { node ('mem1') { stage ('Team/getactivebranch - Build') { // Shell build step def j1BuildResult = build job: '/Team/getactivebranch/' , parameters: [] env.BAR=321 } def j1EnvVariables = j1BuildResult.getBuildVariables(); println (j1EnvVariables) } } echo "env.BAR is '${BAR}'" -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c8ec711c-2e0c-4334-9e3d-73f0b4e7ae02%40googlegroups.com.
Ability to re-run specific stages running in parallel in Jenkins pipeline
Hi All, We have this Jenkins pipeline which is supposed to run tests on 24 machines in parallel via parallel stages. Now, due to one reason or another, there is a possibility of one/more of these stages might fail. I know that we can re-run the top level stage, but, is there a possibility of rerunning specific stage from the list of parallel stages? I did some research and came across this ticket in Jenkins JIRA https://issues.jenkins-ci.org/browse/JENKINS-52391 which is somewhat similar to what i am looking for. But, this ticket is in OPEN state and I do not see any progress made on it. Has someone across a similar issue and if yes, what is the workaround that you guys followed in order to achieve the desired result? Any help would be really appreciated. Thanks Alok -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAOqqq4TCMHZMG-9obg2TfBFNUR825bfMkdv%2BwMRn2uuWS-X_5g%40mail.gmail.com.
Re: SharedLibrary doesn´t allow git parameter to fetch all branches
I'd call it a misunderstanding more than an incompatibility. The git parameter is providing a filter which can *limit* the set of branches which might be included. The git parameter *cannot expand* the set of branches which might be included. The multibranch pipeline job definition controls the initial set of branches being requested into the workspace. The branch you're seeking is not being brought into the workspace. Branch sources that use the REST API to detect changes (GitHub, Bitbucket, Gitea, GitLab) are intentionally optimized to only populate the workspace with the commits for the exact branch being built. That can save significant time and space with large repositories that contain multiple branches. If you require more history than the exact branch being built, then you'll likely need to adjust the checkout that you're using to populate the workspace. I'm not clear why you're using a branch parameter in a Pipeline job. Isn't it more effective to define a Jenkinsfile in each branch and then allow the multibranch pipeline to create and destroy jobs automatically as branches are created and destroyed? Mark Waite On Friday, February 21, 2020 at 1:53:56 AM UTC-7, judaondo wrote: > > Hello, > > I have the following pipeline that uses a method called "getServiceVersion" > from a Shared Library. > > > #!/usr/bin/env groovy > > @Library('mycom') > > import com.mycom.* > > // Declarative pipeline // > > properties([[$class: 'JiraProjectProperty'], buildDiscarder(logRotator( > artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', > numToKeepStr: '10')), disableConcurrentBuilds(), parameters([gitParameter > (branch: '', branchFilter: '.*', defaultValue: 'origin/integration', > description: 'Git Branch', listSize: '10', name: 'branch', > quickFilterEnabled: true, selectedValue: 'DEFAULT', sortMode: > 'ASCENDING_SMART', tagFilter: '*', type: 'PT_BRANCH')])]) > > def STAGE > > pipeline { > agent { label 'WindowsSlaveWS2016' } > > options { > timestamps () > ansiColor('xterm') > disableConcurrentBuilds() > } > > stages { > stage('Code checkout') { > steps { > echo '<< Checking out source code >>' > checkout([$class: 'GitSCM', branches: [[name: '${branch}' > ]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: > 'CloneOption', depth: 10, noTags: false, reference: '', shallow: true]], > submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'gitcredentials', > url: 'http://gitserver:8080/myproject']]]) > script { > STAGE=env.STAGE_NAME > } > } > } > stage('Get service version') { > steps { > script { > STAGE=env.STAGE_NAME > getServiceVersion('MY/Path', 'ChangeLog.txt', > 'myservice') > } > } > } > > } > > } > > > Please notice at the 'git parameter ( > https://plugins.jenkins.io/git-parameter/)' that fetchs all available > branches on the current repository and the selected default vale > 'origin/integration'. > > Since I am using shared library it doesn´t load all the available branches > and in fact it only displays origin/master instead of origin/integration. > > There is a kind of incompatibility? How can I fix this behaviour? > > [image: shared_lib_error.jpg] > > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/21911271-56fa-4231-921d-57de48f8fcb3%40googlegroups.com.
Defining pipeline steps that require cleanup
Hi, I'm thinking about optimizing artifact transfer between builds by using WIM files instead of single file transfers. Building would work by mounting an empty writeable WIM file over an output directory, having the build process install into this directory, then unmount and optimize the WIM file before declaring it as an artifact. Artifact consumers would mount the file read-only. Obviously, if something goes wrong, the file needs to be unmounted regardless, so I wonder how I'd set up an, ideally declarative, pipeline that mounts an image that is then available to a block of steps, and unmounted afterwards using a method that depends on the current build status. As an additional complication, making the pipeline resumable would require something like automatically unmounting images when execution is stopped after the current step, and remounting if it should continue. Can this be done, or will I have to extend the actual Jenkins program for that? Simon -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20200221113313.GA16649%40psi5.com.
Re: SharedLibrary doesn´t allow git parameter to fetch all branches
-- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/feabb0e1-6a91-466a-aa47-d9a2bb934ff6%40googlegroups.com.
SharedLibrary doesn´t allow git parameter to fetch all branches
Hello, I have the following pipeline that uses a method called "getServiceVersion" from a Shared Library. #!/usr/bin/env groovy @Library('mycom') import com.mycom.* // Declarative pipeline // properties([[$class: 'JiraProjectProperty'], buildDiscarder(logRotator( artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')), disableConcurrentBuilds(), parameters([gitParameter( branch: '', branchFilter: '.*', defaultValue: 'origin/integration', description: 'Git Branch', listSize: '10', name: 'branch', quickFilterEnabled: true, selectedValue: 'DEFAULT', sortMode: 'ASCENDING_SMART', tagFilter: '*', type: 'PT_BRANCH')])]) def STAGE pipeline { agent { label 'WindowsSlaveWS2016' } options { timestamps () ansiColor('xterm') disableConcurrentBuilds() } stages { stage('Code checkout') { steps { echo '<< Checking out source code >>' checkout([$class: 'GitSCM', branches: [[name: '${branch}']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 10, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'gitcredentials', url : 'http://gitserver:8080/myproject']]]) script { STAGE=env.STAGE_NAME } } } stage('Get service version') { steps { script { STAGE=env.STAGE_NAME getServiceVersion('MY/Path', 'ChangeLog.txt', 'myservice') } } } } } Please notice at the 'git parameter ( https://plugins.jenkins.io/git-parameter/)' that fetchs all available branches on the current repository and the selected default vale 'origin/integration'. Since I am using shared library it doesn´t load all the available branches and in fact it only displays origin/master instead of origin/integration. There is a kind of incompatibility? How can I fix this behaviour? [image: shared_lib_error.jpg] -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2cb0b22d-90e8-4ea5-a548-9eff78a59262%40googlegroups.com.