azure - 获取 Azure DevOps 管道中的具体任务版本

标签 azure azure-devops azure-pipelines azure-data-factory

这是我的任务代码:

- task: PublishADFTask@1
  displayName: 'Publish Datafactory'
  inputs:
       // inputs there

但是最新的1.*版本有一个错误。

这是在 azure devops yaml 管道中使用先前任务版本的方法吗?

我尝试过:

- task: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8fdffaede3e6fce7cecbc9dbeefce4cfbea1bdb8a1bebcbeba" rel="noreferrer noopener nofollow">[email protected]</a>
  displayName: 'Publish Datafactory'
  inputs:
       // inputs there

但是没用

最佳答案

只要组织中安装了旧版本,就应该可以使用。如果需要,您可以使用 tfx 构建任务上传或 powershell 脚本将旧版本强制上传到组织中。如果有人卸载并重新安装扩展以尝试解决问题,旧版本可能会丢失。

要上传旧版本的任务,首先请确保您拥有已知良好的任务版本的 zip 文件或包含该任务的可用文件夹,然后运行:

# use node 16 or better
npm install -g tfx-cli

# for an extracted task folder
tfx build tasks upload --task-path .\1.27.1315

# for a zipped up task
tfx build tasks upload --task-zip-path .\mytask.zip

或使用此 PowerShell 代码段:

"Installing task '$($Task.Name)' version '$($Task.Version)' id '$($Task.Id)'."
$url = "$($CollectionUrl.TrimEnd('/'))/_apis/distributedtask/tasks/$($Task.Id)/?overwrite=false&api-version=2.0"

[byte[]]$bytes = [System.IO.File]::ReadAllBytes((Get-Item -LiteralPath $TaskZip).FullName)

Invoke-RestMethod -Uri $url -Method Put -Body $bytes -UseDefaultCredentials -ContentType 'application/octet-stream' -Headers @{
    'Authorization' = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$Pat")))"
    'X-TFS-FedAuthRedirect' = 'Suppress'
    'Content-Range' = "bytes 0-$($bytes.Length - 1)/$($bytes.Length)"
}

I have the whole process laid out in a blog post .

如果需要,请直接从 Azure DevOps Marketplace 下载旧版本的任务。以下命令应将所有可用版本转储到输出。 F找到所需的版本并查找 Microsoft.VisualStudio.Services.VSIXPackage 类型的资源以获取旧版本扩展的下载 URL:

tfx extension show --publisher SQLPlayer --extension-id DataFactoryTools

{
    "publisher": {
        "publisherId": "6e2d04c5-e827-4358-a426-97b85f170d67",
        "publisherName": "SQLPlayer",
        "displayName": "AzurePlayer",
        "flags": 2,
        "domain": "https://sqlplayer.net",
        "isDomainVerified": true
    },
    "extensionId": "d729bc25-03da-47fb-8b04-7cdc6f15df0e",
    "extensionName": "DataFactoryTools",
    "displayName": "Deploy Azure Data Factory (#adftools)",
    "flags": 260,
    "lastUpdated": "2023-05-16T22:39:13.940Z",
    "publishedDate": "2020-05-11T22:03:16.563Z",
    "releaseDate": "2020-05-27T01:18:46.197Z",
    "shortDescription": "Tools for deploying entire ADF code (JSON files) to ADF instance",
    "versions": [
        {
            "version": "1.29.1369",
            "flags": 1,
            "lastUpdated": "2023-05-16T22:39:13.940Z",
            "files": [

                ...

                {
                    "assetType": "Microsoft.VisualStudio.Services.VSIXPackage",
                    "source": "https://sqlplayer.gallerycdn.vsassets.io/extensions/sqlplayer/datafactorytools/1.29.1369/1684276472780/Microsoft.VisualStudio.Services.VSIXPackage"
                }
            ]
        }
...

或者尝试查看 Azure Pipelines Agent 的 _tasks 文件夹(如果仍缓存旧版本):

enter image description here

关于azure - 获取 Azure DevOps 管道中的具体任务版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76271988/

相关文章:

tfs - VSTS/TFS 扩展 - 在不刷新整个页面的情况下反射(reflect)网格/板的变化

azure-devops - Azure DevOps : An error occurred while loading the YAML build pipeline. 已添加具有相同 key 的项目

c# - 无法从程序集中加载 "Microsoft.CodeAnalysis.BuildTasks.Csc"任务

azure-pipelines - 我应该如何在另一个管道的末端触发一个管道?使用 msdocs 中的示例会导致 "pipeline resource input must be valid"错误

azure - 如何更改管道变量以供在 Azure DevOps 的下一个构建中使用

c# - Azure 服务总线 - 唯一支持的隔离级别是 'IsolationLevel.Serializable'

azure - 将最新文件夹中的文件从 azure blob 存储加载到 azure 数据仓库

azure - 无法将文件(图像和视频)上传到 blob 存储,出现错误 : mandatory header missing "x-ms-blob-type"

azure - 为什么sendgrid营销部分会被授权

azure - 如何将 azure-devops 命令添加到脱机本地服务器中的 Azure CLI?