Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target @@io_bazel_rules_docker//platforms:image_transition was referenced as a platform, but does not provide PlatformInfo #21191

Open
jayeshkotia opened this issue Feb 3, 2024 · 5 comments
Labels

Comments

@jayeshkotia
Copy link

Description of the bug:

ERROR: C:/users/jkotia/_bazel_jkotia/vil3omde/external/io_bazel_rules_docker/platforms/BUILD:78:9: in constraint_values attribute of platform rule @@io_bazel_rules_docker//platforms:image_transition: '@@io_bazel_rules_docker//platforms:image_transition_cpu' does not have mandatory providers: 'ConstraintValueInfo'
ERROR: C:/users/jkotia/_bazel_jkotia/vil3omde/external/io_bazel_rules_docker/platforms/BUILD:78:9: in constraint_values attribute of platform rule @@io_bazel_rules_docker//platforms:image_transition:
'@@io_bazel_rules_docker//platforms:image_transition_os' does not have mandatory providers: 'ConstraintValueInfo'

ERROR: C:/users/jkotia/_bazel_jkotia/vil3omde/external/io_bazel_rules_docker/platforms/BUILD:78:9: Analysis of target '@@io_bazel_rules_docker//platforms:image_transition' failed

ERROR: C:/users/jkotia/downloads/working_project/bazel_projects_pocs/multi-language-bazel-monorepo/projects/python_web/BUILD.bazel:20:9: Target @@io_bazel_rules_docker//platforms:image_transition was referenced as a platform, but does not provide PlatformInfo

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

WORKSPACE FILE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_python",
sha256 = "b593d13bb43c94ce94b483c2858e53a9b811f6f10e1e0eedc61073bd90e58d9c",
strip_prefix = "rules_python-0.12.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.12.0.tar.gz",
)

load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
name = "pip_deps",
requirements_lock = "//third_party:requirements_lock.txt",
)

load("@pip_deps//:requirements.bzl", "install_deps")

install_deps()

http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.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//python3:image.bzl",
_py_image_repos = "repositories",
)

_py_image_repos()

BUILD.bazel file :
load("@pip_deps//:requirements.bzl", "requirement")
load("@io_bazel_rules_docker//python3:image.bzl", py_image="py3_image")

py_library(
name = "python_web_lib",
srcs = ["python_web.py"],
deps = [
requirement("Flask"),
"//projects/python_calculator:calculator",
],
)

py_binary(
name = "python_web",
srcs = ["python_web.py"],
main = "python_web.py",
deps = [":python_web_lib"],
)

py_image(
name = "python_web_image",
srcs = ["python_web.py"],
main = "python_web.py",
deps = [":python_web_lib"],
)

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

Build label: 7.0.0 Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer Build time: Mon Dec 11 16:54:12 2023 (1702313652) Build timestamp: 1702313652 Build timestamp as int: 1702313652

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:54:12 2023 (1702313652)
Build timestamp: 1702313652
Build timestamp as int: 1702313652

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

When Adding the
py_image(
name = "python_web_image",
srcs = ["python_web.py"],
main = "python_web.py",
deps = [":python_web_lib"],
)
in the BUILD.bazel file I am getting this error
Image: transition,
Platform Info
'ConstraintValueInfo'

@jayeshkotia
Copy link
Author

Help to create the local python image so that I can push it in the docker hub

@jayeshkotia
Copy link
Author

_IMAGE_TRANSITION_CONSTRAINTS = [
("cpu", "@platforms//cpu"),
("os", "@platforms//os"),
]

[[
# Use a constraint value which will never be valid to prevent
# accidentally leaving the associated constraint setting unset.
constraint_value(
name = "image_transition_{}unset".format(name),
constraint_setting = constraint_setting,
),
label_setting(
name = "image_transition
{}".format(name),
build_setting_default = ":image_transition_{}_unset".format(name),
),
] for name, constraint_setting in _IMAGE_TRANSITION_CONSTRAINTS]

platform(
name = "image_transition",
constraint_values = [
":image_transition_{}".format(name)
for name, _ in _IMAGE_TRANSITION_CONSTRAINTS
],
)

I think this issue is with the [rules_docker/platforms/BUILD] file kindly resolve this

@sgowroji sgowroji added the team-Rules-Python Native rules for Python label Feb 5, 2024
@jayeshkotia
Copy link
Author

Not able to create the local image through bazel rules

@stagnation
Copy link
Contributor

Does the flag --@io_bazel_rules_docker//transitions:enable=false work around the issue for you?

rules_docker fails to build with HEAD bazel · Issue #2275 · bazelbuild/rules_docker
bazelbuild/rules_docker#2275

@jayeshkotia
Copy link
Author

No it haven't worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants