File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- echo " Cloning CLI repo "
3+ echo " Starting CLI build process "
44cd ~
55# If the CLI repo doesn't exist (due to caching), clone it
6- if [ ! -d " ~/ cli" ]; then
6+ if [ ! -d " cli" ]; then
77 echo " Cloning CLI repo"
88 git clone https://github.com/snyk/cli.git
99else
Original file line number Diff line number Diff line change @@ -204,19 +204,21 @@ jobs:
204204 command : echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ../.npmrc
205205 - run :
206206 name : Get latest CLI commit hash
207+ # We can't use the CLI_COMMIT_HASH environment variable directly
208+ # But we can write it to a file and use that to restore the cache
207209 command : |
208210 CLI_COMMIT_HASH=$(git ls-remote https://github.com/snyk/cli.git main | cut -f1)
209- echo "export CLI_COMMIT_HASH= $CLI_COMMIT_HASH" >> $BASH_ENV
210- source $BASH_ENV
211+ echo "CLI_COMMIT_HASH: $CLI_COMMIT_HASH"
212+ echo $CLI_COMMIT_HASH >> /tmp/cli-version
211213 - restore_cache :
212214 keys :
213- - v1-cli-repo-{{ .Environment.CLI_COMMIT_HASH }}
215+ - v1-cli-repo-{{ checksum "/tmp/cli-version" }}
214216 - v1-cli-repo-
215217 - run :
216218 name : Build Snyk CLI with latest changes
217219 command : ./.circleci/build-cli.sh
218220 - save_cache :
219- key : v1-cli-repo-{{ .Environment.CLI_COMMIT_HASH }}
221+ key : v1-cli-repo-{{ checksum "/tmp/cli-version" }}
220222 paths :
221223 - ~/cli
222224 build_and_test_latest_go_binary :
You can’t perform that action at this time.
0 commit comments