bazelbuild/rules_docker

nodejs_image throws errors on Windows

xnerhu opened this issue ยท 4 comments

๐Ÿž bug report

Affected Rule

The issue is caused by the rule:
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")

Description

nodejs_binary tries to download gcr.io/google-appengine/debian9 and saves it to C:\Users\xnerh\_bazel_xnerh\cxuxnil7\external\go_puller_linux_amd64\file\downloaded which is not executable on Windows so it throws %1 is not a valid Win32 application

๐Ÿ”ฌ Minimal Reproduction

WORKSPACE

http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "1f4e59843b61981a96835dc4ac377ad4da9f8c334ebe5e0bb3f58f80c09735f4",
    strip_prefix = "rules_docker-0.19.0",
    urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.19.0/rules_docker-v0.19.0.tar.gz"],
)

load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")

container_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

load("@io_bazel_rules_docker//container:pull.bzl", "container_pull")

load("@io_bazel_rules_docker//nodejs:image.bzl", nodejs_image_repos = "repositories")

nodejs_image_repos()

BUILD

load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")

nodejs_image(
    name = "image",
    data = [
        ":index.ts",
    ],
    entry_point = "src/index.ts",
)

๐Ÿ”ฅ Exception or Error

INFO: Invocation ID: 9d3cb168-8d69-460f-b6ca-9df5329c23aeINFO: Build option --define has changed, discarding analysis cache.INFO: Repository nodejs_image_base instantiated at:  C:/users/xnerh/projects/wexond-old/bazel2/WORKSPACE:69:19: in <toplevel>  C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/io_bazel_rules_docker/nodejs/image.bzl:48:23: in repositoriesRepository rule container_pull defined at:  C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/io_bazel_rules_docker/container/pull.bzl:270:33: in <toplevel>ERROR: An error occurred during the fetch of repository 'nodejs_image_base':   Traceback (most recent call last):        File "C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/io_bazel_rules_docker/container/pull.bzl", line 216, column 13, in _impl                fail("Pull command failed: %s (%s)" % (result.stderr, " ".join([str(a) for a in args])))Error in fail: Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\xnerh\_bazel_xnerh\cxuxnil7\external\go_puller_linux_amd64\file\downloaded" -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93): %1 is not a valid Win32 application. (error: 193) (C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/go_puller_linux_amd64/file/downloaded -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93)
ERROR: Error fetching repository: Traceback (most recent call last):        File "C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/io_bazel_rules_docker/container/pull.bzl", line 216, column 13, in _impl                fail("Pull command failed: %s (%s)" % (result.stderr, " ".join([str(a) for a in args])))
Error in fail: Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\xnerh\_bazel_xnerh\cxuxnil7\external\go_puller_linux_amd64\file\downloaded" -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93): %1 is not a valid Win32 application.
 (error: 193) (C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/go_puller_linux_amd64/file/downloaded -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93)
ERROR: C:/users/xnerh/projects/wexond-old/bazel2/backend/api-gateway/BUILD:56:13: //backend/api-gateway:image.0 depends on @nodejs_image_base//image:image in repository @nodejs_image_base which failed to fetch. no such package '@nodejs_image_base//image': Pull command failed: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\xnerh\_bazel_xnerh\cxuxnil7\external\go_puller_linux_amd64\file\downloaded" -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version "" -os-features "" -architecture amd64 -variant "" -features "" -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93): %1 is not a valid Win32 application.
 (error: 193) (C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/go_puller_linux_amd64/file/downloaded -directory C:/users/xnerh/_bazel_xnerh/cxuxnil7/external/nodejs_image_base/image -os linux -os-version  -os-features  -architecture amd64 -variant  -features  -name gcr.io/google-appengine/debian9@sha256:18fffa1540afe7784c23384479e161c7e86c9c4b24726bb90857bb62897bda93)
ERROR: Analysis of target '//backend/api-gateway:image' failed; build aborted: Analysis failed                                                                                      
INFO: Elapsed time: 0.511s                                                                
INFO: 0 processes.                                                                        
FAILED: Build did NOT complete successfully (1 packages loaded, 6499 targets configured)  
FAILED: Build did NOT complete successfully (1 packages loaded, 6499 targets configured)  
    Fetching @com_github_google_go_containerregistry; Restarting.                         
    Fetching @bazel_gazelle_go_repository_config; Restarting.

๐ŸŒ Your Environment

Operating System:

  
Windows 11
  

Output of bazel version:

  
Bazelisk version: v1.10.1
Build label: 4.1.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri May 21 11:17:01 2021 (1621595821)
Build timestamp: 1621595821
Build timestamp as int: 1621595821
  

Rules_docker version:

  
0.19.0
  

Anything else relevant?
I'm using Docker Desktop for Windows. Bazel run was executed on powershell.

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

This is the same issue as #1958

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"