Azure-cli: docker image contains invalid jp command file

Created on 20 May 2019  路  5Comments  路  Source: Azure/azure-cli

version 2.0.64 docker image.

Describe the bug

/usr/local/bin/jp file is not executable file.

$ docker run -it microsoft/azure-cli cat /usr/local/bin/jp
<html><body>You are being <a href="https://github-production-release-asset-2e65be.s3.amazonaws.com/40455851/a625432e-979c-11e7-90df-4578a58edd03?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190502%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20190502T004044Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=6b6480a1a7772a3fe1e5492f077caacc114795c16cc2e1550a5c5b22a1fdc07b&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;response-content-disposition=attachment%3B%20filename%3Djp-linux-amd64&amp;response-content-type=application%2Foctet-stream">redirected</a>.</body></html>

To Reproduce

cat /usr/local/bin/jp

Expected behavior

$ docker run -it microsoft/azure-cli /usr/local/bin/jp -h
usage: jp.py [-h] [-f FILENAME] [--ast] expression

Environment summary
microsoft/azure-cli:2.0.64 docker image.

Additional context

None.

PackaginDocker bug

Most helpful comment

A fix is coming, but until then you can work-around this by running the following command:

curl -L https://github.com/jmespath/jp/releases/download/0.1.3/jp-linux-amd64 -o /usr/local/bin/jp && chmod +x /usr/local/bin/jp

All 5 comments

Is there a reason you expect the cli docker image to contain jp in that location?

cc; @marstr

@adewaleo says:
Is there a reason you expect the cli docker image to contain jp in that location?

Looks like the problem isn't where this file is dropped, but what is being dropped there. I'm guessing that the link that we use to download jp is broken:
https://github.com/Azure/azure-cli/blob/781320f27cbfcb7f3379742f0b7a19b2423dbc40/Dockerfile#L42

My initial guess wasn't quite right. It wasn't that the link was broken, just that we needed to follow a redirect when we download jp.

A fix is coming, but until then you can work-around this by running the following command:

curl -L https://github.com/jmespath/jp/releases/download/0.1.3/jp-linux-amd64 -o /usr/local/bin/jp && chmod +x /usr/local/bin/jp

Thanks @marstr

Was this page helpful?
0 / 5 - 0 ratings