bazel-contrib / bazel-contrib/rules_oci
Support Make variable substitution in `oci_push`
- Dominant language
- Starlark
- Stars
- 423
- Forks
- 213
- Avg merge
- 53m
- Merged PRs (30d)
- 1
Description
This would allow, among other thing, configuring the registry using a command-line flag, e.g.:
```bazel
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
string_flag(
name = "registry",
make_variable = "REGISTRY",
build_setting_default = "localhost:5000",
)
oci_push(
name = "image-push",
image = "//some:image",
remote_tags = ["latest"],
repository = "$(REGISTRY)/image-name",
toolchains = [":registry"],
)
```
Then you could run:
```bash
bazel run //package:image-push --//package:registry=docker.io/library
```
Implementing this is just a matter of running [`ctx.expand_make_variables`](https://bazel.build/rules/lib/builtins/ctx#expand_make_variables).
Contributor guide
Research direction
Start at the oci_push rule implementation and read the ctx.expand_make_variables documentation linked in the issue. Check how the repository value is handled, then verify that a $(REGISTRY) value can be supplied through the toolchain and command-line flag as shown in the example.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100