forked from onivim/oni2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestore-build-cache.yml
49 lines (44 loc) · 1.95 KB
/
restore-build-cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Steps for restoring project cache
steps:
- task: DownloadBuildArtifacts@0
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Restore install'
inputs:
buildType: 'specific'
project: '$(System.TeamProject)'
pipeline: '$(Build.DefinitionName)'
branchName: 'refs/heads/master'
buildVersionToDownload: 'latestFromBranch'
downloadType: 'single'
artifactName: '$(CACHE_ARTIFACT_NAME)'
downloadPath: '$(STAGING_DIRECTORY)'
allowPartiallySucceededBuilds: true
continueOnError: true
- bash: 'mkdir -p $(ESY__CACHE_INSTALL_PATH)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Create cache directory'
# - bash: 'cd $(ESY__NPM_ROOT) && tar -xf $(STAGING_DIRECTORY)/$(CACHE_ARTIFACT_NAME)/npm-cache.tar -C .'
# continueOnError: true
# condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
# displayName: '[Cache][Restore] Untar npm cache directory'
- bash: |
cd $(ESY__CACHE_INSTALL_PATH)
pwd
STDIR=$STAGING_DIRECTORY
if [ "$AGENT_OS" == "Windows_NT" ]; then
STDIR=$( cygpath --unix --absolute "$STAGING_DIRECTORY")
fi
echo "ESY__CACHE_INSTALL_PATH: $ESY__CACHE_INSTALL_PATH"
echo "STDIR: $STDIR"
ls "$STDIR"
echo "ls: $STDIR/$CACHE_ARTIFACT_NAME"
ls "$STDIR/$CACHE_ARTIFACT_NAME"
tar -xf "$STDIR/$CACHE_ARTIFACT_NAME/esy-cache.tar" -C .
continueOnError: true
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Untar esy cache directory'
- bash: 'rm -rf *'
continueOnError: true
workingDirectory: '$(STAGING_DIRECTORY)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: '[Cache][Restore] Clean up'