AzureDevOps|Cache@2-CACHE_RESTOREDalwaysevaluatingtofalse
创始人
2024-09-29 18:00:16
0

在 yml 文件中添加缓存前,请确保在同一步骤中没有任何步骤将使用另一个不同的缓存键。例如,如果你有“Restore NuGet Packages”步骤和一个SetCache步骤,则需要使用相同的键名在同一步骤中使用它们。以下是一个示例:

  • task: PowerShell@2 displayName: Cache PowerShell modules inputs: targetType: 'inline' script: | $modulesFolderPath = '/path/to/powershell/modules'

    if(Test-Path $(Build.SourcesDirectory)/.module_expiration) {
         $timeout = [datetime]::ParseExact((Get-Content $(Build.SourcesDirectory)/.module_expiration), 'yyyyMMddHHmmss', $null) - (Get-Date)
         Write-Host "Using cached PowerShell modules. Cache will timeout in $($timeout.ToString())."
         if($timeout.TotalMinutes -le 0) {
               Write-Host "Cache has timed out. Discarding cache."
         } else {
               Write-Host "Cache still valid. Skipping module restore."
               Write-Host "##vso[task.setvariable variable=MODULES_FOLDER_PATH]$($modulesFolderPath)" #Set variable for downstream tasks.
               exit 0
         }
    } 
    
    Write-Host "No cached PowerShell modules found. Restoring..."
    # Restore modules here...
    
    # Set cache for downstream jobs.
    Write-Host "##vso[task.setvariable variable=CACHE_SCREAM_MODULE]true"
    Write-Host "##vso[task.setvariable variable=MODULES_FOLDER_PATH]$($modulesFolderPath)"
    
  • task: Cache@2 displayName: Cache PowerShell modules folder inputs: key: 'powershellmodules | "$(BUILD.SOURCEVERSION)"' path: '$(MODULES_FOLDER_PATH)'

相关内容

热门资讯

重要通知!竞技联盟透视,红龙p... 重要通知!竞技联盟透视,红龙poker辅助平台,力荐教程(有挂技巧)1、点击下载安装,微扑克wpk插...
透视最新!wepoker免费脚... 透视最新!wepoker免费脚本咨询(透视)真是有挂(详细辅助2025版教程)1、任何ai辅助神器的...
六分钟了解!aapoker怎么... 此外,数据分析德州(aapoker怎么开辅助器)辅助神器app还具备辅助透视行为开挂功能,通过对客户...
透视app!wepoker有透... 透视app!wepoker有透视功能吗(透视)其实真的是有挂(详细辅助力荐教程);1、透视app!w...
今日百科!wepoker软件靠... 今日百科!wepoker软件靠谱么,wepoker私人局辅助器怎么用,教你攻略(有挂辅助)科技教程也...
透视玄学!wepoker到底有... 透视玄学!wepoker到底有没有透视(透视)都是真的有挂(详细辅助玩家教你);1、每一步都需要思考...
实测分享!hhpoker德州挂... 实测分享!hhpoker德州挂真的有吗,wepoker免费透视,切实教程(有挂透视)准备好在hhpo...
透视游戏!拱趴大菠萝开挂方法(... 透视游戏!拱趴大菠萝开挂方法(透视)一直存在有挂(详细辅助wpk教程)1、ai机器人多个强度级别选择...
玩家攻略推荐!拱趴大菠萝作弊方... 玩家攻略推荐!拱趴大菠萝作弊方法,拱趴大菠萝挂,技巧教程(有挂神器)是一款可以让一直输的玩家,快速成...
透视能赢!pokemomo辅助... 透视能赢!pokemomo辅助软件(透视)总是有挂(详细辅助德州教程);1、首先打开最新版本,在首页...