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 committed by GitHub
parent 97be4b60ae
commit 8d76c96a6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 177 additions and 19 deletions

View File

@ -1,11 +1,10 @@
name: Branch Build
on:
pull_request:
types:
types:
- closed
branches:
branches:
- master
- release
- qa
@ -23,7 +22,7 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3.3.0
# - name: Set Target Branch Name on PR close
# if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }}
# 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
# if: ${{ github.event_name == 'push' }}
# run: echo "TARGET_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- uses: ASzc/change-string-case-action@v2
id: gh_branch_upper_lower
with:
@ -41,22 +40,22 @@ jobs:
id: gh_branch_replace_slash
with:
source: ${{ steps.gh_branch_upper_lower.outputs.lowercase }}
find: '/'
replace: '-'
find: "/"
replace: "-"
- uses: mad9000/actions-find-and-replace-string@2
id: gh_branch_replace_dot
with:
source: ${{ steps.gh_branch_replace_slash.outputs.value }}
find: '.'
replace: ''
find: "."
replace: ""
- uses: mad9000/actions-find-and-replace-string@2
id: gh_branch_clean
with:
source: ${{ steps.gh_branch_replace_dot.outputs.value }}
find: '_'
replace: ''
find: "_"
replace: ""
- name: Uploading Proxy Source
uses: actions/upload-artifact@v3
with:
@ -77,7 +76,6 @@ jobs:
!./nginx
!./deploy
!./space
- name: Uploading Space Source
uses: actions/upload-artifact@v3
with:
@ -88,12 +86,44 @@ jobs:
!./nginx
!./deploy
!./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:
gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }}
gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }}
branch_build_push_frontend:
runs-on: ubuntu-20.04
needs: [ branch_build_and_push ]
needs: [branch_build_and_push]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
@ -121,9 +151,42 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
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:
runs-on: ubuntu-20.04
needs: [ branch_build_and_push ]
needs: [branch_build_and_push]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
@ -151,9 +214,41 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
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:
runs-on: ubuntu-20.04
needs: [ branch_build_and_push ]
needs: [branch_build_and_push]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
@ -180,10 +275,42 @@ jobs:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
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:
runs-on: ubuntu-20.04
needs: [ branch_build_and_push ]
needs: [branch_build_and_push]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
@ -211,3 +338,35 @@ jobs:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
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 },
} = useMobxStore();
const user = userStore.currentUser;
console.log("envConfig", envConfig);
// hooks
const editorSuggestion = useEditorSuggestions();
const { setToastAlert } = useToast();