We are trying to template our CD/CI pipeline including Deployments using Bamboo Specs.
We use Jira Service Desk for Change Management.
What we currently do is have a script task within the deploy-plan in which we pass the JIRA issue ID of the CHG to see if it approved and only then allow the deployment else fail it.
This works OK.
But if we have the deploy section also as a part of specs then we cannot inject variable to pass the JIRA issue ID.
we looked into using properties file to inject variables at build stage and this works fine - but then at deploy stage how do we inject a variable - as it is locked by specs ?
As I understand it, you would like the same issue key variable to be used in build and subsequent deploy stage?
I think in this case you can use an inject bamboo variables task in the build stage, with scope set to "Result".
This should mean the variable is available in subsequent deploy stages, and you can use it in any deployment tasks.
We went down this route. But the problem we have is that we may not know the issue key at build time and likely to know this very close to deploy time.
Trying to inject a variable at a later date will mean running a new build simply to inject a variable to be used in Deploy.
We want to be able to inject variable at deploy time.
Ah I see, so the problem is that you need to set the variables' value in between the time when the build was run and when the deployment was run.
In Jira Software, I know this can be done when you create a "release build" where you can override the deployment variables. I don't think that can easily work with JSD though, that is documented here for JSW Cloud
Otherwise, I'm not sure how this can be easily done, after a bit of googling, I see this plugin is available: Custom Deployments for Bamboo which seems like it might solve the issue? Note: I have never tried that particular plugin, so cannot attest to it being good or bad.
There is also a feature request to add this to the rest API, which would also solve your problem, consider voting for that if it would be useful: BAM-18838