How can I trigger a CI pipeline to run on release - gitlab

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?

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

Azure CI pipeline trigger not working after git instance migration

I have few CI and CD pipelines in azure devOps project in which CI pipelines connect to github enterprise repository to fetch the code.
CI pipelines were invoked by the trigger whenever there is a change in main branch of repository.
This was working fine until our git repository instance was changed. All our git repositories are migrated to the new instance.
I have updated the service connection, to point to the new git instance and manually invoked CI pipelines and tested. It worked fine.
But the issue is now with automatic triggering of CI pipelines. It is not working now.
I tried remove and add git service connections and repository details inside CI pipeline and enabled trigger, but still it is not getting automatically invoked whenever there is a change in repository.
What could be the reason for this ? I already removed and added the git repository details in CI pipeline, still that does not work. Is there anything I missed out? Any leads appreciated!
You can check the "Override the YAML trigger from here" setting for the types of trigger (Continuous integration or Pull request validation) available for your repo." in the Triggers UI.
If it does not work, please create a new pipeline to check if it works.
For more information, you could refer to: troubleshooting failing triggers
Finally figured out the issue and fixed. It was error with web hook in the repository.
Updated the webhook and it is working fine now.

How to Trigger a build pipeline depends on create PR request source branch in Azure DevOps

I have a Develop branch and Master. My task is to trigger the build pipeline when I create a Pull Request from Develop to Master before merge, depends on Develop branch. The trigger should be from source branch. Can we add tags to trigger the build pipeline based on source branch. I am using classic pipelines and new to ADO. how can I achieve this. Please someone help me to achieve this in detail.
To get a pipeline to trigger when a PR is opened but before it is merged you would need to add a branch policy on master branch to have a build validation step. This will trigger the pipeline to run whenever a PR is opened to master
Build Validation
Unfortunately, PR trigger behaviour varies, depending on which SCM you're using: Azure Repos Git, GitHub, or Bitbucket Cloud. With BB Cloud, the PR build will be triggered when the PR is opened or updated, but not when it is merged. The filter input can be used to specify branches for PR trigger.
Details for each SCM system can be found by clicking on the links on the "Triggers in Azure Pipelines" documentation.
The way how to set that up does depend on your source-code version control software you are using. For GitHub you need to install the "Azure Pipeline" GitHub App.
Then configure a pipeline in AzureDev Ops and enable "Continous integration" in "Triggers" section.
P.S.: To avoid that the compile check of a PR will result in published artefacts you can either have to different pipelines or - that's what I try to achieve - one pipeline where the artefacts are just being generated when the PR is merged.

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

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.

How to make auto CI build pipeline whenever a new branch is created?

i want Azure DevOps to create a CI build pipeline automatically whenever a new branch is committed
You can achieve this using the triggers, they allow you to use wildcards so
would trigger a build for any branches that start with 'feature/'
You can create a CI build pipeline by checking the
Enable continuous integration option in the Triggers of build pipeline. Then add the new branch to the Branch filters.
If you are using yaml ,You can add the new branch directly to the trigger part of yaml.

Resources