I am triggering a Pipeline from another Pipeline over REST API, which works fine but one thing is annoying me.
I could not find a way to display with queued Pipeline original Commit Message of the Triggering pipeline.
There is a build in variable '$(Build.SourceVersionMessage)' which contains the information I need but I could not find a way to pass this information to triggered workflow so it can be displayed.
Following fields existing the REST API, I though the correct field would be 'triggerInfo' but that didn't changed anything in displayed build message.
Any idea how can I transfer this information and display it?
Related
So, i have a public project that allows other people in my organization to open issues. I would like labels applied to each issue when it is opened. I have tried the /label method and that only works when the person opens the issue is a part of the project. It seems that Gitlab does not allow this as per this issue: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73710
So, to get around this, I have set up a webhook that triggers a pipeline, parses some text at the end of the issue description (like ISS001)and then uses the Issues API to set the labels.
I have two questions that I can't seem to find a concrete answer to.
In the Webhook payload, does any of that information tell you what template was used? Looking through the payload, I cannot see any indication of that... which is why I am parsing the text at the bottom. In the object_attributes portion of the payload I see:
"id": <What is this?>,
"iid": <Issue Id>,
iid is the issue id, but what is id? I can't find that anywhere.
Is there a way to configure the cicd pipeline to only trigger on issue CREATE.. not update, close, reopen? I have it set as:
only:
- trigger
So no other actions trigger the pipeline but there are a TON of superfluous pipeline runs.
Thank you.
I currently have a task that I intend to run only once when a PR is created. Any pipeline runs due to new commits should not trigger the task. I was wondering if there is a way to detect the runs triggered by changes to code in the PR? When I use the predefined variable $(Build.Reason) I get back PullRequest for both builds(One triggered when PR is created and other when updates are made to PR).
This is what I have in my pipeline and I have enabled build validation for my pipeline.
trigger:
- master
pr:
- master
I don't think there's a way to differentiate the "PR is created" and "PR is updated" build reasons based only on the predefined variables.
However, you can choose a different route depending on what this task you should only run once is. If it is something that can be wrapped into a service with a public endpoint, you can try leveraging the Webhooks.
So, if this is an option for you, try the following:
wrap the functionality required to run only on the PR creation into the service with the public endpoint
create a webhook, choose "Pull request created" event type and enter the public URL of your service
As a result, your build logic won't branch depending on the build reason, and that specific action will be run by the webhook.
I understand it all sounds like a hack and unnecessary complexity, but it's up to you to decide whether it fits your case. At least, this is possible technically.
I am writing an automation routine that will include manually running a GitHub Workflow. I need to monitor the status of the workflow and download the logs once it’s finished.
Everything is fairly straightforward. The only missing link in the chain is how to determine the run ID for the workflow that I just invoked. There is no information that comes back from the REST API call (/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches endpoint) in either the body or the headers that gives me that information.
How can I determine what the run ID is for the workflow when it is invoked?
I am trying to find a way to reject a pull request into my master branch if there are still bug work items open in my back log in azure devops. I know I can create pre-deployment gates in the release pipeline to prevent release but I want to stop the build pipeline under that condition. to be more specific im trying to make sure my pull request to start my build to be later be released doesn't contain a critical bug in the back log items
How can I create some sort of policy for a pull request to be rejected if there are x amount of bug items in the back log
AFAIK, there is no such out of box way to do this.
To receive this, you could create a Build validation on the master branch:
Branches->master->Branch policies->Build validation
Then, create a build pipeline with Agentless job:
and select Shared Queries, set the Upper threshold for the Query work items task:
Now, we just need to create a Shared Query to get the all the open bug work items:
Hope this helps.
Is it possible to change the automatic slack notifications on "Receive event notifications in Slack"?
For example, if a pipeline has successfully completed, we get the following message from the Webhook:
User/Project Name: Pipeline #269 of tag Ticket_8088 by User-Name
(User) passed in 12:02
The form of the message should be different.
I am the server administrator. So I can also change something at the code level. (if required)
There isn't a programmatic way to accomplish such task.
All messages are hardcoded in app/models/project_services/chat_message (as you can see in the repo).
So, in your case, you need to change the method activity in app/models/project_services/chat_message/pipeline_message.rb - please consider that your changes will be discarded when you update GitLab.