Giter Club home page Giter Club logo

Comments (7)

psalaberria002 avatar psalaberria002 commented on June 26, 2024 1

In addition to tags, there should be support for stamping labels (and possibly other fields).

from rules_oci.

malt3 avatar malt3 commented on June 26, 2024 1

What do you think about stamping / label support for the repository attribute of oci_push?
The use case I have in mind is enabling developers to test out a container image in their private container registry (think ghcr.io/<user>/foo) via a build setting but also having a default setting for releases (like company.tld/foo).
I can also move this into a separate issue if that's preferred.

This is how rules_docker does it: https://github.com/bazelbuild/rules_docker/blob/6db7c12fbe4b49682f5dcbc193e4c467011a9fb6/container/push.bzl#L52-L55

from rules_oci.

malt3 avatar malt3 commented on June 26, 2024 1

Thanks! Getting the company involved may take some time. I'll discuss it internally.
Donating privately may be an option. What I can offer is helping out with maintenance and feature development in some capacity.

from rules_oci.

alexeagle avatar alexeagle commented on June 26, 2024

@thesayyn I have a new idea to approach this that doesn't require we run more actions, and maybe it also satisfies your desire to have a file passed in.

# instead of default_tags: ["latest"] we have a new metadata attribute:
oci_push(
    name = "push_image",
    metadata = {"default_tags": ["latest"]},
    image = ":image",
    repository = "index.docker.io/<ORG>/image",
)

metadata could later include custom labels as well.

oci_push becomes a macro so that dict value is supported, like we do for inline tsconfig.json:

def oci_push(name, metadata = None, **kwargs):
    if types.is_dict(metadata):
        metadata_label = "_{}_write_metadata".format(name)
        write_file(
            name = metadata_label,
            out = "_{}.json".format(name),
            content = [json.encode(metadata)],
        )
        metadata = metadata_label

    oci_push_rule(
        name = name,
        metadata = metadata,
        **kwargs
    )

so the attribute on the oci_push rule is a label pointing to a JSON file.

Now the user can use the existing affordance for stamping in our jq rule:

jq(
    name = "stamped_metadata",
    srcs = [],
    filter = "|".join([
        "$ARGS.named.STAMP as $stamp",
        # With --stamp, use the --embed_label value, otherwise use 0.0.0
        """.default_tags = [($stamp.BUILD_EMBED_LABEL // "0.0.0")]""",
    ]),
)

oci_push(
    name = "push_image_index",
    metadata = ":stamped_metadata",
    image = ":image_index",
    repository = "index.docker.io/<ORG>/image",
)

WDYT?

from rules_oci.

alexeagle avatar alexeagle commented on June 26, 2024

I updated #70 with a partly-working implementation for this proposal

from rules_oci.

thesayyn avatar thesayyn commented on June 26, 2024

I love this. it's almost what I tried to describe to you in our call. like the idea that stamping is done in a separate action and fed as a file to the rule.

from rules_oci.

alexeagle avatar alexeagle commented on June 26, 2024

Yeah that's #46

BTW, if your company can help out here (aside from your feedback and issues) take a look at our sponsor button above :)

from rules_oci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.