DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Auto Deploy Notes


  1. Write a property file: /home/bvt/docs/jenkinsEnv.properties:

gcp.job.type=deliver gcp.deliver.ip=10.0.7.142 gcp.deliver.user=gcp gcp.deliver.home=/home/gcp gcp.deliver.deployFolder=deploy gcp.deliver.prompt=gcp@cloud142

Note: Do not leave blanks between "=" and values in property file.

gcp.deliver.home = /home/gcp

will produce wrong value when gotten by expect script.

  1. Add this file to "Build Environment -> Inject environment variables to the build process" in Jenkins Job Configure panel with Environment Injector plugin.

  2. Create a deploy script (deploy.exp) in project base folder:

#!/usr/bin/expect set artifact [lindex \(argv 0] spawn scp $artifact $env(gcp.deliver.user)@\)env(gcp.deliver.ip):$env(gcp.del expect eof

  1. Create a "Conditional step(single)" with conditional-buildstep plugin.

Run? Strings match

String 1: ${ENV,var="gcp.job.type"}

String 2: deliver

Builder: Execute Shell

Command: ./deploy.exp build/*.zip



Published

Aug 29, 2013

Last Updated

Aug 29, 2013

Category

Tech

Tags

  • environment variables 3
  • expect 10
  • jenkins 26

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor