Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Add bazel run tag resolution #5

Merged
merged 1 commit into from
Sep 7, 2017
Merged

Add bazel run tag resolution #5

merged 1 commit into from
Sep 7, 2017

Conversation

mattmoor
Copy link
Contributor

@mattmoor mattmoor commented Sep 2, 2017

No description provided.

@mattmoor
Copy link
Contributor Author

mattmoor commented Sep 2, 2017

This builds on #3

@mattmoor mattmoor force-pushed the resolution branch 2 times, most recently from 218c9aa to 0ef2b99 Compare September 5, 2017 15:14
@mattmoor
Copy link
Contributor Author

mattmoor commented Sep 5, 2017

This is now rebased.

- bazel clean && bazel build //...
# We have no Bazel-based testing currently.
# Check that all of our tests pass
- bazel clean && bazel test //...
Copy link

Choose a reason for hiding this comment

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

I noticed we're doing this in a few other repos, but is there any reason to clean again here between the build and the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly just that I started from a copy/paste of the line above. :)

I'm happy to change if you feel strongly.

@@ -20,14 +20,28 @@ Add the following to your `WORKSPACE` file to add the necessary external depende

```python
git_repository(
name = "io_bazel_rules_docker",
commit = "{HEAD}",
Copy link

Choose a reason for hiding this comment

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

Why are we using {HEAD} here? This won't work when people copy/paste.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this when going through the OSS process because I didn't have a commit yet. The "can't copy/paste" is somewhat by design for now, I think that once we cut a first release we should update this to reference releases.


message FooReply {
string message = 1;
}
Copy link

Choose a reason for hiding this comment

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

nit: newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.



def Resolve(input, tag_to_digest):
"""Translate tag references within the input yaml into digests."""
Copy link

Choose a reason for hiding this comment

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

So the idea is that all image references in a yaml get resolved into a digest? Is there a way to specify just a subset of them to resolve? I guess it's not a big deal, but I'm thinking of cases where users specify sidecar containers maintained by other teams/projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it resolves everything. Once I add images={} it may make sense to also add an option that will tell this to only resolve published images, but I think my preference is just that: opt out.

k8s/resolver.py Outdated
with open(args.template, 'r') as f:
inputs = f.read()

print _DOCUMENT_DELIMITER.join([
Copy link

Choose a reason for hiding this comment

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

print function vs. statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old habit. Don't tell Doug :)

…run.

This change introduces a `resolver` tool that walks the yaml of a K8s object and resolves things shaped like fully-qualified Docker tags to digests.  The current version only operates on remote registry objects, no local artifacts are published as a part of resolution.

This change also introduces the first part of our first sample app to use as mock test data for our resolver unit testing.
@mattmoor
Copy link
Contributor Author

mattmoor commented Sep 5, 2017

Should be RFAL. thanks for the feedback.

],
)

par_binary(
Copy link

Choose a reason for hiding this comment

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

It would probably make sense for this to be a standalone tool packaged as part of the containerregistry releases. But this LGTM for now.

@mattmoor mattmoor merged commit 857c94f into master Sep 7, 2017
@nlopezgi nlopezgi deleted the resolution branch November 27, 2018 15:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants