azure devops | keep history releases from specific branch - azure

I want to keep all the history from our master branch, 1 year
the history deleted after 2 or 3 months and is bad we want to keep our production history....

To keep all the history from the master branch for a year, you can set up branch policies in Azure Devops.
Go to the Branches page in the Repos section of your project.
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops&tabs=browser

You could see the doc for details.
If you are using an on-premises Team Foundation Server or Azure DevOps Server, you can specify release retention policy defaults and maximums for a project. If you are using Azure DevOps Services, you can view but not change these settings for your project.
And for every release pipelines, you could see retention policy for each stage but not specific branch. You could go to release pipelines and edit release then you could see 'retention' for the release.
For individual key releases, you can click on (…) of one release pipeline and choose “retain indenfinitely”.
BTW, neither the pipeline's retention policy nor the maximum limits set by the administrator are applied when you mark an individual run or release to be 'retained indefinitely'. It will remain until you stop retaining it indefinitely.

Related

Azure DevOps Release Pipelines permission

I have two projects in my Azure DevOps environment. Project H and Project HB. Project H contains the Board of Tasks and Repo for source code. Project HB contains the build and release pipelines. The build works as it shoud, as does the release pipeline.
But I get an error in the "Release" view, when looking at the Commits made for the release.
TF401019: The Git repository with name or identifier '' does not exist or you do not have permissions for the operation you are attempting.
Which permissions should I configure to get the release to be able to show the commits and Work Items related to the release?
Is it possible to report the deployment status back to boards that exists in another project?
I Tried to add Read permission to the repo and boards in "Project H" for the account "Project HB Build Service".
1
We have the same problem with the Stakeholder access.
Team members can open the page in your screenshot, but stakeholder have the issue as described by you.
So, it's not about the Build Service access, but the user who opens the release status should have access to Project HB.
If the user already has access, then this might be a limitations within the classic release overview.
2
Two answer the second part, you should however see the build status, of the yaml pipeline, in the work items of project H.
The deploy status, of classic release pipelines, is a different story.
AFAIK it's only reported back to the project it is in.
Maybe publishing a deployment badge can help you:
3
Alternatively you could migrate to YAML pipelines, since reporting back of these pipelines have more options then the classic release pipelines.

Azure Data Factory Environment Set up

I am setting up an environment for ADF. I have multiple projects and Segments which I need to support. I have noticed that I can only set up one publish branch in ADF.
Should we create ADF for each project?
What is the recommended approach for setting up an environment ?.
Multiple ADFs are required if there is complete different project with different data. If you want to work in same project and just need to manage different environment like development, testing and prod; all this can be managed in one ADF.
A developer creates a feature branch to make a change. They debug their pipeline runs with their most recent changes. For more information on how to debug a pipeline run, see Iterative development and debugging with Azure Data Factory.
After a developer is satisfied with their changes, they create a pull request from their feature branch to the main or collaboration branch to get their changes reviewed by peers.
After a pull request is approved and changes are merged in the main branch, the changes get published to the development factory.
When the team is ready to deploy the changes to a test or UAT (User Acceptance Testing) factory, the team goes to their Azure Pipelines release and deploys the desired version of the development factory to UAT. This deployment takes place as part of an Azure Pipelines task and uses Resource Manager template parameters to apply the appropriate configuration.
After the changes have been verified in the test factory, deploy to the production factory by using the next task of the pipelines release.
Note
Note: Only the development factory is associated with a git repository. The test and production factories shouldn't have a git repository associated with them and should only be updated via an Azure DevOps pipeline or via a Resource Management template.

Deploy each pull request to an app service with a unique URL

Is that possible?
It would be very convenient, to have all branches with an open PR deployed somewhere, where I can have a shareable link.
There are the PR-Branch Triggers, but AFAIK it can only deploy one branch to one environment at the time. And another PR update would just overwrite the state.
EDIT to clarify what I mean:
Each feature branch (or bugfix or whatever) of our webapp should be deployed to an app service (or whatever), so when we create the feature, we always have a link to share during development, in which our designers (or whoever) could find issues in early development. At another cloude storage provider, we had something like that and we would always receive a unique link after successful deployment.
I'm a bit late but working on this now. What I intend to do:
Pull request on selected feature branches triggers task 2
Task will create app services via Terraform (Link)
Use the 'app service deploy' task to push the artifact from that pull request to the new app service created in the prior task.
We'll see how it goes
If deploying each feature branch to an app service is what you are trying to achieve.
You can try below steps(Only for classic pipeline view):
1,In your CI build pipeline, Go to triggers page, add each of your feature branch to branch filters, So that each Pull request made to your feature branch can trigger a build.
2, in your CD release pipeline(Classic view), add different stages, each for an artifacts which built from feature branches:
3, for each stage, In the pre-deployment conditions page, add an artifacts filters to its corresponding feature branch. So that the artifacts from this specific feature branch will trigger to deploy its corresponding stage.
4, Change the settings and parameters of the tasks in each stage according to each feature branch. So that each app service deployed for each feature branch has its own settings and configurations,
5,Configure your app service deploy tasks in each stage.
With above steps done,each time when a new pull request is merged to the feature branch, the corresponding stage will be automatically triggered to deploy this pull request to the configured app service.

How do I only build the last commit in Azure Pipelines for CI/CD?

The azure pipeline build task for github tends to build all the commits in a PR sent. I would like it to build only the last commit. That is I would like the other build jobs started for the previous commits in a PR (except for the last one) to be cancelled automatically without manual intervention. This is to reduce the number of build jobs queued at the same time for a given PR.
How do I achieve this in Azure Pipelines for CI/CD. I can do it in travis easily and would like to find out if it is available in Azure Pipelines for CI/CD and if so how to achieve it.?
I believe this behavior to cancel existing queued pipelines on PR update became the default behavior for Azure-DevOps with the Nov-12-2018 release with this feature. It doesn't look like it is flagged for 2019 On-Premise, so I'd expect this won't be available On-Premise for a while.

Manual deployment from source control instead of automatic deployment?

I have two sites set up in Azure, a staging site and a production site.
Both sites are connected to the master branch of my git repository.
The stage site gets automatically updated when I commit a change to the master branch. What I'd like to do is have production set up so that it won't automatically be updated, but I can manually update it when I want to.
Basically so that changes will get pushed to stage, and when I'm ready for them to go to production, I can manually push them.
Is there a way to do that in Azure?
You have a couple of options:
Use a separate branch to deploy to production. For example a release branch. When you commit to the release branch, production will be deployed. This way you decide when will be deployed to production.
Another option, which is a bit more work. (especially if you have not done it before), but has it's advantages because of more control over the deployment:
Create a VSTS account in Azure. In the VSTS account create a project. Setup a build against your source to create artifacts which can be used in release management. Create a release which can deploy to Staging, and for example after a approval to production. (It's also possible to configure a swap here if you like, to release to producton)
For information about this:
https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnet4-to-azure
https://www.visualstudio.com/en-us/docs/build/apps/cd/deploy-webdeploy-webapps

Resources