Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use post-entrypoint script to run cleanup tasks #33

Conversation

bsvobodny
Copy link
Contributor

This contribution is made to fix the issue #31.

We are using the post-entrypoint property of the docker github action to run the cleanup and but set the right permissions to all workspace file.

In this case if the scan action fails or is cancelled, the post-action will run and set the right permissions to all files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bsvobodny.

Thank you very much for your contribution! I just have 1 small nitpick, and we must update the tests to take this new script into consideration. Could you please update 🙏 ? Let me know if you need any help.

FYI, I've opened a ticket to track this on our side: https://jira.sonarsource.com/browse/SQSCANGHA-3

Comment on lines -30 to -33
_tmp_file=$(ls "${INPUT_PROJECTBASEDIR}/" | head -1)
PERM=$(stat -c "%u:%g" "${INPUT_PROJECTBASEDIR}/$_tmp_file")

chown -R $PERM "${INPUT_PROJECTBASEDIR}/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail the tests, because right now it doesn't take into account the fact it should run a "post entrypoint" script. Could you add the following line after line 93 here (i.e., after the existing docker run command):

docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env INPUT_PROJECTBASEDIR=/github/workspace --entrypoint /cleanup.sh sonarsource/sonarqube-scan-action

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was not able to run the tests locally (I'm on macos... ), that's why I wanted to run the qa worklfow manually.
I will add this line to the run-qa.shfile

bsvobodny and others added 2 commits July 5, 2022 08:53
Co-authored-by: Wouter Admiraal <45544358+wouter-admiraal-sonarsource@users.noreply.github.com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Thank you very much for your contribution!

@wouter-admiraal-sonarsource wouter-admiraal-sonarsource merged commit fd81514 into SonarSource:master Jul 5, 2022
@bsvobodny bsvobodny deleted the use-post-entrypoint-script-in-action branch July 6, 2022 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants