I need to cache files in /home/vsts/.cache/torch/.
Is there a predefined variable for the home folder?
I need to cache files in /home/vsts/.cache/torch/.
Is there a predefined variable for the home folder?
No, there is no such variable. You can use one of the /home/vsts/work paths and cache $(System.WorkFolder)/../.cache/torch/.
Values of predefined variables for an Ubuntu agent:
Agent.AcceptTeeEula True
Agent.BuildDirectory /home/vsts/work/1
Agent.HomeDirectory /home/vsts/agents/2.181.2
Agent.Id 32
Agent.JobName Job
Agent.JobStatus Succeeded
Agent.MachineName fv-az160-540
Agent.Name Azure Pipelines 2
Agent.OS Linux
Agent.OSArchitecture X64
Agent.RetainDefaultEncoding false
Agent.ReadOnlyVariables true
Agent.RootDirectory /home/vsts/work
Agent.TempDirectory /home/vsts/work/_temp
Agent.ToolsDirectory /opt/hostedtoolcache
Agent.Version 2.181.2
Agent.WorkFolder /home/vsts/work
Build.ArtifactStagingDirectory /home/vsts/work/1/a
Build.BinariesDirectory /home/vsts/work/1/b
Build.DefinitionName FooBar
Build.SourceBranch refs/heads/FOOBAR-123-caching
Build.SourceVersion 2b2c45223722fc7226eb23d752fc722bcdee2c54
Build.SourcesDirectory /home/vsts/work/1/s
Build.StagingDirectory /home/vsts/work/1/a
Common.TestResultsDirectory /home/vsts/work/1/TestResults
Pipeline.Workspace /home/vsts/work/1
System.AccessToken ***
System.ArtifactsDirectory /home/vsts/work/1/a
System.CollectionId c02d3c7b-9d74-4532-aa21-abccdf07c888
System.Culture en-US
System.DefaultWorkingDirectory /home/vsts/work/1/s
System.DefinitionId 26
System.EnableAccessToken SecretVariable
System.HostType build
System.JobAttempt 1
System.JobId 33f11733-54f2-5aa3-20dd-22fc7dcf5912
System.JobName __default
System.PhaseAttempt 1
System.PhaseDisplayName Job
System.PhaseName Job
System.ServerType Hosted
System.StageAttempt 1
System.StageName __default
System.TeamProject Foo Bar
System.TeamProjectId 3337a4f6-1411-40aa-beeb-0c7d86b9ecba
System.WorkFolder /home/vsts/work
Task.DisplayName print predefined variables
If by "Predefined variables" you mean one of the variables specified in the documentation then no.
However if you are using Hosted Linux Agents you can simply look at the environment variable $HOME, which works at least if you are in a script:, which may or may not fit your use case.
Example:
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- script: echo $HOME
The output of the script task is /home/vsts