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.
Related
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?
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.
After taking the user's permission to send push notifications and saving the userID in firestore, how can I use it to send notifications to them at a time of their choice daily ?
For example :
If the user selects 8:00 AM , I want to be able to send them the push notification everyday at 8 am.
I can't write the code to send the notification in the action itself.
What will I have to setup to accomplish this?
Once the user has granted you permission to send push notifications, you can use the Actions API to send the push notification.
The setup would be as follows.
Storing user preferences
1) Dialogflow agent asks the user when they want to be notified
2) User says they want to be notified at 8:00 am
3) Dialogflow detects the answer and makes a fulfillment request to your webhook (The webhook can be the inline editor in dialogflow (Functions) or another server)
4) In the handler of the intent, you have to store the UserId and the time they selected in your database (in this case, firestore)
5) Dialogflow agent gives the final answer to the user and the interaction ends
Sending the push notification
1) Identify if you have to send a notification to a user; this is the tricky part.
It is not possible to give you a definitive solution on this, because it heavily depends on the requirements of your system and the technologies that you are using/want to use.
Basically, you can use cron jobs, background infinite processes, pub/sub, cloud scheduler, or any other tool that allows you to constantly read information from your database to determine which users need to be notified. I recommend you to check this answer where is discussed an approach to tackle this problem using Firestore.
Notice that you don't necessarily need another server running, you can use the Functions used for the fulfillment.
For example. You can set up Cloud Scheduler to run each hour, and make a request to your Functions. In the request, you read from Firestore and extract the entities that need to be notified that hour.
2) Once you have the users that you want to notificate, you need to use the Actions API to send the push notification. Once again, this request can come from your fulfillment server, or another server used in the system.
The use-case would be to trigger certain jobs, only after an MR is not in WIP anymore.
The idea what I'm exploring is to create a merge-request webhook, that would trigger a pipeline.
However in order to do this, I have to get the ref from the webhook's request body to call the trigger accordingly.
What options do I have?
Running a server just for processing the webhook and redirecting to the correct endpoint is not really an option.
Running a server just for processing the webhook and redirecting to the correct endpoint
I dont see any other way. I'm in same boat. Gonna use Heroku for just this bit. Oh well.
so I want to get email notification for failed pipeline builds, I tried to configure my gitlab settings as following: https://docs.gitlab.com/ee/workflow/notifications.html
But in my settings I see following:
There is no check box for Failed/Successful pipeline.
For the project I set it to 'Watch:' receive notifications from projects or groups user is a member of.
What am I missing?
Even if the question is old, the solution is the Gitlab Integration "Pipeline emails" (suggested by this other answer).
In short, in your project, go to Project -> Settings -> Integrations -> Pipelines emails and set the list of emails to notify.
The link to https://docs.gitlab.com/ee/workflow/notifications.html is no more active.
I found a blog post from 2020 on https://about.gitlab.com/blog/, explaining how to do.
Read it there : https://about.gitlab.com/blog/2020/06/17/notification-on-pipeline-succeeds/
In short, you have checkboxes for custom notification events like :
failed pipeline
fixed pipeline
successful pipeline
etc.
To access it, like said in the blog post,
Go to the Project overview page for the project.
Click the "bell" 🔔 (Notification setting) button and select Custom.
And before all, check your global notification email at : https://gitlab.com/-/profile/notifications