1
votes

I have four environments that I deploy to.

I also have four different code branches that we use to deploy code from.

We constantly switch the branches we use to deploy on these environments.

One time I want to build and deploy a daily branch on my test environment.

Later I want to build and deploy a enhancements branch on the same test environment.

Next I want to build and deploy the daily branch on my test2 environment.

I think you get the picture

We are currently using a manual process to pull from the branch we want deployed, then zip it up and push it to AWS code deploy.

Using Azure DevOps pipeline and release what is the easiest method to allow me to switch to use different branchs on different environments.

I currently have a successful setup in Azure DevOps that performs a gradle build, creates the artifact and then lets me push it over to AWS CodeDeploy on one of my environments. I just can't seem to figure out a way to eastily swtich the branch without creating tons of Azure pipelines and releases.

Thanks all!

2
Are you using Visual Studio as your main IDE?Aaron Jones
Just going through Azure DevOpsErnieAndBert
Are you and would you be open to using Visual Studio? If so, it pairs very well with Azure DevOps, and it is very easy to switch branches, commit and push code, and even merge branches.Aaron Jones
I am on the dev ops side and the engineers are doing the committing on there own end. On my end I want the ability to easily choose a branch and have it deployed on any environment that I choose.ErnieAndBert

2 Answers

2
votes

Where you manually trigger a build pipeline by clicking Queue or Run Pipeline, A new windows shown as below will be prompted which allows you to switch the branches.

enter image description here

If you want to automatically deploy different branch to different environment. You can push the build artifacts over to AWS CodeDeploy in a release pipeline and set the branch filters. Please refer to below steps:

1, set branch filter in the build pipeline as shown in below screenshot enter image description herewhich will build the selected branched. Check here for more information about triggers.

2, create a release pipline to push build artifacts over to AWS CodeDeploy.

And Set the Artifact filters which will only allow the artifacts built from the specified branch to be deployed to this tage.

enter image description here

0
votes

You could use a queue time variable to specify the branch name you would like to use on your build pipeline. You would need to:

  1. Edit your build pipeline and create the variable on the "variables" tab. Make sure to mark the "Settable at queue time" check variable creation

  2. Update the source of your build pipeline, to specify the new variable under the "Default branch" option. It would look something like this: pipeline source

RUN your pipeline. Before finally clicking on RUN, you will be able to specify the desire branch: set variable value

Hope this works