First, understand the need of this automation In the process of CI/CD, we don't always need to build all the files. The blind pipelines just process/build everything and eats up time, cicd runtime etc. So I
TLDR:
- make hash of a file and store it as a file.
- make hash of the updated file, compare with the old one.
- and do whatever you wish to do.
This is where I am making an atttempt to make hash of a file, then store that into another file. While in the process of building, a new hash is created and compared, if any change is detected the file is taken to build and the hash file is updated, else it moves on.
And the process continues.
-
macOS ->
brew install md5sha1sum
-
Linux ->
sudo apt install -y ucommon-utils
-
Check if installation complete (should return a path) -
which md5sum
- put your file in the
src
directory. Example fileapp.py
. Change the name according to your need, don't forget to change in the shell scriptfile
variable.file="../src/app.py" # change the file name according to your need
- go to the
scripts
directory and run -change_detector.sh
references: superuser, devconnected, javatpoint.
(C) Ashraf Minhaj