Slack integration with Tekton missing pipeline event messages - ibm-cloud

Following the documentation here, I created a Tekton Pipeline and integrated Slack through the tool integration. I also set up an incoming webhook following the Slack API documentation. Along with configuring the webhook URL, channel, and team name, I checked the pipeline events as shown below.
I have received messages regarding the successful binding between the Tekton pipeline and Slack integration. I am also seeing other tool integrations in the Slack channel but missing the pipeline events like Pipeline start, success, and failure.
Am I missing something here?

The easiest way is by adding a definition pointing to the post to Slack task helper and the associated sample.
Additionally, I have to enable the Slack notifications setting under the Tekton pipeline.
I have documented the steps with screen captures in a blog post here

Related

Get Azure Devops Pipeline Step Runtimes

Looking through the Azure Devops APIs it appears like it isn't possible to get the runtime of individual steps in a pipeline run?
Pipeline steps
I'm looking to scrap the runtime of each step in a pipeline run across all runs of a pipeline.
I've looked at the Azure Devops APIs, and while I see how to get pipeline run details here, it doesn't appear like the API includes step level information.
You can use Timeline - Get REST API to achieve the runtime of individual steps in a pipeline run. Please refer to doc:Timeline-GET-REST APT
For example:
URL
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline/{timelineId}?api-version=5.1
Test in postman:
The response body returns a list of build details that include job/step/task type and name and startTime and finishTime according timeline.

Azure DevOps. Get Discord Notification on Specific Pipeline Failure

We have a few pipelines that are taking backups on schedule. We would like to receive notifications on Discord in case if specific Pipelines were to fail.
There is a way to receive an email notification and an official application to integrate Slack into Azure DevOps.
But is there a good way to do that for Discord?
You can use the Discord Webhook extension that give you a task to send messages to Discord during your pipeline.
When creating a webhook for a channel in a Discord server, you will be given a url which contains the Channel ID and the Secret Key for that webhook in this format: https://discordapp.com/api/webhooks/{channelId}/{webhookKey}.
You will not need to provide the url to the task, but rather just the Channel ID and Secret Key. (The first section in the link above, Making a Webhook, is all that needs to be followed to be able to use this task).
More info you can find here.
After you know which values put in the task you can dd it to your pipeline and configure it to run only if the pipeline failed with the condition failed().

Integrate Cypress tests into Azure Devops Pull Request

I have been reading the Azure Devops docs and I am completely confused by them. All I want to is something very simple (simple with Github Actions in Github anyway) where
A developer creates a PR.
As the PR is created Azure runs all the associated Cypress tests
If any fail then the notes at the top of the PR indicate this. For example just next to the bit where it says 'there are merge conflicts'
We had this working in Github, but I can't figure it out here.
Thanks
There is no extension like "Cypress GitHub app" in azure devops, so it is impossible to achieve exactly the same function as in github pull request.
As a workaround , you can try to add status policy.
Using status alone, details from an external service can be provided
to users within the PR experience. Sometimes, sharing information
about a PR is all that is necessary, but in other cases PRs should be
blocked from merging until requirements are met. Like the in-box
policies, the Status policy provides a way for external services to
block PR completion until requirements are met. If the policy is
required, it must pass in order to complete the pull request. If the
policy is optional, it is informational only, and a status of
succeeded is not required in order to complete the pull request.
External services can use the PR Status API to post detailed status to your PRs. The branch policy for external services brings the ability for those 3rd party services to participate in the PR workflow and establish policy requirements. This article guides you through the process of configuring a branch policy for a service that is posting PR status.
In addition, here is a ticket about how to create required pull request status check, you can refer to it.

Is it possible to approve pull requests from azure repos in micorsoft teams?

Right now i see that only pull request URL is supplied through the notification. Is it possible to modify either the azure devops connector or modify azure repos subscription in microsoft teams to include approval as well
First off, with the default connector, I didn't see that possibility. We have a similar use case and we use a LogicApp or Power Automate to do what you want with REST API calls.
Link to the documentation: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/get%20pull%20request?view=azure-devops-rest-5.1
However, why have pull request approval policies if someone won't even look into the changes and approve them?
As others have mentioned, 'rubber stamping' Pull Requests goes against their intent. However, if you are looking for a command approach to Pull Requests, one does exist in the form of the Azure CLI.
The following command would approve a Pull Request:
az repos pr set-vote --id {id} --vote approve
Take a look at the docs to learn more:
https://learn.microsoft.com/en-us/cli/azure/ext/azure-devops/repos/pr?view=azure-cli-latest#ext-azure-devops-az-repos-pr-set-vote
Installation for Azure CLI can be found here:
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest&tabs=azure-cli
Is it possible to approve pull requests from azure repos in micorsoft teams?
Agree with Daniel. It is unreasonable to approve PR directly in teams without reviewing the PR content.
But it is a good choice to display the alert of PR in teams, so that we can directly click alert to direct to PR.
To display the PR in the teams, you could check below document how to get the Pull Request Alerts in Microsoft Teams:
VSTS Pull Request Alerts in Microsoft Teams
Hope this helps.

how to trigger a jenkins pipeline stage when an authorized user make a comment on github pull request?

I am familiar with Jenkins Pull Request Builder and I had set up a freestyle job with it to build my project based on the comment that authorized user put. (For example test in prod) in the past.
Now I am trying to use a Jenkins 2.0 with github organization plugin for one of my project.
this is the scenario:
A User is making a PR to master(or some other sensitive branch)
A test is going to get run automatically.
After the test past, an authorized user needs to go to the PR and put a comment Deploy to test environment and then a jenkinsfile that was waiting for this input needs to get trigger.
I just dont know how to do the step 3. how do I make jenkins pipeline job listen for comments in github repo pull requests? the Jenkins documentation is not really clear about the input from user part.
I read this thread answer but the documentation about the Gates approval is really limited.
I know this is super late, but here's some info for future Googlers:
I have a Github webhook that sends the event to a Lambda function that will parse the event for a specific comment string, then create an HTTP POST request for the Jenkins job, which is configured to allow builds to be triggered remotely.
So: open PR > comment on PR 'Deploy to test environment' > webhook sends to AWS APIGateway > AWS SNS topic > AWS Lambda > parse the event for comment > If comment matches, create HTTP POST > Jenkins receives request and runs job
There's a lot of documentation on this, but none of it together, so here are the resources that I used:
Regarding allowing jobs to be triggered remotely:
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
Using Github to trigger Lambda function:
https://aws.amazon.com/blogs/compute/dynamic-github-actions-with-aws-lambda/
Github API. You will want to pay particular attention to the Issues API:
https://developer.github.com/webhooks/