Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI_CERT_KEY_VERSION environment variable #3640

Merged
merged 3 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ commands:
steps:
- run:
name: Prepare cache key
command: tools/make-certs-cache-key.sh > certs_cache_key
command: tools/make-certs-cache-key.sh > certs_cache_key && cat certs_cache_key
- restore_cache:
name: Restore certificates
key: *CERT_KEY
Expand All @@ -41,6 +41,9 @@ commands:
- run:
name: Print cert hashes for debugging
command: find tools/ssl -type f -exec md5sum {} \; | sort
- run:
name: Continue if certificate exists
command: test -f tools/ssl/mongooseim/key.pem
- save_cache:
name: Cache built certs
key: *CERT_KEY
Expand Down
11 changes: 10 additions & 1 deletion tools/make-certs-cache-key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ week=$(date "+%V")
year=$(date "+%Y")
makefile_sum=$(sha1sum tools/ssl/Makefile | cut -d " " -f1)

echo "${year}-week${num}-${makefile_sum}-1"
# Change it once incompatible changes are made in tools/ssl/ directory
CERT_KEY_VERSION=1

# CI_CERT_KEY_VERSION could be set in
# https://app.circleci.com/settings/project/github/esl/MongooseIM/environment-variables
# It takes integer values 1, 2, 3...
# Change it to invalidate cache without making code changes
# There is no way to see the current value in the Circle CI settings though.
# To get the current value, run a CI job and check the output of the "Prepare cache key" task.
echo "${year}-week${num}-${makefile_sum}-${CERT_KEY_VERSION}-${CI_CERT_KEY_VERSION}"