I'm having a hard time running tar on an http_arch...
# general
p
I'm having a hard time running tar on an http_archive.
Copy code
filename = "google-cloud-cli.tar.gz"

file(
    name="downloaded-google-cloud-cli",
    source=per_platform(
        macos_arm64=http_source(
            url="<https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-467.0.0-darwin-arm.tar.gz>",
            len=126372269,
            sha256="b91e876d8f52f7bbd63f32d6118430b7254f5554ce26b63a17f66f327da11271",
            filename=filename,
        ),
        macos_x86_64=http_source(
            url="<https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-467.0.0-darwin-x86_64.tar.gz>",
            len=129301273,
            sha256="7d6c1bd5929d00031b7a6945235e5a41ff333a464d523d0db5381032c5e0e764",
            filename=filename,
        ),
        linux_x86_64=http_source(
            url="<https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-467.0.0-linux-x86_64.tar.gz>",
            len=206577742,
            sha256="047e8fa7910cd70d82ed21f6ed35ca081d9e783790d067b0699098efa5ca7b8c",
            filename=filename,
        )
    )
)

shell_command(
    name="extracted-gcloud",
    command="ls && echo ==== && tar -zxvf google-cloud-cli.tar.gz",
    tools=["tar", "ls"],
    execution_dependencies=[":downloaded-google-cloud-cli"],
    output_directories=["google-cloud-sdk"],
    workdir = "./"
)
Lets to ..
Copy code
ProcessExecutionFailure: Process 'the `shell_command` at `third_party/gcloud:extracted-gcloud`' failed with exit code 2.
stdout:
google-cloud-cli.tar.gz
====

stderr:
tar (child): gzip: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/usr/bin/tar: Child returned status 2
/usr/bin/tar: Error is not recoverable: exiting now
As far as I can tell by poking the sandbox everything is in order.
oops. I needed to add gzip 🤦
👍 1