[INJI-597] add slack action for sending critical issues message #21
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
name: Push-Triggers | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
- qa-develop | ||
- 'release-**' | ||
- inji-sonar-qube-android | ||
release: | ||
types: [published] | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
branches: | ||
- main | ||
- develop | ||
- qa-develop | ||
- 'release-**' | ||
jobs: | ||
build-android: | ||
uses: mosip/kattu/.github/workflows/android-build.yml@master | ||
with: | ||
NODE_VERSION: "16.x" | ||
DEBUG_KEYSTORE_ALIAS: androiddebugkey | ||
SERVICE_LOCATION: '.' | ||
ANDROID_SERVICE_LOCATION: 'android' | ||
BUILD_SCRIPT_LOCATION: 'scripts' | ||
SCRIPT_NAME: './android-build.sh' | ||
secrets: | ||
DEBUG_KEYSTORE_PASSWORD: '${{ secrets.INJI_ANDROID_DEBUG_STOREPASS }}' | ||
build-ios: | ||
uses: mosip/kattu/.github/workflows/ios-build.yml@master | ||
with: | ||
NODE_VERSION: "18.x" | ||
SERVICE_LOCATION: '.' | ||
IOS_SERVICE_LOCATION: 'ios' | ||
SCRIPT_NAME: "fastlane ios_app_build" | ||
sonar-check-on-push: | ||
name: Sonar check | ||
if: ${{ github.event_name != 'pull_request' }} | ||
needs: [build-android, build-ios] | ||
uses: tw-mosip/kattu/.github/workflows/npm-sonar-analysis.yml@inji-597-customize-npm-sonar-analysis | ||
with: | ||
SERVICE_LOCATION: '.' | ||
NODE_VERSION: '18.x' | ||
NPM_BUILD_TYPE: 'BOB' | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
ORG_KEY: ${{ secrets.ORG_KEY }} | ||
SLACK_WEBHOOK_URL: '${{ secrets.SLACK_WEBHOOK_INJI_TEAM }}' | ||
check-sonar-critical-issues: | ||
needs: sonar-check-on-push | ||
name: Check critical issues in sonar analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check for critical bugs | ||
run: | | ||
SONAR_HOST_URL=https://sonarcloud.io | ||
SONAR_PROJECT_KEY=mosip_inji | ||
# sonar check for critical issues is analyzed only for newly created issues. Once the existing critical issues ( use createdBefore=2024-01-04 search) are resolved, this createdAfter can be removed | ||
response=$(curl -s "${SONAR_HOST_URL}/api/issues/search?componentKeys=${SONAR_PROJECT_KEY}&severities=CRITICAL&statuses=OPEN&createdAfter=2024-01-04") | ||
echo "The response is $response" | ||
issues_count=$(echo "$response" | jq '.issues | length') | ||
echo "The number of issues $issues_count" | ||
if [ "$issues_count" -eq 0 ]; then | ||
echo "No critical issues found." | ||
else | ||
echo "Critical issues found. Failing the pipeline" | ||
exit 1 | ||
fi |