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

feat: stamp the "tag" attribute for oci_push #59

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

nguyening
Copy link
Contributor

@nguyening nguyening commented May 30, 2024

Motivation

I want to tag my OCI images in oci_push with some values from a stable status file. Currently we do contortions using a repo rule to accomplish this

load("@metadata//:metadata.bzl", "git_sha") # read the value of GIT_COMMIT_SHA

oci_push(
    tag = "v1000-{}".format(git_sha)
    # ...
)

which is not cache friendly. rules_docker supports this inside its pusher binary.

Changes

  • OCIReferenceInfo can have an attr "tag_file" set to a file with expanded content of tag
  • The contents of oci_push.tag can be expanded with status file kv's

Testing

@nguyening nguyening self-assigned this May 30, 2024
@nguyening nguyening force-pushed the richard.nguyen/stamped-tags branch from c7562f2 to fe2abf0 Compare May 30, 2024 22:20
@nguyening nguyening marked this pull request as ready for review May 31, 2024 00:52
@nguyening nguyening force-pushed the richard.nguyen/stamped-tags branch from fe2abf0 to c6a0179 Compare May 31, 2024 13:18
@nguyening nguyening force-pushed the richard.nguyen/stamped-tags branch from c6a0179 to 8424fd5 Compare May 31, 2024 13:40
Copy link
Contributor

@joneshf-dd joneshf-dd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks for doing this!

Comment on lines +171 to +175
```sh
#!/usr/bin/env bash
echo "STABLE_KEY1 VALUE1"
echo "STABLE_KEY2 VALUE2"
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 thought: Not really something to block on, but as a heads up: it looks like these code blocks don't get rendered properly in the Markdown. I don't think it's worth blocking on because Markdown inside of tables likely requires an update to our dependencies that includes this change: bazelbuild/stardoc#167.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I can give upgrading a try in a separate PR if this is expected to work

@nguyening nguyening merged commit 461b15b into main Jun 3, 2024
2 checks passed
@nguyening nguyening deleted the richard.nguyen/stamped-tags branch June 3, 2024 13:24
@joneshf-dd joneshf-dd mentioned this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants