Skip to content

Commit fe09064

Browse files
committed
refactor conda caching and specify cache folder
1 parent d80be72 commit fe09064

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

pipeline.yaml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ parameters:
5353

5454
variables:
5555
runTests: True
56-
CONDA_CACHE_DIR: /usr/share/miniconda/envs
56+
CONDA_ENV: synapseml
57+
CONDA_CACHE_DIR: /usr/share/miniconda/envs/$(CONDA_ENV)/
5758
ComponentDetection.Timeout: 900
5859
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
5960

@@ -253,6 +254,7 @@ jobs:
253254
cancelTimeoutInMinutes: 0
254255
pool:
255256
vmImage: ubuntu-20.04
257+
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
256258
steps:
257259
- template: templates/checkout.yml
258260
- template: templates/update_cli.yml
@@ -264,9 +266,7 @@ jobs:
264266
wget https://github.com/git-chglog/git-chglog/releases/download/0.8.0/git-chglog_linux_amd64
265267
chmod +x git-chglog_linux_amd64
266268
./git-chglog_linux_amd64 -o CHANGELOG.md $TAG
267-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
268269
- task: GitHubRelease@0
269-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
270270
inputs:
271271
gitHubConnection: 'MMLSpark Github'
272272
repositoryName: '$(Build.Repository.Name)'
@@ -275,36 +275,15 @@ jobs:
275275
tagSource: 'auto'
276276
releaseNotesFile: 'CHANGELOG.md'
277277
isDraft: true
278-
- bash: echo "##vso[task.prependpath]$CONDA/bin"
279-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
280-
displayName: Add conda to PATH
281-
- bash: sudo chown -R $(whoami):$(id -ng) $(CONDA_CACHE_DIR)
282-
displayName: Fix directory permissions
283-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
284-
- task: Cache@2
285-
displayName: Use cached Anaconda environment
286-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
287-
inputs:
288-
key: 'conda | "$(Agent.OS)" | environment.yml'
289-
restoreKeys: |
290-
python | "$(Agent.OS)"
291-
python
292-
path: $(CONDA_CACHE_DIR)
293-
cacheHitVar: CONDA_CACHE_RESTORED
294-
- bash: |
295-
conda env create --force -f environment.yml -v
296-
condition: and(eq(variables.isMaster, true), and(startsWith(variables['tag'], 'v'), eq(variables.CONDA_CACHE_RESTORED, 'false')))
297-
displayName: Create Anaconda environment
278+
- template: templates/conda.yml
298279
- task: AzureKeyVault@1
299-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
300280
inputs:
301281
azureSubscription: 'SynapseML Build'
302282
keyVaultName: mmlspark-keys
303283
- bash: |
304284
set -e
305285
source activate synapseml
306286
sbt publishPypi
307-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
308287
env:
309288
STORAGE-KEY: $(storage-key)
310289
NEXUS-UN: $(nexus-un)
@@ -320,7 +299,6 @@ jobs:
320299
source activate synapseml
321300
sbt publishLocalSigned
322301
python tools/esrp/prepare_jar.py
323-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
324302
env:
325303
STORAGE-KEY: $(storage-key)
326304
NEXUS-UN: $(nexus-un)
@@ -350,7 +328,6 @@ jobs:
350328
DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
351329
waitforreleasecompletion: true
352330
displayName: 'ESRP Publish Package'
353-
condition: and(eq(variables.isMaster, true), startsWith(variables['tag'], 'v'))
354331

355332

356333
- job: PythonTests

0 commit comments

Comments
 (0)