Skip to content

Adds caching functionality #86

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

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Adds caching functionality #86

wants to merge 37 commits into from

Conversation

tsharmaMW
Copy link
Member

  • Adds a new cache parameter in install step, which caches MATLAB and matlab-batch in ~/matlab-ci/matlab_root and ~/matlab_ci/matlab-batch directories, respectively.
  • By default, this parameter is set to false.
  • The cache key includes architecture details and a checksum of the install-metadata.txt file, which contains the parsed release information and a sorted list of user-specified products.

Demo job runs - cache it with circleCI

Copy link
Member

@mcafaro mcafaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!

name: Verify files exist in cache
command: |
set -e
matlab_binary="$HOME/matlab_ci/matlab_root"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like the matlab root not the binary?

RESOLVE_RELEASE_SH: <<include(scripts/resolve-release.sh)>>
command: |
eval "$RESOLVE_RELEASE_SH"
echo "$mpmrelease" > install-metadata.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this writing install-metadata.txt into the user's working directory (where their source code is)? If so, we probably want to put it somewhere else. I think it would be pretty unexpected for the orb to drop files in your source root and more likely for the user to delete or mess with them.

mpmdir="$tmpdir/mpm"
matlabcidir="$HOME/matlab_ci"
mkdir -p "$matlabcidir"
rootdir="$matlabcidir/matlab_root"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's technically possible for a user to use matlab/install twice in their pipeline to install two different releases of MATLAB, so we probably need to consider getting the release name in this path. Any reason not to install to the standard /usr/local/MATLAB/<release> location used by mpm?

${releasestatus} \
--products ${PARAM_PRODUCTS} MATLAB
# Short-circuit if MATLAB & matlab-batch already exist and PARAM_CACHE is true
if [[ "$PARAM_CACHE" == "1" && -x "$batchdir/matlab-batch$binext" && -x "$rootdir/bin/matlab" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't cache matlab-batch because it is important that we always make sure we're using the latest version of it. It's a fairly small binary, so just downloading it every time isn't bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants