If statements, variable assignment, and the like are only allowed in
Declarative if they're within a script {...} block inside the steps {...}
block.

A.

On Mon, May 22, 2017 at 9:43 AM Thiago Carvalho Davila <
[email protected]> wrote:

> Hello,
>
> I want to run unit tests only if file exists on declarative pipeline. I
> made a mix of scripted/declarative pipeline of what I want, but this
> doesn't work:
>
>         stage('Unit Tests'){
>             steps {
>                 // Se arquivo de testes existe, roda testes
>                 if (fileExists VSTest_TestFile) {
>                     // Roda o VSTest
>                     echo "\"${tool 'vstest.console_v14'}\"
> ${VSTest_TestFile} ${VSTest_Args}"
>                     bat "\"${tool 'vstest.console_v14'}\"
> ${VSTest_TestFile} ${VSTest_Args}"
>               }
>          }
> ​
>
> Any hints?
>
> Thanks,
>
> Thiago
> -
>
>
> "Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO),
> empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é
> enviada exclusivamente a seu destinatário e pode conter informações
> confidenciais, protegidas por sigilo profissional. Sua utilização
> desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a
> recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente,
> esclarecendo o equívoco."
>
> "This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a
> government company established under Brazilian law (5.615/70) -- is
> directed exclusively to its addressee and may contain confidential data,
> protected under professional secrecy rules. Its unauthorized use is illegal
> and may subject the transgressor to the law's penalties. If you're not the
> addressee, please send it back, elucidating the failure."
>
> --
> 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/10812493383fd20d902df7a9184ed82053999a58%40serpro.gov.br
> <https://groups.google.com/d/msgid/jenkinsci-users/10812493383fd20d902df7a9184ed82053999a58%40serpro.gov.br?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/CAPbPdOb%2BEEfDxGhez-cyzk03yJ0mZ-zZVeGaG7Ma7g_hd1nymQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to