Hello,
if like this..
stage('Build image') {
steps {
script {
def TAG = sh (returnStdout: true, script: "git describe
--candidate=1 --tags").trim()
env.TAG = sh (returnStdout: true, script: "echo ${tag}
| cut -d\'-\' -f 1").trim()
}
......
groovy.lang.MissingPropertyException: No such property: tag for class:
groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at
On Wednesday, May 23, 2018 at 12:04:08 PM UTC-4, Ramanathan Muthaiah wrote:
> stage('Build image') {
>> steps {
>> sh 'TAG=$(git describe --candidate=1 --tags)'
>> sh 'TAG=$(echo $TAG | cut -d\'-\' -f 1)'
>> sh 'WEB_IMAGE_NAME=' + env['ACR_LOGINSERVER'] +
>> '/my-project-1499882073260/test:' + env['TAG']
>>
>> sh 'sudo docker build -t ${WEB_IMAGE_NAME} -f
>> WebApplication/WebApplication1/Dockerfile WebApplication/.'
>> }
>> }
>>
>
> How about like this ?
>
> def tag = sh (returnStdout: true, script: "git describe --candidate=1
> --tags").trim()
> env.TAG = sh (returnStdout: true, script: "echo ${tag} | cut -d\'-\' -f 1"
> ).trim()
>
> I haven't tested this code though, so, cannot guarantee it's success or
> failure, you may want to tweak and customize according to your needs. But,
> it's worth looking at / using the 'sh' step's return status and output.
>
> Remember to use them inside 'script' block if you're using Declarative
> syntax.
>
> /Ram
>
--
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/953ed37c-c886-4478-915d-0e3f74dd994d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.