I'm trying to create a deploy plan which:
I have everything working up until step #2, where I'm stuck trying to find a way to execute the deploy script.
Is there any way that I can refer to the file that was uploaded as part of the SCP task? If not, what good is it to SCP a file if we cannot refer to it in future tasks?
We're using Maven for build & dependency management and each successful build increments the POM number, so the name of the file to deploy isn't static.
The artifact should be what you are copying in an scp task. Getting the name of the artifact in the ssh task looks like it could be tricky though.
My initial thoughts are to put the name of the artifact in an injection variable. But again identifying the artifact may be a problem.
I know that you can reference the artifact directory using variables and perhaps what you need to do if your ssh command is not a static value (a batch script name for example) is get a list of the files in your artifact store for that build here: http://your.org/bamboo/browse/${bamboo.planKey}-JOB1/latest/artifact (assuming your artifacts are created in the JOB1 stage)
If you were to retrieve that as a rest request you could parse it for the specific artifact you are looking for then put that in an injection variable. (essentially a variable/value pair in a text file on the filesystem).
Yes, it is clunky and a hassle to script but it will work.
All that said we generally have the server we are deploying to run a script to pickup whatever artifact we dump there and deploy from the server side rather than trying to do it from the bamboo host. It's just easier to do it that way for us.
For example if you have a tomcat war file to deploy, bamboo dumps the artifact in a staging location on the application server, then a cron or windows scheduled task checks the server staging location and if it finds a candidate (*.ear) deploys it.
You could also use a script on the server that was executed by a script on the bamboo host that would do the same thing. The difference is that you would be executing a named script "deploy.sh" or "deploy.cmd/bat/whatever" to actually deploy the artifact using wildcards in the script.
Hope this helps.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.