[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Dan Alvizu commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages For anyone else who runs into this: Andrew closed this as 'FIxed but unreleased' but with a resolution of 'Duplicate'. The duplicate issue is JENKINS-49135 and track there Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.189617.1522766954000.84.1565385121129%40Atlassian.JIRA.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title CJ Harmath commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Okay, so I just re-read the docs and as I understand what I should be doing is to just put the entire pipeline into my shared library. https://jenkins.io/doc/book/pipeline/shared-libraries/#defining-declarative-pipelines This kind of makes me wonder if we allow defining entire pipeline, why not allow stages as well ? But I guess I am already happy with this as I only need to maintain one pipeline per app type. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.189617.1522766954000.23879.1559936220691%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title CJ Harmath edited a comment on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages I would like this as well.Use case:share build stages across similar projects, to keep things DRY and have a central shared library defining the various build stages per project types.i.e.: I might have many many microservices all using the same 1) package restore 2) lint 3) build 4) run unit tests stages with only parameter differences and it would be awesome if app devs can just include a single line with the necessary parameters to call these 4 steps. so instead of {code:java} stages { stage('restore') { steps { echo 'package restore' restore() } } stage('build') { steps { echo 'building' build() } } stage('test') { steps { echo 'testing' test() } }} {code} you could do this: {code:java} stages { sharedMicroserviceStages()} {code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.189617.1522766954000.23838.1559935800953%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title CJ Harmath commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages I would like this as well. Use case: share build stages across similar projects, to keep things DRY and have a central shared library defining the various build stages per project types. i.e.: I might have many many microservices all using the same 1) package restore 2) lint 3) build 4) run unit tests stages with only parameter differences and it would be awesome if app devs can just include a single line with the necessary parameters to call these 4 steps. so instead of stages { stage('restore') { steps { echo 'package restore' restore() } } stage('build') { steps { echo 'building' build() } } stage('test') { steps { echo 'testing' test() } } } you could do this: stages { sharedMicroserviceStages() } Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.189617.1522766954000.23797.1559935680827%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Colm O'Shea commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Would also love to see if there is docs or something for this? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Frank Gen commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hello, This fix is marked as "Fixed but Unreleased", can someone add a pointer to the PR implementing this? Or any documentation? Thanks Frank Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Tom Ghyselinck edited a comment on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hi [~abayer],Is this really a duplicate of [ # JENKINS-49135 |https://issues.jenkins-ci.org/browse/JENKINS-49135 ]?In [PR #241|https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/241], you explicitly say that you won't support the directives {{stage}}, {{stages}}, {{steps}}, etc.and this is actually what we _do_ want here.With best regards,Tom. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Tom Ghyselinck commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hi Andrew Bayer, Is this really a duplicate of JENKINS-49135? In PR #241, you explicitly say that you won't support the directives stage, stages, steps, etc. and this is actually what we do want here. With best regards, Tom. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Andrew Bayer updated JENKINS-50548 Jenkins / JENKINS-50548 Shared Library should be allowed to declare reusable stages Change By: Andrew Bayer Status: Open Fixed but Unreleased Resolution: Duplicate Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Marcelo Luiz Onhate edited a comment on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hello,As a suggestion you can use the (not well documented) feature that loads scripts on the fly.this will load the libs from the same repository and branch you are checking out, it will go to folder {color:red}/vars/{color} and load all .groovy files. { color:red noformat } library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm) { color noformat } {noformat}/- vars/- deploy.groovy- setup.groovy{noformat}The name of the .groovy script will become a step on pipeline, as you can see the steps *setup* and *deploy*. {code:java}#!groovyscript {library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm)}pipeline {stages {stage('Setup & Deploy') {steps {setup()deploy()}}}}{code}{color:red}setup.groovy{color}{code:java}#!/usr/bin/env groovydef call() {sh "echo 'YEAH'"sh "some/other/script.sh"}{code}{color:red}deploy.groovy{color}{code:java}#!/usr/bin/env groovydef call() {def props = readProperties file: 'environment.env'env.PROP_1 = props['PROP_1']sh "script/that/uses/PROP_1"}{code} Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Marcelo Luiz Onhate edited a comment on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hello,As a suggestion you can use the (not well documented) feature that loads scripts on the fly. {code:java}#!groovyscript {library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm)}pipeline {stages {stage('Setup & Deploy') {steps {setup()deploy()}}}}{code} this will load the libs from the same repository and branch you are checking out, it will go to folder {color:red}/vars/{color} and load all .groovy files.{noformat}library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm){noformat}{noformat}/- vars/- deploy.groovy- setup.groovy{noformat}The name of the .groovy script will become a step on pipeline, as you can see the steps *setup* and *deploy*. { code:java}#!groovyscript {library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm)}pipeline {stages {stage('Setup & Deploy') {steps {setup()deploy()}}}}{code}{ color:red}setup.groovy{color}{code:java}#!/usr/bin/env groovydef call() {sh "echo 'YEAH'"sh "some/other/script.sh"}{code}{color:red}deploy.groovy{color}{code:java}#!/usr/bin/env groovydef call() {def props = readProperties file: 'environment.env'env.PROP_1 = props['PROP_1']sh "script/that/uses/PROP_1"}{code} Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Marcelo Luiz Onhate commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages Hello, As a suggestion you can use the (not well documented) feature that loads scripts on the fly. this will load the libs from the same repository and branch you are checking out, it will go to folder /vars/ and load all .groovy files. library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm) / - vars/ - deploy.groovy - setup.groovy The name of the .groovy script will become a step on pipeline, as you can see the steps setup and deploy. #!groovy script { library identifier: "setup@$BRANCH_NAME", retriever: legacySCM(scm) } pipeline { stages { stage('Setup & Deploy') { steps { setup() deploy() } } } } setup.groovy #!/usr/bin/env groovy def call() { sh "echo 'YEAH'" sh "some/other/script.sh" } deploy.groovy #!/usr/bin/env groovy def call() { def props = readProperties file: 'environment.env' env.PROP_1 = props['PROP_1'] sh "script/that/uses/PROP_1" } Add Comment
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Jesus Alvarez commented on JENKINS-50548 Re: Shared Library should be allowed to declare reusable stages I spent all day trying do this with Declarative Pipelines and finally had to give up. It was so easy to do things like this with Scripted Pipelines, but Declarative is the way going forward. It would be nice to have this with the shared pipeline library. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-50548 Shared Library should be allowed to declare reusable stages Change By: Andrew Bayer Component/s: pipeline-model-definition-plugin Component/s: pipeline Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Tobias Larscheid updated an issue Jenkins / JENKINS-50548 Shared Library should be allowed to declare reusable stages Change By: Tobias Larscheid Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so:{code:java}pipeline { stages {stage('Build') { steps {reusableBuild() }}stage('Test') { steps {reusableTest() }} } }{code}I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages:{code:java}pipeline { stages {reusableBuild()reusableTest()stage 'Something individual' { steps { echo 'only for this project'} } } }{code}Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch ;) Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
[JIRA] (JENKINS-50548) Shared Library should be allowed to declare reusable stages
Title: Message Title Tobias Larscheid created an issue Jenkins / JENKINS-50548 Shared Library should be allowed to declare reusable stages Issue Type: Improvement Assignee: Unassigned Components: pipeline Created: 2018-04-03 14:49 Priority: Minor Reporter: Tobias Larscheid Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so: pipeline { stages { stage('Build') { steps { reusableBuild() } } stage('Test') { steps { reusableTest() } } } } I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages: pipeline { stages { reusableBuild() reusableTest() stage 'Something individual' { echo 'only for this project' } } } Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch