This is my task code:
- task: PublishADFTask@1
displayName: 'Publish Datafactory'
inputs:
// inputs there
But there is a bug in latest 1.*
version.
Is it a way to use previous task's version in azure devops yaml pipelines?
i tried:
- task: [email protected]
displayName: 'Publish Datafactory'
inputs:
// inputs there
But it doesnt work
That should work as long as the old version was installed in the organisation. If needed you can force-upload the older version into the org using tfx build tasks upload
or a powershell script. The old version may have gone missing if someone has uninstalled and reinstalled the extension in an attempt to fix the problem.
To upload the older version of the task, first make sure you have a zipfile of the task version you know is good or a folder in which the task is available, then run:
# 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
Or use this PowerShell snippet:
"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.
If needed, download the older version of the task straight from the Azure DevOps Marketplace. The following command should dump all the available versions to the output. FInd the version you want and look for the asset of type Microsoft.VisualStudio.Services.VSIXPackage
to get the download url of an older version of the extension:
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"
}
]
}
...
Or try looking on the Azure Pipelines Agent's _tasks
folder if it still has the older version cached: