Re: declarative pipeline syntax seems limited, am I missing something?

2018-09-06 Thread Baptiste Mathus
>  authoritatively described as being more flexible

Well, if you did read this somewhere, please provide the link, we should
update and fix this.
I suppose it depends on what people put behind the term "flexible", but in
my mind, no that is not the promise of Declarative.

Declarative is about making Pipelines generally more accessible to
beginners, and much more standard between teams and companies. That goal is
mostly about actually lowering flexibility, but at the same time removing
also a lot of surprises that people discover along the way using Scripted.

For your issue, you can still use Shared libs, and yes you can (and many of
argue, should) extract many things in shell scripts or cli tools that can
be used outside of Jenkins.
Pipeline is an awesome orchestration tool/language, but you really want to
get away from using it like a full blown programming language (which many
people do using Scripted, because they can :). And they can't with
Declarative, which is good overall).

My 2 cents

Le ven. 31 août 2018 à 22:35, Gabe Nydick  a écrit :

> Thanks. From what I've read, it seems like the declarative way of doing
> things is authoritatively described as being more flexible, but things that
> used to be common place, now all have to be shelled out. What's the point
> if you're now "declarative" but everything you do is in scripts?
>
> On Thu, Aug 30, 2018 at 11:29 PM Damien Coraboeuf <
> damien.corabo...@collibra.com> wrote:
>
>> Hi,
>>
>> You can put this in a `script` section, and put what you need in
>> environment variables for the rest of the stages / steps:
>>
>> steps {
>>script {
>>   ...
>>   def shortGitCommit = "${gitCommit[0..10]}" as String
>>   env.SHORT_GIT_COMMIT = shortGitCommit
>>   ...
>>}
>>echo "Short Git Commit = $SHORT_GIT_COMMIT"
>> }
>>
>> On Thu, Aug 30, 2018 at 11:04 PM Gabe Nydick  wrote:
>>
>>> How do I replicate the following functionality? I can't seem to find a
>>> way
>>>
>>>
>>> def myRepo = checkout scm
>>> def gitCommit = myRepo.GIT_COMMIT
>>> def gitBranch = myRepo.GIT_BRANCH
>>> def shortGitCommit = "${gitCommit[0..10]}"
>>> def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~", 
>>> returnStdout: true)
>>> def dockerImage = "$image:${gitCommit}"
>>> def dockerLatest = "$image:latest"
>>> def dockerfile = 'base.Dockerfile'
>>>
>>>
>>> --
>>> 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/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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/CAPD6afO526XNJcgA381%2BAt-Lnks7UB3Jm%2BukdixfPcsXFewKNw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CACTWNKB%2B5tUV67pmr6EzHhH3%3DRhsq%2Bkon5X8N6-xAK9FLgMpxQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CANWgJS7yW1W_QPYn7ZMYTvCTMaGgECNN59PdDOpAyrcVs75MFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: declarative pipeline syntax seems limited, am I missing something?

2018-08-31 Thread Gabe Nydick
Thanks. From what I've read, it seems like the declarative way of doing
things is authoritatively described as being more flexible, but things that
used to be common place, now all have to be shelled out. What's the point
if you're now "declarative" but everything you do is in scripts?

On Thu, Aug 30, 2018 at 11:29 PM Damien Coraboeuf <
damien.corabo...@collibra.com> wrote:

> Hi,
>
> You can put this in a `script` section, and put what you need in
> environment variables for the rest of the stages / steps:
>
> steps {
>script {
>   ...
>   def shortGitCommit = "${gitCommit[0..10]}" as String
>   env.SHORT_GIT_COMMIT = shortGitCommit
>   ...
>}
>echo "Short Git Commit = $SHORT_GIT_COMMIT"
> }
>
> On Thu, Aug 30, 2018 at 11:04 PM Gabe Nydick  wrote:
>
>> How do I replicate the following functionality? I can't seem to find a way
>>
>>
>> def myRepo = checkout scm
>> def gitCommit = myRepo.GIT_COMMIT
>> def gitBranch = myRepo.GIT_BRANCH
>> def shortGitCommit = "${gitCommit[0..10]}"
>> def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~", 
>> returnStdout: true)
>> def dockerImage = "$image:${gitCommit}"
>> def dockerLatest = "$image:latest"
>> def dockerfile = 'base.Dockerfile'
>>
>>
>> --
>> 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/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAPD6afO526XNJcgA381%2BAt-Lnks7UB3Jm%2BukdixfPcsXFewKNw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CACTWNKB%2B5tUV67pmr6EzHhH3%3DRhsq%2Bkon5X8N6-xAK9FLgMpxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: declarative pipeline syntax seems limited, am I missing something?

2018-08-30 Thread Damien Coraboeuf
Hi,

You can put this in a `script` section, and put what you need in
environment variables for the rest of the stages / steps:

steps {
   script {
  ...
  def shortGitCommit = "${gitCommit[0..10]}" as String
  env.SHORT_GIT_COMMIT = shortGitCommit
  ...
   }
   echo "Short Git Commit = $SHORT_GIT_COMMIT"
}

On Thu, Aug 30, 2018 at 11:04 PM Gabe Nydick  wrote:

> How do I replicate the following functionality? I can't seem to find a way
>
>
> def myRepo = checkout scm
> def gitCommit = myRepo.GIT_COMMIT
> def gitBranch = myRepo.GIT_BRANCH
> def shortGitCommit = "${gitCommit[0..10]}"
> def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~", 
> returnStdout: true)
> def dockerImage = "$image:${gitCommit}"
> def dockerLatest = "$image:latest"
> def dockerfile = 'base.Dockerfile'
>
>
> --
> 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/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPD6afO526XNJcgA381%2BAt-Lnks7UB3Jm%2BukdixfPcsXFewKNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


declarative pipeline syntax seems limited, am I missing something?

2018-08-30 Thread Gabe Nydick
How do I replicate the following functionality? I can't seem to find a way


def myRepo = checkout scm
def gitCommit = myRepo.GIT_COMMIT
def gitBranch = myRepo.GIT_BRANCH
def shortGitCommit = "${gitCommit[0..10]}"
def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~",
returnStdout: true)
def dockerImage = "$image:${gitCommit}"
def dockerLatest = "$image:latest"
def dockerfile = 'base.Dockerfile'

-- 
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/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.