fix: adding slack notification when build is failed to upload to docker (#2862)

* fix: removing logs

* fix: adding slack notification when build is failed to upload to docker

* minor changes

---------

Co-authored-by: Manish Gupta <59428681+manishg3@users.noreply.github.com>
This commit is contained in:
sriram veeraghanta 2023-11-24 12:17:31 +05:30
parent 267cf75004
commit c305cf2c72
2 changed files with 177 additions and 19 deletions

View File

@ -1,11 +1,10 @@
name: Branch Build name: Branch Build
on: on:
pull_request: pull_request:
types: types:
- closed - closed
branches: branches:
- master - master
- release - release
- qa - qa
@ -23,7 +22,7 @@ jobs:
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
# - name: Set Target Branch Name on PR close # - name: Set Target Branch Name on PR close
# if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }} # if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }}
# run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV # run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
@ -31,7 +30,7 @@ jobs:
# - name: Set Target Branch Name on other than PR close # - name: Set Target Branch Name on other than PR close
# if: ${{ github.event_name == 'push' }} # if: ${{ github.event_name == 'push' }}
# run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV # run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- uses: ASzc/change-string-case-action@v2 - uses: ASzc/change-string-case-action@v2
id: gh_branch_upper_lower id: gh_branch_upper_lower
with: with:
@ -41,22 +40,22 @@ jobs:
id: gh_branch_replace_slash id: gh_branch_replace_slash
with: with:
source: ${{ steps.gh_branch_upper_lower.outputs.lowercase }} source: ${{ steps.gh_branch_upper_lower.outputs.lowercase }}
find: '/' find: "/"
replace: '-' replace: "-"
- uses: mad9000/actions-find-and-replace-string@2 - uses: mad9000/actions-find-and-replace-string@2
id: gh_branch_replace_dot id: gh_branch_replace_dot
with: with:
source: ${{ steps.gh_branch_replace_slash.outputs.value }} source: ${{ steps.gh_branch_replace_slash.outputs.value }}
find: '.' find: "."
replace: '' replace: ""
- uses: mad9000/actions-find-and-replace-string@2 - uses: mad9000/actions-find-and-replace-string@2
id: gh_branch_clean id: gh_branch_clean
with: with:
source: ${{ steps.gh_branch_replace_dot.outputs.value }} source: ${{ steps.gh_branch_replace_dot.outputs.value }}
find: '_' find: "_"
replace: '' replace: ""
- name: Uploading Proxy Source - name: Uploading Proxy Source
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@ -77,7 +76,6 @@ jobs:
!./nginx !./nginx
!./deploy !./deploy
!./space !./space
- name: Uploading Space Source - name: Uploading Space Source
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@ -88,12 +86,44 @@ jobs:
!./nginx !./nginx
!./deploy !./deploy
!./web !./web
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'success' }}
id: slackSuccess
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "✅ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }} "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'failure' }}
id: slackFailed
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "❌ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
outputs: outputs:
gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }}
branch_build_push_frontend: branch_build_push_frontend:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] needs: [branch_build_and_push]
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
@ -121,9 +151,42 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'success' }}
id: slackSuccess
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "✅ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }} "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'failure' }}
id: slackFailed
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "❌ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
branch_build_push_space: branch_build_push_space:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] needs: [branch_build_and_push]
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
@ -151,9 +214,41 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'success' }}
id: slackSuccess
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "✅ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }} "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'failure' }}
id: slackFailed
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "❌ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
branch_build_push_backend: branch_build_push_backend:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] needs: [branch_build_and_push]
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
@ -180,10 +275,42 @@ jobs:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'success' }}
id: slackSuccess
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "✅ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }} "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'failure' }}
id: slackFailed
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "❌ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
branch_build_push_proxy: branch_build_push_proxy:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] needs: [branch_build_and_push]
steps: steps:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
@ -211,3 +338,35 @@ jobs:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'success' }}
id: slackSuccess
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "✅ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }} "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}
- name: Send GitHub Action trigger data to Slack workflow
if: ${{ job.status == 'failure' }}
id: slackFailed
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repo_name": "${{ github.repository }}",
"redirect_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_name": "${{ github.workflow }}",
"job_name": "${{ github.job }}",
"status": "❌ ${{ job.status }}",
"message": "${{ github.event.head_commit.message }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_BUILD_WEBHOOK }}

View File

@ -112,7 +112,6 @@ export const IssueForm: FC<IssueFormProps> = observer((props) => {
appConfig: { envConfig }, appConfig: { envConfig },
} = useMobxStore(); } = useMobxStore();
const user = userStore.currentUser; const user = userStore.currentUser;
console.log("envConfig", envConfig);
// hooks // hooks
const editorSuggestion = useEditorSuggestions(); const editorSuggestion = useEditorSuggestions();
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();