简体   繁体   中英

Jenkins deploy plugin - pass parameters from properties file

I'm using Jenkins and deploy plugin, with which I'm deploying to tomcat server. How can I pass parameters from properties file to this deploy plugin?

for example I want to pass my property app.server.url to Tomcat URL field.

I tried to pass $app.server.url also %app.server.url% , but that doesn't work.

I am assuming you have a properties file in the format app.server.url=somevalue

You then can inject these properties into the Jenkins environment using EnvInjec Plugin . Use Inject environment variables for your job build step, and just specify your file path (leave the content field blank). After that, you can reference it like this $app.server.url for *nix, or %app.server.url% for Windows. However this only works on the shell level. On the plugin properties level, a lot of plugins are expecting properties only in *nix-style format.

The further problem is that *nix-style variables do not allow dots . . So $app.server.url is not valid on *nix. I do not know if it will work on plugin-level on Windows though.

So after setting up EnvInject plugin, try the following two:

  • Try using $app.server.url in your deploy plugin.
  • Else change the property file to something like app_server_url=somevalue , and then try $app_server_url in deploy plugin.

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