renevanosnabrugge / vsts-promotepackage-task

Promote a package in VSTS to a Release View
MIT License
20 stars 25 forks source link

npm .tgz promotion fails due to: tar.exe: Option --force-local is not supported #61

Open walliski opened 4 years ago

walliski commented 4 years ago

Currently running on "windows-latest" label for my build, and trying to promote a package that I have just packed with "npm pack". Getting the following error during promotion: tar.exe: Option --force-local is not supported

Related to #41 perhaps, where another user mentioned the same issue.

Full output:

Starting: rvovstspromotepackagetask
==============================================================================
Task         : Promote package to Release View
Description  : Promotes a package to a Release View in VSTS Package Management
Version      : 3.0.4
Author       : Rene van Osnabrugge
Help         : Version: 3.0.4. [More Information](https://github.com/renevanosnabrugge/vsts-promotepackage-task/wiki)
==============================================================================
Promoting package(s) by reading metadata from package file(s) matching pattern '*.tgz' from root directory 'D:\a\1\s'
Matching paths found:
D:\a\1\s\derp-hurrdurr-0.1.5.tgz
##[error]tar.exe: Option --force-local -xvzf is not supported
Finishing: rvovstspromotepackagetask
DeluxZ commented 3 years ago

I'm currently having the same issue. Any idea @renevanosnabrugge or @jessehouwing ?

After some digging it seems the option --force-local isn't even supported on Windows? When I try it in Windows Terminal with PowerShell I get the same message. image

On Ubuntu 20.04 it's accepted. image

So I tried to change the agent to Ubuntu20.04 for my release but then I get the message ##[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.

Tiberriver256 commented 3 years ago

Looks like it's only when you're using the package for name and version metadata. Flipping to name and version manually specified worked for me.

I just put a pwsh task before to pull the version from the package.json file:

  - pwsh: |
      echo "##vso[task.setvariable variable=PackageVersion]$((gc ./package.json | ConvertFrom-Json).version)"

Then plugged it in like:

  - task: rvo-vsts-promotepackage-task@3
    condition: and(succeeded(), eq(variables.isMain, true))
    inputs:
      feed: 'xxx'
      inputType: nameVersion
      definition: '@my-baller-company/the-internet-is-in-this-package'
      version: '$(PackageVersion)'
      releaseView: 'xxx'
j-fritsch commented 3 years ago

This appears to also happen to me because I am using the .snupkg symbol package format and it's specifically looking for .nupkg. Works fine with the old .symbols.nupkg format.

function Get-PackageMetadata([string]$filePath) {
    $extension = [System.IO.Path]::GetExtension($filePath)
    if ($extension -eq '.nupkg') {
        return Get-NuGetPackageMetadata $filePath
    } else { # ($extension -eq '.tgz')
        return Get-NpmPackageMetadata $filePath
    }
}