Small question regarding `BinaryPathRequest` and `...
# plugins
a
Small question regarding
BinaryPathRequest
and
BinaryPathTest
When testing with
gcloud -v
, my binary is not found. When removing the
test
part, the binary is found with the proper path. What are the requirements for the
test
?
Copy code
request = BinaryPathRequest(
        binary_name="gcloud",
        search_path=search_path,
        test=BinaryPathTest(args=["-v"]),
    )
vs:
Copy code
request = BinaryPathRequest(
        binary_name="gcloud",
        search_path=search_path,
    )
Copy code
gcloud -v                                               
Google Cloud SDK 378.0.0
bq 2.0.74
core 2022.03.18
gsutil 5.8
Updates are available for some Google Cloud CLI components.  To install them,
please run:
  $ gcloud components update

...

echo $?                                                 
0
I was assuming an exit code of 0 would be enough, but it doesn’t look like it is?
Actually, in my current state I just know that the binary is found, not that it is executable. I’ll do further testing to double check.
Alright, it does work when publishing. the
test=BinaryPathTest(args=["-v"]),
doesn’t seems to be working for gclodu for a reason I don’t understand 🤔
b
You can use
--no-proccess-cleanup
and
--no-pantsd
and you'll likely see Pants leaking the process where it tests the binary. Then poke around and see whats what. For instance, the executable flag might not have been set
a
the executable is found and work as expected, I’m actually able to deploy.
However, it still fail if I uncomment the
test
part
Copy code
ls -lta /Users/quentin/Downloads/google-cloud-sdk/bin/gcloud 
-rwxrwxrwx@ 1 quentin  staff  5611 Jan  1  1980 /Users/quentin/Downloads/google-cloud-sdk/bin/gcloud
I went as loose as possible regarding the flags, 777 on the binary
Copy code
11:55:46.45 [DEBUG] spawned local process as Some(85201) for Process { argv: ["/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud", "-v"], env: {}, working_directory: None, input_digests: InputDigests { complete: DirectoryDigest { digest: Digest { hash: Fingerprint<e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, size_bytes: 0 }, tree: "Some(..)" }, nailgun: DirectoryDigest { digest: Digest { hash: Fingerprint<e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, size_bytes: 0 }, tree: "Some(..)" }, input_files: DirectoryDigest { digest: Digest { hash: Fingerprint<e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, size_bytes: 0 }, tree: "Some(..)" }, immutable_inputs: {}, use_nailgun: [] }, output_files: {}, output_directories: {}, timeout: None, execution_slot_variable: None, concurrency_available: 0, description: "Test binary /Users/quentin/Downloads/google-cloud-sdk/bin/gcloud.", level: Debug, append_only_caches: {}, jdk_home: None, platform_constraint: None, cache_scope: PerRestartAlways }
and:
Copy code
/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud -v
Google Cloud SDK 378.0.0
bq 2.0.74
core 2022.03.18
gsutil 5.8
Updates are available for some Google Cloud CLI components.  To install them,
please run:
  $ gcloud components update
b
File a bug with as much info as possible. Thats odd
Why is it using a
/Users
path and not a sandbox one? Thats the only thing that sticks out
a
That’s just where the tool was unzipped, as, it was unzipped in my own session, and the directory got added to the path
I’ll look at a last thing and I’ll open a ticket
🙌 1
1
Copy code
08:54:02.38 [WARN] results (FallibleProcessResult(stdout=b'', stdout_digest=FileDigest('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 0), stderr=b'/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud: line 70: readlink: No such file or directory\n/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud: line 84: dirname: No such file or directory\n/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud: line 70: readlink: No such file or directory\n/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud: line 192: /private/var/folders/4s/cp00bpsn0v527nblqlwl1gk40000gn/T/process-executionjfspMg/python: No such file or directory\n/Users/quentin/Downloads/google-cloud-sdk/bin/gcloud: line 192: exec: /private/var/folders/4s/cp00bpsn0v527nblqlwl1gk40000gn/T/process-executionjfspMg/python: cannot execute: No such file or directory\n', stderr_digest=FileDigest('63269a99238d2bb885b5e3e5102bbb07cd617f2056da69f3b865c1012f39df92', 676), exit_code=126, output_digest=Digest('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 0), platform=<Platform.macos_arm64: 'macos_arm64'>, metadata=ProcessResultMetadata(total_elapsed_ms=17, _source='ran_locally', source_run_id=2)),)
interesting
I suppose this is the reason why we need to include
Copy code
[docker]
default_repository = "{parent_directory}/{name}"
tools = [
    "gcloud",
    "docker-credential-gcloud",
    "dirname",
    "readlink",
    "python3",
]
in order to push image to GCR