As I understand, it is written in Groovy. That means you can access a variable 
in a (Groovy)string using dollar and optionally curly brackets.

"  variable value is ${variable} "

Skaffa Outlook för Android<https://aka.ms/ghei36>



Från: Idan Adar
Skickat: söndag 30 juli 13:56
Ämne: Accessing a variable in shell
Till: Jenkins Users


Given the following script block in a stage (Declarative pipeline), how can I 
access the repoName variable?

stages {
    stage("...") {
        script {
            for (String repoName: repoList) {
                sshagent (credentials: 
['e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
                    sh """
                        git clone -b master git@****.com:****/repoName.git
                        cd repoName
                        ....
                    """
                }
            }
         }
     }
}

--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d9d247a5-8ab9-4154-99c5-8c77b0861ec2%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/d9d247a5-8ab9-4154-99c5-8c77b0861ec2%40googlegroups.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/E5FDBCA98976C447.5af66ff2-2a16-45cb-968f-645c0c29ec56%40mail.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to