mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-16 19:08:28 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
69305c0e2c
7 changed files with 46 additions and 6 deletions
2
.github/workflows/qa.yml
vendored
2
.github/workflows/qa.yml
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
name: QA
|
name: QA
|
||||||
|
|
||||||
on: push
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run_qa:
|
run_qa:
|
||||||
|
|
|
||||||
32
.github/workflows/update-tags.yml
vendored
Normal file
32
.github/workflows/update-tags.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: Update Tags
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*.*.*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Parse semver
|
||||||
|
uses: madhead/semver-utils@v2
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
version: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: Update tags
|
||||||
|
run: |
|
||||||
|
TAGS='v${{ steps.version.outputs.major }} v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}'
|
||||||
|
|
||||||
|
for t in $TAGS; do
|
||||||
|
git tag -f "$t"
|
||||||
|
git push origin ":$t" 2>/dev/null || true
|
||||||
|
git push origin "$t"
|
||||||
|
done
|
||||||
|
|
@ -79,5 +79,6 @@ RUN apk add --no-cache \
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN dos2unix /entrypoint.sh
|
RUN dos2unix /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
COPY cleanup.sh /cleanup.sh
|
||||||
|
RUN chmod +x /cleanup.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ branding:
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
image: Dockerfile
|
image: Dockerfile
|
||||||
|
entrypoint: "/entrypoint.sh"
|
||||||
|
post-entrypoint: "/cleanup.sh"
|
||||||
inputs:
|
inputs:
|
||||||
args:
|
args:
|
||||||
description: Additional arguments to the sonar-scanner
|
description: Additional arguments to the sonar-scanner
|
||||||
|
|
|
||||||
8
cleanup.sh
Executable file
8
cleanup.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
_tmp_file=$(ls "${INPUT_PROJECTBASEDIR}/" | head -1)
|
||||||
|
PERM=$(stat -c "%u:%g" "${INPUT_PROJECTBASEDIR}/$_tmp_file")
|
||||||
|
|
||||||
|
chown -R $PERM "${INPUT_PROJECTBASEDIR}/"
|
||||||
|
|
@ -33,7 +33,3 @@ fi
|
||||||
|
|
||||||
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} ${INPUT_ARGS}
|
||||||
|
|
||||||
_tmp_file=$(ls "${INPUT_PROJECTBASEDIR}/" | head -1)
|
|
||||||
PERM=$(stat -c "%u:%g" "${INPUT_PROJECTBASEDIR}/$_tmp_file")
|
|
||||||
|
|
||||||
chown -R $PERM "${INPUT_PROJECTBASEDIR}/"
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ success "Correctly failed fast."
|
||||||
info "Analyze project..."
|
info "Analyze project..."
|
||||||
cd test/example-project/
|
cd test/example-project/
|
||||||
docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env INPUT_PROJECTBASEDIR=/github/workspace --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action
|
docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env INPUT_PROJECTBASEDIR=/github/workspace --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action
|
||||||
|
docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env INPUT_PROJECTBASEDIR=/github/workspace --entrypoint /cleanup.sh sonarsource/sonarqube-scan-action
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
error "Couldn't run the analysis."
|
error "Couldn't run the analysis."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue