For a number of projects I work on I pull in third party tools.
Sometimes they’re straight copies - that’s what I inherited in some
PHP projects I work on. But in others I use
to pull them in.
However there’s a problem. I need a way to remind myself to check
for updates. And generally I like things related to a project to
live in the project. For my home projects I use
Gitlab and their
The config for which lives in my repo. So why not have the CI system
check if the code is out of date?
First step is to script the updates. I have a repo where I store
all my machine configuration which uses three third-party repos.
The script to update it,
$git subtree pull -P roles/src/files/usr/local/src/cvssync \
$git subtree pull -P roles/src/files/usr/local/src/rcsparse \
$git subtree pull -P roles/src/files/usr/local/src/cvs2gitdump \
date '+%s' > scripts/.update-3rd-party-src.stamp
This will pull down all changes in these repos and then update a
stamp file with the current time. Usually stamp files use the file
meta-data to track times, but git doesn’t maintain most file meta-data
so the time tracking needs to be a bit more explicit.
All that’s left to do now is have Gitlab’s CI check the stamp file.
.gitlab-ci.yml file this snippet exists:
And inside that script is this snippet:
# Check 3rd party sources have been updated recently (last 6 months).
if [ $(( $(date +%s) - $(cat scripts/.update-3rd-party-src.stamp) )) \
-gt $(( 6 * 30 * 60 * 60 )) ]; then
echo "Need to run ./scripts/update-3rd-party-src again."
Now updates are tracked more explicitly in the tree and, due to
that, reminders can be driven by the tree. Since the CI system
actually manages the deployment and not just testing, this guarantees
every six months I’ll at least give a little thought to updating
the tools I’m using.