Triggering release pipeline from build pipeline and pass in the build number - azure

I would like to have a manual stage in a build pipeline that triggers a release pipeline and passes build number. Is it possible to accomplish this without having to add extensions from marketplace? I am pretty new to Azure, our organization just switched from Bamboo, so I am still getting acquainted with Azure DevOps Thanks!

We can’t directly call the variable of the build pipeline in the release pipeline, as a workaround, we can store the variable to artifact->publish artifact->download this artifact in the release pipeline, then we can use the build variable in the release pipeline.

Related

Azure devOps multi stage pipeline release status response

I am running a multi stage pipeline and need to run a production build pipeline after the success of pre production release pipeline so is there any way around to check the status of the release pipeline using RestAPI in azure Devops and get this response in build pipeline.
To trigger the production stage of build pipeline based on the results of the pre production release pipeline
I think you don't need to use REST API for this, you can use the result of your pipeline as a trigger for your second pipeline:
Configure pipeline resource triggers

How can I trigger a CI pipeline to run on release

I'm building a .NET class library and I want to build and deploy on a release in gitlab. I've done similar things on Github but reading the documentation for gitlab-ci I can't see any way to trigger a pipeline to run when I create a release.
It seems that gitlab-ci only has the following triggers:
on push
On a trigger defined with the pipeline triggers API
when another pipeline runs
Will I have to set up a webhook when I create a release and trigger the pipeline to run using the triggers API?

Azure Devops-release pipeline

Can we create release pipeline in azure devops using yaml?
(I know we can add stages in pipelines ,but i want to know if we can create pipeline in pipelines -> release by yaml not classic pipeline.)
you can build and release in the same pipeline, we have a multi stage pipeline, the first stage builds the subsequent stages deploy to the different environments and run automated test
Alternatively you can separate it in to different yaml pipelines

Is it possible to forward an azure artifact from one pipeline to another?

I'm doing a project where I want a intermediate pipeline to consume an artifact from another pipeline to later forward it to another pipeline, which then starts running. I have not managed to find a solution online to this functionality and I'm starting to think that that functionality is not (as of today) supported in Azure DevOps. Can someone confirm whether this implementation is possible with pipelines? If not, how should one approach this scenario? I'm relatively new to Azure DevOps, so it's possible that I might have missed or misunderstood some information online.
I know that a pipeline can download an artifact which was published by another pipeline. And I know about pipeline triggers. Currently I have managed to consume artifacts in the intermediate pipeline, but now I have to find a way to send those artifacts to a specific pipeline, from the intermediate pipeline.
I appreciate all the help I can get.
but now I have to find a way to send those artifacts to a specific pipeline, from the intermediate pipeline.
We could publish build artifact from the intermediate pipeline by the Publish Build Artifacts or Publish Pipeline Artifacts task in the intermediate pipeline, then we use the Download Build Artifacts or Download Pipeline Artifacts task in the specific pipeline to download the artifact which we published from intermediate pipeline.
Yo could check this document Publish and download artifacts in Azure Pipelines for some more details.
Update:
Are you aware if this functionality is planned for Azure DevOps? If we
put it this way - is it possible for my intermediate pipeline to,
depending on some variables, trigger a specific pipeline (i.e. it can
trigger two different pipelines, but which one to trigger depends on
some variables)?
The answer is yes. There is extension Trigger Build Task, which can be used to trigger a new Build so that build-chaining is possible.
And we just need add the value of the variables as condition for this task, then we could trigger a specific pipeline depending on some variables.
Where this specific pipeline is in another project. Is it also
possible for this pipeline to access the variables which I created in
my intermediate pipeline?
I think I might understand what you want to achieve. you want to create some variables in the intermediate pipeline, then use this variables in the specific pipeline.
The answer is yes. But there is no directly way to access the variables which you created in intermediate pipeline. The solution we need to set the default value for the variables in the specific pipeline, then use REST API Definitions - Update to update those variables in the intermediate pipeline.
Please check my previous thread for detailed REST API scripts.
As far as I know, the solution would be adding Azure Artificats to store the output from Pipeline 1, then in Pipeline 2, download the artifact.
https://learn.microsoft.com/en-us/azure/devops/artifacts/overview?view=azure-devops

What is the purpose of release pipelines when the same tasks are available in build pipeline?

I am using azure build and release pipelines. I understand that build pipeline produces an artifact that can be used by release pipelines and deployment can be organized into stages with options to deploy/re-deploy stage.
However, I also notice that all tasks available in release pipeline are also available in the build pipeline. Also the documentation for build pipeline states that it can be used to build, test and deploy. So what exactly is the benefit of using release pipelines?
The pipelines under "Pipelines -> Releases", are classic deployment pipelines made with the GUI.
The new YAML pipelines are always under "Pipelines -> Pipelines" and allow both build and deployment jobs: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops.
By using deployment jobs instead of classic Releases, the deployments will show up under "Pipelines -> Environments".
So in this way it makes sense the same tasks are available on both sides since both allow defining deployment workflows.
YAML pipelines do not have the same capabilities as classic Releases yet though, I think release gates was still missing.
For classic UI-format build and release pipeline:
Usually we use Build Pipeline to build/test our project and output the tested software binaries.
Then we can use Release Pipeline to deploy the artifacts from Build Pipeline to more than one stages depending on we need. So that, we only need to run the Build Pipeline once to get the artifacts(containing the software binaries) and we can use Release Pipeline to reuse and deploy the artifacts to different environment. (Develop, Product...)
Of course we can use Build Pipeline to run some deploy tasks, and we can use Release Pipeline to run the build and test tasks. We can but we shouldn't(not recommended), configuring the Build and Release UI pipeline can make the workflow of how we build/test(more related to CI)=>deploy(more related to CD) better.
And if you're using Multi-stage pipeline, you don't need to use the Release(UI) Pipelines. You can define CI/CD steps in one xx.yml file.
It is the same tasks but not the same processes.
Nowadays, I would say Pipelines are responsible for Continuous Integration, and Release Pipelines are more about Continuous Delivery. When all deployment features will arrive to YAML pipelines it will not be the case.
As you said, Azure Release Pipelines can use and automatically trigger on result of YAML or classic pipelines and you can use different agents. Agent for YAML or classic pipelines need all tools to compile, test and assembly the code when Agent for Release, need the tools for deployment and correct access rights to target environment.
In Release pipelines you can organize your deployments by environments/stages more easily, add steps which could be launched separately with out need to relaunch the whole pipeline (like application recovery or switch to production).
The workflow of Release Pipelines is more visual than in YAML or Classic Build pipelines.
From my experience the main difference is in Approvals and Gates features, for now.
You can try to implement the whole CI/CD process just on YAML pipelines but it could be much easier to use both Azure Pipelines capabilities to separate the logic of CI and CD, at the moment, as deployment features of YAML pipelines are still in development.
in principle there isn't. its just that usually release pipelines are geared towards deploying stuff and build pipelines towards building stuff. jenkins, for example, only had builds. and you'd be releasing with builds. it really depends on the solution you are using. octopus cannot really build stuff, but can release stuff and got tools to make releasing easier.
in ADO you can have stages in release pipelines, so you can do promotes easily, you have approval gates, etc

Resources