Skip to content

Commit f1d2e89

Browse files
authored
Integrate SonarQube analysis and retrieve secrets
Add SonarQube analysis step with Vault integration
1 parent 7becf45 commit f1d2e89

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/build-pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@ jobs:
6060
VERSION=$(git rev-parse --short=8 HEAD)
6161
echo "Commit SHA is $VERSION"
6262
echo "tag=$VERSION" >> $GITHUB_OUTPUT
63+
64+
- name: 'Retrieve Sonar Variables from Vault'
65+
id: vault_auth
66+
uses: hashicorp/vault-action@v3
67+
with:
68+
# Uses the GitHub Repository Secret
69+
url: https://vault.ennogelhaus.de
70+
71+
# Use the JWT method with the OIDC token
72+
method: jwt
73+
path: jwt # Matches the path enabled in Vault (Step 5)
74+
role: postiz-ci # Matches the role name created in Vault (Step 6)
75+
76+
# Define the secret path and expose the value as an environment variable
77+
secrets: |
78+
postiz/ci/sonar SONAR_TOKEN | env
79+
postiz/ci/sonar SONAR_HOST_URL | env
6380
6481
- name: SonarQube Analysis (Pull Request)
6582
uses: SonarSource/sonarqube-scan-action@v6
83+
env:
84+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
85+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
6686
with:
6787
args: >
6888
-Dsonar.projectVersion=${{ steps.get_version.outputs.tag }}

0 commit comments

Comments
 (0)