diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index febfe33..0e2e91e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -103,6 +103,13 @@ definitions: password: $PIPELINES_JWT_TOKEN script: - atlas-mvn verify sonar:sonar -Dsonar.projectKey=msteams-jira-onprem-addon -Pcoverage + - | + ENCODED_BRANCH=$(echo "$BITBUCKET_BRANCH" | jq -sRr @uri) + STATUS=$(curl -s -u $SONAR_TOKEN: "https://sonar-enterprise.internal.atlassian.com/api/qualitygates/project_status?projectKey=msteams-jira-onprem-addon&branch=$ENCODED_BRANCH" | jq -r .projectStatus.status) + if [ "$STATUS" != "OK" ]; then + echo "Quality gate failed: https://sonar-enterprise.internal.atlassian.com/dashboard?branch=$ENCODED_BRANCH&id=msteams-jira-onprem-addon" + exit 1 + fi pipelines: default: - step: diff --git a/docker/Dockerfile b/docker/Dockerfile index 42e194f..2afe332 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,6 +18,9 @@ RUN apt-get install -y powershell # 8. Start PowerShell RUN pwsh +# Install jq command for processing JSON files +RUN apt-get -y install jq + # Install xmlstarlet command to edit XML files RUN apt-get -y install xmlstarlet