Skip to content
代码片段 群组 项目
提交 529429ff 编辑于 作者: Vitaly Slobodin's avatar Vitaly Slobodin 提交者: Jennifer Li
浏览文件

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 of 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.
上级 d2d92a64
No related branches found
No related tags found
无相关合并请求
......@@ -18,6 +18,10 @@ set -euo pipefail
PROJECT_PATH=${1:-`pwd`}
function restore_git_state() {
git checkout -q Gemfile Gemfile.lock
}
echo "Using project path ${PROJECT_PATH}"
GEMFILE_DIFF=`git diff Gemfile Gemfile.lock`
......@@ -27,7 +31,7 @@ if [ ! -z "$GEMFILE_DIFF" ]; then
exit 1
fi
trap restore_git_state EXIT
BUNDLE_DEPLOYMENT=false BUNDLE_FROZEN=false bundle lock --add-platform `ruby -e "puts RUBY_PLATFORM"`
bundle exec license_finder --decisions-file config/dependency_decisions.yml --project-path ${PROJECT_PATH}
git checkout -q Gemfile Gemfile.lock
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册