Closed OskiKervinen-MF closed 4 years ago
This line is drawing my attention:
knack.util.CLIError: Please run 'az login' to setup account.
Have you run az login?
No. As the reproduction steps state, I used az devops login --organization <org>
to log in with a personal access token, which is not possible with az login
.
Got the similar error message but with vsts:
vsts package universal publish --instance "https://dev.azure.com/xxx/" --feed TestFeed --name "xxx" --version 0.0.1 --path . --debug .... 168 files to be processed in 2 groups. Failed to hash a page of files. Exception listed below... Traceback (most recent call last): File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\knack\cli.py", line 206, in invoke cmd_result = self.invocation.execute(args) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\knack\invocation.py", line 188, in execute cmd_result = parsed_args.func(params) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\knack\commands.py", line 105, in call return self.handler(*args, kwargs) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\knack\commands.py", line 212, in _command_handler result = op(client, command_args) if client else op(**command_args) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\universal.py", line 41, in publish_package return artifact_tool.publish_universal(team_instance, feed, name, version, description, path) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\artifacttool.py", line 30, in publish_universal return self.run_artifacttool(team_instance, args, "Publishing") File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\artifacttool.py", line 44, in run_artifacttool proc = self._tool_invoker.run(command_args, new_env, initial_progress_message, self._process_stderr) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\external_tool.py", line 72, in run stderr_handler(line, self._update_progress) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\artifacttool.py", line 64, in _process_stderr self._log_message(json_line) File "C:\Program Files (x86)\Microsoft SDKs\VSTS\CLI\lib\site-packages\vsts\cli\package\common\artifacttool.py", line 76, in _log_message raise CLIError(message) knack.util.CLIError: Failed to hash a page of files. Exception listed below... Failed to hash a page of files. Exception listed below...
Looks these errors are caused by the issue reported in this bug: Universal artifacts publish - path attribute cannot start with '.\'. The error occurs when the files are referenced with ".\" .
The feedback from @apluche is correct. Had the same issue when trying to pass --path .\filename.ext
. Changing that to --path filename.ext
solved the issue
I'm seeing this as well, but the "." dot in the path does not matter. The error message does not seem to give very much to go on.
Ensuring that the package does not yet exist... Package does not yet exist Pushing content... DedupManifestArtifactClient will correlate http requests with X-TFS-Session 6d836b00-2731-4788-94c3-9433fc6486a0 1 files to be processed in 1 groups. handling generic error cli.azure.cli.core.util : Failed to hash a page of files. Exception listed below... Failed to hash a page of files. Exception listed below... az_command_data_logger : exit code: 1 telemetry.save : Save telemetry record of length 2625 in cache telemetry.check : Negative: The /root/.azure/telemetry.txt was modified at 2019-10-08 10:00:15.924218, which in less than 600.000000 s command ran in 3.364 seconds.
I'm using Ubuntu 14.04.6 LTS with these versions of the az tool:
azure-cli 2.0.74
command-modules-nspkg 2.0.3 core 2.0.74 nspkg 3.0.4 telemetry 1.0.3
Extensions: azure-devops 0.13.0
@apluche it looks like you took a look at this one before, mind taking another around?
For me, the name specified after --path contained dots (".") as part of version number. Passing a directory name without dots solved the issue.
Similar to lp-code my issue I later resolved by using a directory. At first I had tried referencing a file directly which caused the error for me. I think that should be considered a bug that it cannot take a file directly without producing a logical error message.
Similar to lp-code my issue I later resolved by using a directory. At first I had tried referencing a file directly which caused the error for me. I think that should be considered a bug that it cannot take a file directly without producing a logical error message.
I did the same, created a directory with this in (I did have dots in the name) and it worked
I would like to clarify that you can publish a ZIP file from the current directory, but you get this error message if you try to include a path (in addition to filename) in the --path
parameter.
I.e. this does not work
c:\foo> az artifacts universal publish ... --path bar\baz.zip
nor does this
c:\foo\bar> az artifacts universal publish ... --path .\baz.zip
while this works
c:\foo\bar> az artifacts universal publish ... --path baz.zip
I am getting this error even when leaving out the period for the explicit path
[
{
"experimental": false,
"extensionType": "whl",
"name": "azure-devops",
"path": "/home/jonathan/.azure/cliextensions/azure-devops",
"preview": false,
"version": "0.18.0"
}
]
btw. Works just fine on windows with @mjiderhamn's working example
c:\foo\bar> az artifacts universal publish ... --path baz.zip
[
{
"experimental": false,
"extensionType": "whl",
"name": "azure-devops",
"path": "C:\\Users\\joreynes\\.azure\\cliextensions\\azure-devops",
"preview": false,
"version": "0.18.0"
}
]
@jontreynes , once you've managed to upload the ZIP file, you may hit #877
yes, I did run into that @mjiderhamn... weird this was not the case on Feb 19, 2020. I was able to successfully download and upload zips all day a while back
so figured out one thing..
When you publish a zip file, put the zip file in a folder with just the zip file
Then use "--path ." and it will upload the zip file as that's the only piece that exists in the folder. When you download artifact, you'll download the zip.
--path needs to receive a "DIRECTORY", not a full path https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/artifacts/universal?view=azure-cli-latest#ext-azure-devops-az-artifacts-universal-download
@jontreynes , unfortunately, putting a ZIP file inside your artifact is not the same thing as making the ZIP file the artifact. (You could place a ZIP file inside your ZIP file artifact as well).
The problem becomes obvious with your example above. The consumer of your artifact would need to know that inside the 0.0.2 artifact version there is a ZIP file with v1.0.0
in its name.
Closing as the original problem is addressed.
@samuelkoppes this issue thread describes a workaround (using a directory) but the issue in question is still present in the current version of the az CLI (2.14.2). I think this should be addressed with a proper error message in the failed command
specifying the absolute path on macOS fixed it for me.
In my case it wouldn't work until I used the full path of the file I wanted to upload
In my case it wouldn't work until I used the full path of the file I wanted to upload
Thanks for adding this comment! I was pulling my hair out trying to get this to work and for me this is also the only way this would work. I have a setup.exe inside of zip and no other methods worked.
2024 and this is still an issue 🤷♂️
Describe the bug When I try to upload a file to Azure Artifacts Universal feed, I receive the error "Failed to hash a page of files. Exception listed below". No exception is listed below.
To Reproduce Azure Cli Version: 2.0.70
Azure-Devops extension version: 0.12.0
Steps to reproduce the behavior:
az devops login --organization <org>
+ input Personal Access Tokenaz artifacts universal publish --organization "<org>" --feed "Installers" --name "txt.tmp" --version "0.0.1" --description "Test upload" --path .\txt.tmp
Failed to hash a page of files. Exception listed below...
Expected behavior The file is uploaded to the feed. Or a clear error telling why it failed.
Debug logs
Additional context The feed I tried to push to is currently empty.