diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..7c16d85f7 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Global rule: +* @brahmanand1 @spal-sapient @aksshriv1 @shunaray @kunkambl @mampacch @nagendra-battala @Chittauri @gipathak @risshukl0 @ananthpal @manoj-srivastava \ No newline at end of file diff --git a/.github/workflows/Processors_CI_Workflow.yaml b/.github/workflows/Processors_CI_Workflow.yaml new file mode 100644 index 000000000..f54ca8ab0 --- /dev/null +++ b/.github/workflows/Processors_CI_Workflow.yaml @@ -0,0 +1,104 @@ +name: Processors_CI_Workflow # Define the name of the workflow + +# Define when the workflow should trigger +on: + pull_request: + types: + - labeled # Trigger when a label is added + - unlabeled # Trigger when a label is removed + - synchronize # Trigger when commits are pushed to the PR + - opened # Trigger when a PR is opened + - edited # Trigger when a PR title or description is edited + - ready_for_review # Trigger when a draft PR is marked as ready + - reopened # Trigger when a closed PR is reopened + - unlocked # Trigger when a locked PR is unlocked + branches: [master, develop, qa-master] # Apply to these branches + pull_request_review: + types: [edited, dismissed] # Trigger when a review is edited or dismissed + branches: [master, develop, qa-master] + workflow_dispatch: # Allow manual triggering of the workflow + +# Define environment variables +env: + GITHUB_HEAD_NAME: $GITHUB_HEAD_REF # Store the head branch name + sonartoken: ${{ secrets.SONARQUBE_TOKEN }} # Secret for SonarQube authentication + sonarurl: ${{ secrets.SONARURL }} # SonarQube URL stored in secrets + +jobs: + + # ✅ Building & Testing Processors + processors_ci: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set Up Java + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '17' + + - name: Cache Maven packages + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Clone & Build knowhow-common dependency + run: | + git clone --branch ${{ github.event.pull_request.base.ref }} https://github.com/PublicisSapient/knowhow-common.git + cd knowhow-common + mvn clean install -Ddockerfile.skip=true -X + + - name: Get common version using Maven Help Plugin + run: | + cd knowhow-common + COMMON_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + echo "COMMON_VERSION=$COMMON_VERSION" + echo "COMMON_VERSION=$COMMON_VERSION" >> $GITHUB_ENV + + - name: Build & Test Jira Processor + run: | + mvn clean install -Pjira-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION + + - name: Build & Test Azure Board Processor + run: mvn clean install -Pazure-board-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION + + - name: Build & Test DevOps Processor + run: mvn clean install -Pdevops-processor -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION + + - name: Build & Test Azure Pipeline Repo Processor + run: mvn clean install -Pazure-pipeline-repo -Ddockerfile.skip=true -Dcommon.version=$COMMON_VERSION + + - name: SonarQube Analysis - Processors + run: | + mvn sonar:sonar -Dsonar.projectKey=ENGINEERING.KPIDASHBOARD.PROCESSORS \ + -Dsonar.projectName=ENGINEERING.KPIDASHBOARD.PROCESSORS \ + -Dsonar.branch.name=${{ env.GITHUB_HEAD_NAME }} \ + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \ + -Dcommon.version=$COMMON_VERSION \ + -Dsonar.login=${{ secrets.SONARQUBE_TOKEN }} -f pom.xml + + - name: Check SonarQube Quality Gate - Processors + run: | + chmod +x SonarQG.sh + ./SonarQG.sh ./target/sonar/report-task.txt + + # ✅ Final Job to Ensure Completion + GitHub_CI_Complete: + needs: [processors_ci] + if: always() + runs-on: ubuntu-latest + steps: + - name: Check Job Status + run: | + if [[ "${{ needs.processors_ci.result }}" == "failure" || \ + "${{ needs.processors_ci.result }}" == "cancelled" ]]; then + echo "❌ One or more jobs failed or were cancelled. Failing CI." + exit 1 + else + echo "✅ All relevant jobs have passed." + fi \ No newline at end of file diff --git a/SonarQG.sh b/SonarQG.sh new file mode 100644 index 000000000..b4b8bd779 --- /dev/null +++ b/SonarQG.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# this script checks the status of a quality gate for a particular analysisID +# approach taken from https://docs.sonarqube.org/display/SONARQUBE53/Breaking+the+CI+Build +# When SonarScanner executes, the compute engine task is given an id +# The status of this task, and analysisId for the task can be checked at +# /api/ce/task?id=taskid +# When the status is SUCCESS, the quality gate status can be checked at +# /api/qualitygates/project_status?analysisId=analysisId +#set errexit +#set pipefail +#set nounset + +# in newer versions of sonar scanner the default report-task.txt location may be different +#REPORT_PATH="./customapi/target/sonar/report-task.txt" +#REPORT_PATH=".sonar/report-task.txt" +CE_TASK_ID_KEY="ceTaskId=" + +#SONAR_ACCESS_TOKEN="9000" +SLEEP_TIME=5 + +echo "QG Script --> Using SonarQube instance ${sonarurl}" + +# get the compute engine task id +ce_task_id=$(cat $1 | grep $CE_TASK_ID_KEY | cut -d'=' -f2) +echo "QG Script --> Using task id of ${ce_task_id}" + +if [ -z "$ce_task_id" ]; then + echo "QG Script --> No task id found" + exit 1 +fi + +# grab the status of the task +# if CANCELLED or FAILED, fail the Build +# if SUCCESS, stop waiting and grab the analysisId +wait_for_success=true + +while [ "${wait_for_success}" = "true" ] +do + ce_status=$(curl --user ${sonartoken}: ${sonarurl}/api/ce/task?id="${ce_task_id}" | jq -r .task.status) + + echo "QG Script --> Status of SonarQube task is ${ce_status}" + + if [ "${ce_status}" = "CANCELLED" ]; then + echo "QG Script --> SonarQube Compute job has been cancelled - exiting with error" + exit 1 + fi + + if [ "${ce_status}" = "FAILED" ]; then + echo "QG Script --> SonarQube Compute job has failed - exiting with error" + exit 1 + fi + + if [ "${ce_status}" = "SUCCESS" ]; then + wait_for_success=false + fi + + sleep 10 + +done + +ce_analysis_id=$(curl --user ${sonartoken}: ${sonarurl}/api/ce/task?id=$ce_task_id | jq -r .task.analysisId) +echo "QG Script --> Using analysis id of ${ce_analysis_id}" + +# get the status of the quality gate for this analysisId +qg_status=$(curl --user ${sonartoken}: ${sonarurl}/api/qualitygates/project_status?analysisId="${ce_analysis_id}" | jq -r .projectStatus.status) +echo "QG Script --> Quality Gate status is ${qg_status}" + +if [ "${qg_status}" != "OK" ]; then + echo "Pipeline aborted due to quality gate failure" + exit 1 +fi diff --git a/argocd/pom.xml b/argocd/pom.xml index 058475fa0..08f32173a 100644 --- a/argocd/pom.xml +++ b/argocd/pom.xml @@ -55,7 +55,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} org.projectlombok diff --git a/azure-boards/pom.xml b/azure-boards/pom.xml index 7fadad9b9..467e9eb13 100644 --- a/azure-boards/pom.xml +++ b/azure-boards/pom.xml @@ -57,7 +57,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} compile diff --git a/azure-pipeline/pom.xml b/azure-pipeline/pom.xml index b19fa2739..38e6d23b9 100644 --- a/azure-pipeline/pom.xml +++ b/azure-pipeline/pom.xml @@ -59,7 +59,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/azure-repo/pom.xml b/azure-repo/pom.xml index a2b571b3f..5f5746dd8 100644 --- a/azure-repo/pom.xml +++ b/azure-repo/pom.xml @@ -50,7 +50,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/bamboo/pom.xml b/bamboo/pom.xml index 684059348..81b5bc24b 100644 --- a/bamboo/pom.xml +++ b/bamboo/pom.xml @@ -61,7 +61,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/bitbucket/pom.xml b/bitbucket/pom.xml index 68533a0b7..4727f1fbe 100644 --- a/bitbucket/pom.xml +++ b/bitbucket/pom.xml @@ -57,7 +57,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/github-action/pom.xml b/github-action/pom.xml index a2e36a43b..31f64044c 100644 --- a/github-action/pom.xml +++ b/github-action/pom.xml @@ -55,7 +55,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/github/pom.xml b/github/pom.xml index d2624a40f..15cebc9dd 100644 --- a/github/pom.xml +++ b/github/pom.xml @@ -55,7 +55,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/gitlab/pom.xml b/gitlab/pom.xml index f7cac32a6..a5fdf2b92 100644 --- a/gitlab/pom.xml +++ b/gitlab/pom.xml @@ -56,7 +56,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/jenkins/pom.xml b/jenkins/pom.xml index f80dff70e..5abea7001 100644 --- a/jenkins/pom.xml +++ b/jenkins/pom.xml @@ -51,7 +51,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/jira-xray-zephyr-squad/pom.xml b/jira-xray-zephyr-squad/pom.xml index 302ec4fe6..9ade26dc7 100644 --- a/jira-xray-zephyr-squad/pom.xml +++ b/jira-xray-zephyr-squad/pom.xml @@ -63,7 +63,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} compile diff --git a/jira-zephyr-scale/pom.xml b/jira-zephyr-scale/pom.xml index 1db787eaa..fd86e841e 100644 --- a/jira-zephyr-scale/pom.xml +++ b/jira-zephyr-scale/pom.xml @@ -56,7 +56,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/jira/pom.xml b/jira/pom.xml index 1f96ef5bf..cf28d20bf 100644 --- a/jira/pom.xml +++ b/jira/pom.xml @@ -93,7 +93,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} compile diff --git a/sonar/pom.xml b/sonar/pom.xml index 3c380bb77..f9a3b59e7 100644 --- a/sonar/pom.xml +++ b/sonar/pom.xml @@ -55,7 +55,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback diff --git a/teamcity/pom.xml b/teamcity/pom.xml index 84cfc9957..f68191f7c 100644 --- a/teamcity/pom.xml +++ b/teamcity/pom.xml @@ -72,7 +72,7 @@ com.publicissapient.kpidashboard common - ${project.version} + ${common.version} ch.qos.logback