fix: Use actual container IPs for network communication
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Failing after 2m13s

This commit is contained in:
Hyungi Ahn
2025-07-24 12:29:50 +09:00
parent 501daf7360
commit fc925974bb

View File

@@ -13,31 +13,23 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git clone http://172.17.0.2:3000/${{ gitea.repository }}.git .
fetch-depth: 0
# Docker 네트워크 내에서 접근
repository: ${{ gitea.repository }}
token: ${{ gitea.token }}
- name: Test SonarQube connection - name: Test SonarQube connection
run: | run: |
echo "Testing connection to SonarQube..." echo "Testing connection to SonarQube..."
curl -f http://192.168.1.100:9000/api/system/ping || echo "External connection failed" curl -f http://172.17.0.3:9000/api/system/ping || echo "Connection failed"
- name: Run SonarQube scan - name: Run SonarQube scan
env: env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: | run: |
# Docker 네트워크 확인
docker network ls
# SonarScanner 실행
docker run \ docker run \
--rm \ --rm \
--network gitea_default \ --network bridge \
-e SONAR_HOST_URL="${SONAR_HOST_URL}" \ -e SONAR_HOST_URL="http://172.17.0.3:9000" \
-e SONAR_SCANNER_OPTS="-Dsonar.projectKey=TK-BOM-Project" \ -e SONAR_SCANNER_OPTS="-Dsonar.projectKey=my-project" \
-e SONAR_TOKEN="${SONAR_TOKEN}" \ -e SONAR_TOKEN="${SONAR_TOKEN}" \
-v "${{ github.workspace }}:/usr/src" \ -v "$(pwd):/usr/src" \
sonarsource/sonar-scanner-cli sonarsource/sonar-scanner-cli