简体   繁体   中英

Environment variable in Jenkinsfile

We are trying to use ${server.config.dir} in jvmOptions

-Djava.security.auth.login.config=${server.config.dir}/kerberos/client_jaas.conf

Can we set this as part of Jenkins environment variables?

We did it like this-

environment {
        server.config.dir="some directory"
}

and we are getting this error-

WorkflowScript: 37: Expected string literal @ line 37, column 9.
           server.conf.dir="serverconfigdir"
           ^

The error message indicates a string literal is expected, and the special characters are causing the compiler to not read the key in the environment directive as a string literal. You need to explicitly cast it as a literal string:

environment {
  'server.config.dir' = "some directory"
}

and the error will be fixed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM