Skip to content

Ensure git clean state after running license_finder

What does this MR do and why?

Ensure git clean state after running license_finder

Our script for validating licenses does not restore a clean git state because the whole script scripts/license-check.sh is marked as set -e which means if any command fails with a non-zero exit code the script terminates its execution. The failing scenario is:

  1. We start license-check.sh script which modifies Gemfile.lock due to a workaround described inside the script.
  2. Then we run license_finder gem.
  3. If it exits with a non-zero status code then the next command git checkout -q will never execute.

The simplest solution to resolve that failing scenario is to capture the exit code of license_finder gem, store it, restore the git clean state and exit with this exit code.

Please see this CI job for an example.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vitaly Slobodin

Merge request reports