fix: use post-entrypoint script to run cleanup tasks

This commit is contained in:
Benjamin Svobodny 2022-06-16 10:18:47 -04:00
parent bdba66714e
commit b83926d45e
4 changed files with 12 additions and 4 deletions

View file

@ -12,4 +12,6 @@ LABEL version="1.1.0" \
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY cleanup.sh /cleanup.sh
RUN chmod +x /cleanup.sh
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -7,6 +7,8 @@ branding:
runs:
using: docker
image: Dockerfile
entrypoint: "/entrypoint.sh"
post-entrypoint: "/cleanup.sh"
inputs:
args:
description: Additional arguments to the sonar-scanner

8
cleanup.sh Executable file
View 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}/"

View file

@ -27,7 +27,3 @@ unset JAVA_HOME
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}/"