@@ -42,34 +42,36 @@ pipeline:
4242 spec :
4343 shell : Sh
4444 command : |-
45- curl -u <+secrets.getValue('sonarqube_token')>: -s "https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}"
45+ # Get SonarQube quality gate status
46+ curl -u <+secrets.getValue("sonarqube_token")>: \
47+ -s "https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}"
4648
47- curl -u <+secrets.getValue('sonarqube_token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status
49+ curl -u <+secrets.getValue('sonarqube_token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status
4850
49- QUALITY_GATE_STATUS=$(curl -u <+secrets.getValue('sonarqube_token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status)
51+ QUALITY_GATE_STATUS=$(curl -u <+secrets.getValue('sonarqube_token')>: -s 'https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=${<+codebase.prNumber>}' | jq -r .projectStatus.status)
5052
51- echo "QUALITY_GATE_STATUS: $QUALITY_GATE_STATUS"
53+ echo "QUALITY_GATE_STATUS: $QUALITY_GATE_STATUS"
5254
53- # Set GitHub status based on quality gate
54- if [ "$QUALITY_GATE_STATUS" = "OK" ]; then
55- STATE="success"
56- DESCRIPTION="SonarQube Quality Gate passed"
57- else
58- STATE="failure"
59- DESCRIPTION="SonarQube Quality Gate failed"
60- fi
55+ # Set GitHub status based on quality gate
56+ if [ "$QUALITY_GATE_STATUS" = "OK" ]; then
57+ STATE="success"
58+ DESCRIPTION="SonarQube Quality Gate passed"
59+ else
60+ STATE="failure"
61+ DESCRIPTION="SonarQube Quality Gate failed"
62+ fi
6163
62- # Post status to GitHub
63- curl -X POST \
64- -H "Authorization: token ${<+secrets.getValue('github_token')>}" \
65- -H "Content-Type: application/json" \
66- -d "{
67- \"state\": \"$STATE\",
68- \"description\": \"$DESCRIPTION\",
69- \"context\": \"sonarqube/qualitygate\",
70- \"target_url\": \"https://sonar.harness.io/dashboard?id=python-client&pullRequest=${<+codebase.prNumber>}\"
71- }" \
72- "https://api.github.com/repos/splitio/python-client/statuses/<+codebase.commitSha>"
64+ # Post status to GitHub
65+ curl -X POST \
66+ -H "Authorization: token ${<+secrets.getValue('github_token')>}" \
67+ -H "Content-Type: application/json" \
68+ -d "{
69+ \"state\": \"$STATE\",
70+ \"description\": \"$DESCRIPTION\",
71+ \"context\": \"sonarqube/qualitygate\",
72+ \"target_url\": \"https://sonar.harness.io/dashboard?id=python-client&pullRequest=${<+codebase.prNumber>}\"
73+ }" \
74+ "https://api.github.com/repos/splitio/python-client/statuses/<+codebase.commitSha>"
7375 - step :
7476 type : Run
7577 name : Install and Run SonarQube Scanner
0 commit comments