Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed alert msg to be sent to a slack webhook. #1929

Merged

Conversation

greyerof
Copy link
Contributor

Created an action that sends a customizable message along with some static information related to the workflow's job it is running.

It's currently used in conjunction with if: ${{ failure() }} to send a message to configured webhook as an alert for a failing job, but can be reused for any other purpose, as long as the webhook endpoint accepts the json object that will be sent to.

The webhook is free to format the final message accordingly but these are the fields it will receive:

{
  "attempt": "1",
  "message": "Alert or custom message!",
  "job_url": "https:/github.com/path/to/workflow/job",
  "commit_url": "https://github.com/path/to/commit",
  "repo_url": "https://github.com/path/to/repo"
}

Where job_url, commit_url and attempt point to the job where the workflow is/was running, the commit_url of the commit that triggered the workflow and the job attempt number respectively.

Only the message is customizable by means of the step's with.message field. The other fields are internally set by the action.

The webhook URL should be stored in a secret and passed to the with.slack_webook field of the step.

Created an action that sends a customizable message along with some
static information related to the workflow's job it was running.

It's currently used in conjunction with if: ${{ failure() }} to
send a message to configured webhook as an alert for a failing job, but
can be reused for any other purpose, as long as the webhook endpoint
accepts the json object that will be sent to.

The webhook is free to format the final message accordingly but these are
the fields it will receive:
{
  "attempt": "1",
  "message": "Alert or custom message!",
  "job_url": "https:/github.com/path/to/workflow/job",
  "commit_url": "https://github.com/path/to/commit",
  "repo_url": "https://github.com/path/to/repo"
}

Where job_url, commit_url and attempt point to the job where the
workflow is/was running, the commit_url of the commit that triggered the
workflow and the job attempt number respectively.

Only the message is customizable by means of the step's "with.message"
field. The other fields are internally set by the action.

The webhook URL should be stored in a secret and passed to the
"with.slack_webook" field of the step.
@dcibot
Copy link
Collaborator

dcibot commented Mar 19, 2024

@rdavid
Copy link
Member

rdavid commented Mar 19, 2024

@sebrandon1 We have YAML files with both .yml and .yaml extensions. Shouldn't we standardize to one type? I vote for .yml.

@greyerof greyerof merged commit 87b8d35 into redhat-best-practices-for-k8s:main Mar 20, 2024
19 checks passed
@dcibot
Copy link
Collaborator

dcibot commented Mar 20, 2024

greyerof added a commit to greyerof/cnf-certification-test-partner that referenced this pull request May 9, 2024
Updated github workflows to send alert msgs to the dev team's slack
channel, similar to
redhat-best-practices-for-k8s/certsuite#1929
sebrandon1 pushed a commit to redhat-best-practices-for-k8s/certsuite-sample-workload that referenced this pull request May 9, 2024
Updated github workflows to send alert msgs to the dev team's slack
channel, similar to
redhat-best-practices-for-k8s/certsuite#1929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants