Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global rule:
* @brahmanand1 @spal-sapient @aksshriv1 @shunaray @kunkambl @mampacch @nagendra-battala @Chittauri @gipathak @risshukl0 @ananthpal @manoj-srivastava
104 changes: 104 additions & 0 deletions .github/workflows/Processors_CI_Workflow.yaml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions SonarQG.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion argocd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
2 changes: 1 addition & 1 deletion azure-boards/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down
2 changes: 1 addition & 1 deletion azure-pipeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion azure-repo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion bamboo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion bitbucket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion github-action/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion github/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion gitlab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion jenkins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion jira-xray-zephyr-squad/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down
2 changes: 1 addition & 1 deletion jira-zephyr-scale/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion jira/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down
2 changes: 1 addition & 1 deletion sonar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down
2 changes: 1 addition & 1 deletion teamcity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>com.publicissapient.kpidashboard</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<version>${common.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
Expand Down