From 1ff8cfd24012cfdeea9bd8bcd45b9e8d52077762 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 6 Jan 2024 23:42:59 +0100 Subject: [PATCH] [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. --- .drone.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index 58a8a379..882eb517 100644 --- a/.drone.yml +++ b/.drone.yml @@ -278,7 +278,17 @@ steps: - | [ -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 - | python - <