abrisco / rules_helm

Bazel rules for producing Helm charts
MIT License
23 stars 11 forks source link

Windows fails to fetch auth for oci images in CI #53

Open abrisco opened 8 months ago

abrisco commented 8 months ago
(12:00:44) ERROR: An error occurred during the fetch of repository 'rules_helm_test_container_base':
   Traceback (most recent call last):
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 449, column 55, in _oci_alias_impl
        manifest, _, digest = downloader.download_manifest(rctx.attr.identifier, "mf.json")
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 322, column 74, in lambda
        download_manifest = lambda identifier, output: _download_manifest(rctx, state, identifier, output),
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 265, column 23, in _download_manifest
        result = _download(rctx, state, identifier, output, "manifests", allow_fail = True)
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 230, column 22, in _download
        auth = _get_token(rctx, state, rctx.attr.registry, rctx.attr.repository)
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 137, column 24, in _get_token
        pattern = _get_auth(rctx, state, registry)
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 109, column 59, in _get_auth
        pattern = _fetch_auth_via_creds_helper(rctx, host_raw, config["credsStore"])
    File "C:/bzl/3v3tqmyi/external/rules_oci/oci/private/pull.bzl", line 189, column 13, in _fetch_auth_via_creds_helper
        fail("credential helper failed: \nSTDOUT:\n{}\nSTDERR:\n{}".format(result.stdout, result.stderr))
Error in fail: credential helper failed: 
STDOUT:

STDERR:
java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\bzl\3v3tqmyi\external\rules_helm_test_container_base\wincred.sh" https://index.docker.io/v1/): %1 is not a valid Win32 application.
 (error: 193)
abrisco commented 8 months ago

I believe this is caused by rules_oci writing a bash script in a repository rule here: https://github.com/bazel-contrib/rules_oci/blob/v1.7.0/oci/private/pull.bzl#L188-L210

This should instead be a batch script so windows hosts can natively understand how to run it.