forked from platypush/platypush
[CI/CD] A more robust logic to regenerate components.json.gz
.
We shouldn't rely on `git diff`. Even when the underlying source code hasn't changed, and the cache is dumped with `sort_keys=True`, some of the generated snippets of docstrings may change, leading the CI/CD pipeline to get stuck in a push loop. We should instead look for changes to the plugins, backends, events and schemas folders before and after the CI/CD trigger to infer if we need to regenerate the file.
This commit is contained in:
parent
e803807b8d
commit
1ff8cfd240
1 changed files with 11 additions and 9 deletions
20
.drone.yml
20
.drone.yml
|
@ -278,7 +278,17 @@ steps:
|
||||||
- |
|
- |
|
||||||
[ -f "$SKIPCI" ] && exit 0
|
[ -f "$SKIPCI" ] && exit 0
|
||||||
|
|
||||||
- apk add --update --no-cache $(cat platypush/install/requirements/alpine.txt)
|
# Only regenerate the components cache if either the plugins, backends,
|
||||||
|
# events or schemas folders have some changes (excluding the webapp files).
|
||||||
|
- apk add --update --no-cache git
|
||||||
|
- |
|
||||||
|
if [ -z "$(git log --pretty=oneline $DRONE_COMMIT_AFTER...$DRONE_COMMIT_BEFORE -- platypush/backend platypush/plugins platypush/schemas platypush/message/event ':(exclude)platypush/backend/http/webapp')" ]; then
|
||||||
|
echo 'No changes to the components file'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
- echo 'Updating components cache'
|
||||||
|
- apk add --update --no-cache bash gnupg openssh $(cat platypush/install/requirements/alpine.txt)
|
||||||
- pip install . --break-system-packages
|
- pip install . --break-system-packages
|
||||||
- |
|
- |
|
||||||
python - <<EOF
|
python - <<EOF
|
||||||
|
@ -287,13 +297,6 @@ steps:
|
||||||
get_plugin('inspect').refresh_cache(force=True)
|
get_plugin('inspect').refresh_cache(force=True)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- apk add --update --no-cache git
|
|
||||||
- |
|
|
||||||
if [ -z "$(git status "$CACHEFILE" --porcelain)" ]; then
|
|
||||||
echo 'No changes to the components file'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Backup the original git configuration before changing attributes
|
# Backup the original git configuration before changing attributes
|
||||||
- export GIT_CONF=$PWD/.git/config
|
- export GIT_CONF=$PWD/.git/config
|
||||||
- export TMP_GIT_CONF=/tmp/git.config.orig
|
- export TMP_GIT_CONF=/tmp/git.config.orig
|
||||||
|
@ -304,7 +307,6 @@ steps:
|
||||||
# (we're going to do another push anyway, so another pipeline will be triggered)
|
# (we're going to do another push anyway, so another pipeline will be triggered)
|
||||||
- touch "$SKIPCI"
|
- touch "$SKIPCI"
|
||||||
|
|
||||||
- apk add --update --no-cache bash gnupg openssh
|
|
||||||
- mkdir -p ~/.ssh
|
- mkdir -p ~/.ssh
|
||||||
- |
|
- |
|
||||||
cat <<EOF | gpg --import --armor
|
cat <<EOF | gpg --import --armor
|
||||||
|
|
Loading…
Reference in a new issue