File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
.harness/orgs/PROD/projects/Harness_Split/pipelines Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,38 @@ pipeline:
5252 access_token : <+secrets.getValue("sonarqube-token")>
5353 domain : https://sonar.harness.io/
5454 ssl : true
55+ - step :
56+ type : Run
57+ name : Post Quality Gate to GitHub
58+ identifier : Post_Quality_Gate_to_GitHub
59+ spec :
60+ shell : Sh
61+ command : |-
62+ # Get SonarQube quality gate status
63+ QUALITY_GATE_STATUS=$(curl -s -u <+secrets.getValue("sonarqube_token")>: \
64+ "https://sonar.harness.io/api/qualitygates/project_status?projectKey=python-client&pullRequest=<+codebase.prNumber>" \
65+ | jq -r '.projectStatus.status')
66+
67+ # Set GitHub status based on quality gate
68+ if [ "$QUALITY_GATE_STATUS" = "OK" ]; then
69+ STATE="success"
70+ DESCRIPTION="SonarQube Quality Gate passed"
71+ else
72+ STATE="failure"
73+ DESCRIPTION="SonarQube Quality Gate failed"
74+ fi
75+
76+ # Post status to GitHub
77+ curl -X POST \
78+ -H "Authorization: token <+secrets.getValue("github_token")>" \
79+ -H "Content-Type: application/json" \
80+ -d "{
81+ \"state\": \"$STATE\",
82+ \"description\": \"$DESCRIPTION\",
83+ \"context\": \"sonarqube/qualitygate\",
84+ \"target_url\": \"https://sonar.harness.io/dashboard?id=python-client&pullRequest=<+codebase.prNumber>\"
85+ }" \
86+ "https://api.github.com/repos/splitio/python-client/statuses/<+codebase.commitSha>"
5587 - step :
5688 timeout : 30m
5789 type : Test
You can’t perform that action at this time.
0 commit comments