Reputation: 3167
I have created git repository for Azure ARM linked templates , which create some resource stack using Azure cli command. But It needs to be build via maven command , then whatever json parameter and template files get generated , we upload it to Azure blob storage (as this is requirement for Linked template). then we fetch these template and parameter files from Azure blob storage , then execute cli command to deploy azure stack.
During build step, following commands are executed:
mvn clean install
mvn exec:java -Dexec.args="dev"
mkdir parameters
mkdir resourcetemplates
cp target/classes/parameters/dev/*.json parameters
cp target/classes/resourcetemplates/*.json resourcetemplates
And in post build action, i am using Azure Storage plugin to upload it to blob storage. Now, i need to execute azure cli command , as below, but problem is i am not getting Azure-cli plugin option in post build actions in dropdown list in jenkins.
az group deployment create --resource-group rg-test --template-file .\masterazuredeploy.json --parameters templateBaseUrl=https://test.blob.core.
windows.net/azurestackautomationtest/resourcetemplates/ parameterBaseUrl=https://test.blob.core.windows.net/azurestackautomationtest/parameters
I dont want to create another Jenkins job and to execute it as post build action. As i have N environments for which i need to create this job, so it will create N*2 jobs, which i dont want.
Any other solution to execute azure cli command as post build step.
Upvotes: 0
Views: 639
Reputation: 5502
Yes, the Azure CLI plugin is available in the Jenkins Marketplace, and can be used only as a build step and not as a post-build action.
To work around this, you may convert the "upload to blob storage" part also as a build step instead of a post-build action, so you can use the az storage blob upload command from Azure CLI, and then execute the aforementioned CLI step as well.
Upvotes: 0