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 <
[email protected]> 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 <[email protected]> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CACTWNKBUW6koy37j1ELe1PbBZifd8MMEpyVL%2BwbeeUGV06RKCw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAPD6afO526XNJcgA381%2BAt-Lnks7UB3Jm%2BukdixfPcsXFewKNw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAPD6afO526XNJcgA381%2BAt-Lnks7UB3Jm%2BukdixfPcsXFewKNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
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.

Reply via email to