Skip to content

Commit a174550

Browse files
ManasJayanthjaredly
authored andcommitted
Calculate ESY__CACHE_INSTALL_PATH. Fixes failing MacOS ci (#354)
1 parent 7ce97bb commit a174550

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

.ci/use-calc-esy-install-path.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
steps:
2+
- bash: |
3+
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
4+
DESIRED_LEN="86"
5+
# Note: This will need to change when upgrading esy version
6+
# that reenables long paths on windows.
7+
if [ "$AGENT_OS" == "Windows_NT" ]; then
8+
DESIRED_LEN="33"
9+
fi
10+
HOME_ESY3="$HOME/.esy/3"
11+
HOME_ESY3_LEN=${#HOME_ESY3}
12+
NUM_UNDERS=$(echo "$(($DESIRED_LEN-$HOME_ESY3_LEN))")
13+
UNDERS=$(printf "%-${NUM_UNDERS}s" "_")
14+
UNDERS="${UNDERS// /_}"
15+
ESY__CACHE_INSTALL_PATH=${HOME_ESY3}${UNDERS}/i
16+
if [ "$AGENT_OS" == "Windows_NT" ]; then
17+
ESY__CACHE_INSTALL_PATH=$( cygpath --mixed --absolute "$ESY__CACHE_INSTALL_PATH")
18+
fi
19+
echo "ESY__CACHE_INSTALL_PATH: $ESY__CACHE_INSTALL_PATH"
20+
# This will be exposed as an env var ESY__CACHE_INSTALL_PATH, or an
21+
# Azure var esy__cache_install_path
22+
echo "##vso[task.setvariable variable=esy__cache_install_path]$ESY__CACHE_INSTALL_PATH"
23+
displayName: "Task.setvariable ESY__CACHE_INSTALL_PATH"
24+
# - bash: |
25+
# which esy
26+
# echo "$( which esy )"
27+
# echo "##vso[task.setvariable variable=esy_bin_location]$(which esy)"
28+
# displayName: "Find esy binary"
29+
# - bash: echo ${ESY_BIN_LOCATION}
30+
# displayName: "Print esy bin location"
31+
- bash: env
32+
displayName: "Print environment"

azure-pipelines.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
variables:
3333
STAGING_DIRECTORY: /Users/vsts/STAGING
3434
STAGING_DIRECTORY_UNIX: /Users/vsts/STAGING
35-
ESY__CACHE_INSTALL_PATH: /Users/vsts/.esy/3____________________________________________________________________/i
3635
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/vsts/.esy/source/i
3736
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy
3837

3938
steps:
39+
- template: .ci/use-calc-esy-install-path.yml
4040
- template: .ci/use-node.yml
4141
- template: .ci/restore-build-cache.yml
4242
- template: .ci/esy-build-steps.yml
@@ -95,4 +95,4 @@ jobs:
9595
# tagSource: manual
9696
# tag: $(Release Tag)
9797
# isDraft: true
98-
# addChangeLog: true
98+
# addChangeLog: true

0 commit comments

Comments
 (0)