drone.io plugin: Checks if changes happened only to a certain subset of repo and signals the result.
1.1K
Source: https://lolg.it/herby/drone-plugin-check-changes.
Checks if changes happened only to a certain subset of the repo and signals the result.
Changes are checked between DRONE_COMMIT_BEFORE and DRONE_COMMIT_AFTER. Drone is buggy and does not set DRONE_COMMIT_BEFORE in many scenarios; there is a workaround that tries to extract it in that case from DRONE_COMMIT_LINK.
You specify subset in which changes must occur using ignore: setting. This should contain array of strings with the .gitignore syntax. Eg. when you want react only to changes in /.drone.yml, /Gruntfile.js and /src/, you put
settings:
ignore:
- /**
- "!/.drone.yml"
- "!/Gruntfile.js"
- "!/src/"
You signal the result, either positive, negative, or both, by specifying thus named (positive:, negative:) settings. These should contain a file name which is not present in the repo normally (e.g. negative: .skip). In case the changes were found in a specified subset, a positive: file is created; in case changes were not found there, a negative: file gets created in the workspace.
In subsequent steps, you filter them according to the result, eg. I do:
commands:
- if [ -f .skip ]; then exit; fi
...
Nice things here is, you can filter plugins as well, simply add
commands:
- if [ -f .skip ]; then exit; fi
- /the/script.sh
and also specify settings:. You must find what is the script a plugin normally runs; docker inspect shows you. In this way, the commands: filter out the negative case, and in positive case they just continue as normally, that is, do the plugin's work.
Content type
Image
Digest
Size
331.7 MB
Last updated
about 7 years ago
docker pull herbysk/drone-plugin-check-changes