Skip to content

Instantly share code, notes, and snippets.

@fvosberg
Created March 10, 2020 08:09
Show Gist options
  • Save fvosberg/958d7be3254148a1b45e63c351e8d404 to your computer and use it in GitHub Desktop.
Save fvosberg/958d7be3254148a1b45e63c351e8d404 to your computer and use it in GitHub Desktop.
.gitlab-ci GIT submodule check
variables:
GIT_SUBMODULE_STRATEGY: recursive
check_submodule_updates:
stage: test
# a warning is sufficient for this check, it should not prevent a deployment
allow_failure: true
script:
- cd path-to-submodule
- git fetch origin
- |
if [ "$(git log origin/master ^HEAD)" != "" ]; then
echo -e "\nNew git commits for submodule\n\nPlease update with\n\ncd path-to-submodule\ngit pull origin master\ncd ../../\ngit commit -am '[TASK] update submodule'\n\nMissing commits:\n"
git log origin/master ^HEAD
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment