In my continuous integration pipeline I have two jobs one is for docker code build and another for code vulnerability scanning (which takes too much of time) I want that once my first job is completed it should directly trigger the release pipeline rather than waiting for the second job to complete.How can i achieve this.
I am expecting that my release pipeline should be triggered and not wait for the secops jobs to complete.
2
Answers
You can trigger a pipeline when one or more stages of the triggering pipeline complete by using the
stages
filter.In your specific case, this means having separate stages for each job, for example:
DockerBuild
stage: Builds the Docker image(s)CodeAnalysis
stage: Runs the code vulnerability scanningTrigger configuration would be something like:
See Trigger one pipeline after another for more details.
According to your tag and description, you are using the Classic release pipelines. So, the pipeline resource triggers in yaml may not be suitable for you.
In this case, you can consider add a PowerShell task to run the Releases – Create REST API command after the build is successful in your docker code build job.
The following is my test steps:
permission, and then Save your changes.
Test result:
The release pipeline is triggered after the PowerShell task runs in the Docker code build job.
By the way, you can also use your personal access token instead of the
$(System.AccessToken)
of the pipeline. Then you need to create a PAT with the release execute permission and use it in the PowerShell task.Sample PowerShell script with PAT: