>
>         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/44d030af-6af6-4f5a-815b-030e89fc5e3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to