-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add telegram notification for failed pipeline
- Loading branch information
1 parent
f1c1627
commit e66c412
Showing
1 changed file
with
47 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,60 +6,62 @@ on: [push] | |
# workflow_dispatch: | ||
|
||
jobs: | ||
setup: | ||
name: 'Test Selectel Terraform modules' | ||
runs-on: self-hosted | ||
env: | ||
TF_VAR_selectel_domain_name: ${{ secrets.SELECTEL_ID }} | ||
TF_VAR_selectel_user_admin_user: ${{ secrets.SERVICE_USER }} | ||
TF_VAR_selectel_user_admin_password: ${{ secrets.SERVICE_PASSWORD }} | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup NodeJS v20 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/[email protected] | ||
|
||
- name: Run Checkov action # suppressed for now because it fails to copy a file inside a self-hosted runner | ||
uses: bridgecrewio/checkov-action@v12 | ||
with: | ||
quiet: true | ||
directory: . | ||
output_format: cli | ||
framework: terraform,github_actions | ||
container_user: 1000 | ||
|
||
- name: Lint Terraform | ||
run: terraform fmt -diff -check -recursive | ||
|
||
- name: Init Terraform | ||
run: terraformTESTFAILJOB init | ||
|
||
- name: Terraform apply | ||
run: terraform apply -auto-approve | ||
|
||
- name: Terraform destroy | ||
run: terraform destroy -auto-approve | ||
|
||
notify: | ||
name: 'Telegram notify' | ||
runs-on: self-hosted | ||
|
||
if: ${{ failure() }} | ||
steps: | ||
- name: send telegram message on push | ||
- name: send telegram message on failure | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_TO }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
message: | | ||
${{ github.actor }} created commit: | ||
Commit message: ${{ github.event.commits[0].message }} | ||
Terraform modules build pipeline was failed | ||
Action: $GITHUB_ACTION_PATH | ||
Repository: ${{ github.repository }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | ||
# setup: | ||
# name: 'Test Selectel Terraform modules' | ||
# runs-on: self-hosted | ||
# env: | ||
# TF_VAR_selectel_domain_name: ${{ secrets.SELECTEL_ID }} | ||
# TF_VAR_selectel_user_admin_user: ${{ secrets.SERVICE_USER }} | ||
# TF_VAR_selectel_user_admin_password: ${{ secrets.SERVICE_PASSWORD }} | ||
# | ||
# steps: | ||
# - name: Checkout the repo | ||
# uses: actions/checkout@v3 | ||
# | ||
# - name: Setup NodeJS v20 | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20 | ||
# | ||
# - name: Setup Terraform | ||
# uses: hashicorp/[email protected] | ||
|
||
# - name: Run Checkov action # suppressed for now because it fails to copy a file inside a self-hosted runner | ||
# uses: bridgecrewio/checkov-action@v12 | ||
# with: | ||
# quiet: true | ||
# directory: . | ||
# output_format: cli | ||
# framework: terraform,github_actions | ||
# container_user: 1000 | ||
|
||
# - name: Lint Terraform | ||
# run: terraform fmt -diff -check -recursive | ||
# | ||
# - name: Init Terraform | ||
# run: terraform init | ||
# | ||
# - name: Terraform apply | ||
# run: terraform apply -auto-approve | ||
# | ||
# - name: Terraform destroy | ||
# run: terraform destroy -auto-approve | ||
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} |