How to interact with checksum of cache restored dependency file?

Hi all. Wondering if someone can help me out a bit. Trying to save some time by using multistage docker builds. I will be restoring a cache’d Gemfile.Lock.

From there, I want to use a script that uses an if statement to compare the checksum of the cache’d Gemfile.Lock to the checksum of the checked-out Gemfile.lock. If there’s a difference between the two, then build a new docker image with the new dependencies. If there’s no difference between the two, then this image build doesn’t happen. The job will end by saving the cache with the same naming scheme (which is immutable)

How can I approach something like this? My problem is that I don’t know how to interact with the checksum of the old Gemfile.lock.

Here’s the main part of the code that I’m talking about in the script:

old_gemfile_checksum=`md5sum old/Gemfile.lock`
new_gemfile_checksum=`md5sum current/Gemfile.lock`
if [ "${old_gemfile_checksum}" != "${new_gemfile_checksum}" ]; then

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.