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

Dev 336/amplify webhook builds #2906

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/deploy-backoffice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Under Testing - Build and Deploy Backoffice Application

on:
push:
paths:
# Run this pipeline only if there are changes in specified path
- 'apps/backoffice-v2/**'
branches:
- "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'
Comment on lines +21 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix workflow_call input configuration

The environment input in the workflow_call event is marked as both required and has a default value. This is redundant as the default value will never be used when the input is required.

Apply this fix:

  workflow_call:
    inputs:
      environment:
        type: string
        description: 'Environment'
-       required: true
-       default: 'dev'
+       required: false
+       default: 'dev'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: false
default: 'dev'
🧰 Tools
🪛 actionlint (1.7.4)

27-27: input "environment" of workflow_call event has the default value "dev", but it is also required. if an input is marked as required, its default value will never be used

(events)


jobs:
build:
name: Build Backoffice App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Update actions/checkout to latest version

The checkout action version v3 is outdated. Update to the latest version for security and performance improvements.

- uses: actions/checkout@v3
+ uses: actions/checkout@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

37-37: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.BACKOFFICE_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.BACKOFFICE_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi

send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Back-office Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Backoffice Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}
86 changes: 86 additions & 0 deletions .github/workflows/deploy-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Under Testing - Build and Deploy Dashboard Application

on:
push:
paths:
# Run this pipeline only if there are changes in specified path
- 'apps/workflows-dashboard/**'
branches:
- "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix workflow trigger configuration issues

There are several issues in the workflow trigger configuration:

  1. The environment input in workflow_call is marked as both required and has a default value, which is redundant.
  2. Environment configuration is inconsistent between workflow_dispatch and workflow_call.
  3. Branch indentation is incorrect.

Apply this diff to fix the issues:

 on:
   push:
     paths:
       # Run this pipeline only if there are changes in specified path
       - 'apps/workflows-dashboard/**'
     branches:
-    - "dev"
+      - "dev"
   workflow_dispatch:
     inputs:
       environment:
         type: choice
         description: 'Choose Environment'
         required: true
         default: 'dev'
         options:
           - 'dev'
           - 'sb'
           - 'prod'
   workflow_call:
     inputs:
       environment:
         type: string
         description: 'Environment'
-        required: true
-        default: 'dev'
+        required: false
+        default: 'dev'
+        enum: ['dev', 'sb', 'prod']
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
push:
paths:
# Run this pipeline only if there are changes in specified path
- 'apps/workflows-dashboard/**'
branches:
- "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'
on:
push:
paths:
# Run this pipeline only if there are changes in specified path
- 'apps/workflows-dashboard/**'
branches:
- "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: false
default: 'dev'
enum: ['dev', 'sb', 'prod']
🧰 Tools
🪛 actionlint (1.7.4)

27-27: input "environment" of workflow_call event has the default value "dev", but it is also required. if an input is marked as required, its default value will never be used

(events)

🪛 yamllint (1.35.1)

[warning] 9-9: wrong indentation: expected 6 but found 4

(indentation)

jobs:
build:
name: Build Dashboard App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.DASHBOARD_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.DASHBOARD_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi

send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Dashboard Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "Dashboard Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}
86 changes: 86 additions & 0 deletions .github/workflows/deploy-kyb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Under Testing - Build and Deploy KYB Application

on:
push:
paths:
# Run this pipeline only if there are changes in specified path
- 'apps/kyb-app/**'
branches:
- "dev"
workflow_dispatch:
inputs:
environment:
type: choice
description: 'Choose Environment'
required: true
default: 'dev'
options:
- 'dev'
- 'sb'
- 'prod'
workflow_call:
inputs:
environment:
type: string
description: 'Environment'
required: true
default: 'dev'
codechirag123 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
name: Build KYB App
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
codechirag123 marked this conversation as resolved.
Show resolved Hide resolved

# Trigger a webhook
- name: Trigger Build webhook
run: |
# curl -X POST -d {} "${{ secrets.KYB_WEBHOOK_URL }}" -H "Content-Type:application/json"
response=$(curl -s -w "\n%{http_code}" -X POST -d {} "${{ secrets.KYB_WEBHOOK_URL }}" -H "Content-Type:application/json")
status_code=$(echo "$response" | tail -n 1)
if [ "$status_code" -lt 200 ] || [ "$status_code" -ge 300 ]; then
echo "Error: Webhook request failed with status $status_code"
echo "Response: $(echo "$response" | head -n -1)"
exit 1
fi

send-to-slack:
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.result == 'success' }}
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write

steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "KYB Build initialized in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}

on-failure:
runs-on: ubuntu-latest
needs: [build]
if: failure()
environment: ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}
permissions:
contents: read
packages: write
steps:
- name: Send alert to Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.ARGO_SLACK_CHANNEL_ID }}'
slack-message: "KYB Build job failed in ${{ github.event_name == 'push' && github.ref_name || inputs.environment }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.ARGO_SLACK_BOT_TOKEN }}
Loading