Comments (6)
Its not a workaround that's how we implemented stamping in rules_oci.
from rules_oci.
I'm not talking about stamping, but just passing a variable to oci_push, eg: bazel run --define=repo_url ...
from rules_oci.
With container_push
, we can have the BUILD file:
container_push(
name = "image-push",
format = "OCI",
image = ":image",
registry = "$(REGISTRY_REGION)-docker.pkg.dev",
repository = "$(REGISTRY_PROJECT_ID)/dev-repo/myapp",
tag = "$(IMAGE_TAG)",
visibility = ["//visibility:public"],
)
and run
bazel run -define=REGISTRY_REGION=us --define=REGISTRY_PROJECT_ID=my-project-id --define=IMAGE_TAG=test-tag :image-push
I tried below with oci_push
but the variable expansion doesn't work.
oci_push(
name = "image-push",
image = ":image",
repository = "$(REGISTRY_REGION)-docker.pkg.dev/$(REGISTRY_PROJECT_ID)/dev-repo/myapp",
remote_tags = ["$(IMAGE_TAG)"],
visibility = ["//visibility:public"],
)
The only workaround seems to be using "expand_template" at this time. It would be great if we can add direct variable expansion support in oci_push
, like container_push
.
from rules_oci.
it's the same thing essentially, expand_template also supports define variables, so you can expand your --define
values.
from rules_oci.
Yes, currently since oci_push doesn't support variable expansion, we have to use variable expansion in expand_template to workaround that. Today we use container_push with variables. Is it possible to add variable expansion support in oci_push directly so we don't have to add expand_template for every oci_push during migration?
from rules_oci.
This is by design, is how it works, and not a workaround. Is it unusual? Yes, but it saves us a lot of maintainer time.
we don't have to add expand_template for every oci_push during migration
It's clearly written on the Readme that we are not trying to be 1:1 replacement for rules_docker.
An alternative you can use is that, creating a macro around oci_push
that automatically stamps repository
and repo_tags
so you don't have to use expand template everywhere. It's up to you at that point, how you want to stamp these variables.
from rules_oci.
Related Issues (20)
- Use storage instead of memory for registry HOT 1
- Bug: "invalid path" with rules_oci 2.0.0-alpha0
- How to use build container in bazel? HOT 2
- Is it possible to build a python web image in more flexable way which will following some python docker best practice. HOT 5
- `2.0.0-alpha1` installation instructions broken for `MODULE.bazel` HOT 2
- Reenable bcr presubmit for macos
- [v2.0.0-alpha2] Fail to use the platform transition group and the filegroup to get the tarball HOT 2
- FR: Can't use multiple labels file in single `rules_oci` rule HOT 3
- Document how to replace per-platform repos HOT 5
- accidental issue creation, pls delete HOT 1
- [v2.0.0-alpha2] Error on labels file with EOF character at end of file HOT 1
- FR: oci_tarball should have a `.digest` target that gives imageid which would match the daemon.
- Cannot run container structure test against a tarball HOT 6
- 2.0: consider rename of oci_tarball HOT 2
- Multiline cmd and entrypoint handling HOT 3
- Adding a defer_download mode to rules_oci HOT 3
- multi arch images broken on 2.x HOT 1
- Multi arch indices broken in v2alpha5 HOT 2
- rules_oci fails to build when appending an env value with :PATH HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_oci.