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

Add limited support for overriding and excluding dependencies. #84

Merged
merged 1 commit into from
Jul 10, 2017

Conversation

mattmoor
Copy link
Contributor

Fixes: #55
Fixes: #77

@@ -30,55 +30,65 @@ load(":push.bzl", "docker_push")
# The release of the github.com/google/containerregistry to consume.
CONTAINERREGISTRY_RELEASE = "v0.0.11"

def docker_repositories():
def docker_repositories(excludes=[], overrides={}):
Copy link
Contributor

Choose a reason for hiding this comment

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

In python there are issues with using mutable objects as default vals in functions, does that apply to skylark?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 fixed regardless.

name = "puller",
url = ("https://storage.googleapis.com/containerregistry-releases/" +
gcr_release + "/puller.par"),
sha256 = overrides.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're overriding it might be nice to not have to specify a SHA, wdyt?

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 thought about it, but let's see if someone complains. I was debating exactly this for the large list of TODOs below. Ultimately I didn't do this because AFAIK there is no way of doing this without duplicating the rule. @damienmg thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

You could make it optional but generally this go against reproducibility which is going to get back at you.

BTW, maybe use native.existing_rule to make sure you do not add an existing deps instead, that would better address #55.

Copy link
Contributor

@damienmg damienmg left a comment

Choose a reason for hiding this comment

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

I feel like excludes= and override= are not needed, I would rather use native.existing_rules to not re-add existing deps.

name = "puller",
url = ("https://storage.googleapis.com/containerregistry-releases/" +
gcr_release + "/puller.par"),
sha256 = overrides.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

You could make it optional but generally this go against reproducibility which is going to get back at you.

BTW, maybe use native.existing_rule to make sure you do not add an existing deps instead, that would better address #55.

@mattmoor
Copy link
Contributor Author

mattmoor commented Jul 3, 2017

@damienmg I believe what you are suggesting is that native.existing_ruless keys replaces excludes and if a user wants to override, they should just import it themselves and then existing_rules will do the right thing. Is that a fair interpretation?

@damienmg
Copy link
Contributor

damienmg commented Jul 5, 2017 via email

@mattmoor
Copy link
Contributor Author

mattmoor commented Jul 5, 2017

@damienmg then it should be RFAL, that's what I pushed :)

@mattmoor
Copy link
Contributor Author

mattmoor commented Jul 5, 2017

@dlorenc any problems with the new approach?

This avoids manual `excludes=[]` and `overrides={}`, which were suggested in the linked issues.  We exclude things that have already been imported, so to override them, simply import them before `docker_repositories()` and the exclusion logic will handle the rest.

Fixes: bazelbuild#55
Fixes: bazelbuild#77
@mattmoor
Copy link
Contributor Author

mattmoor commented Jul 6, 2017

rebased after the fast push/pull stuff was merged through.

@mattmoor
Copy link
Contributor Author

@dlorenc Ping

@mattmoor mattmoor merged commit 592f373 into bazelbuild:master Jul 10, 2017
sudarshang pushed a commit to sudarshang/rules_docker that referenced this pull request Sep 26, 2019
…ld#84)

* Add missing greeter target to java-tutorial

//src/main/java/com/example/cmdline:runner currently references
//:greeter, which does not exist.

* Format all BUILD files

Generated by running .

* Update greeter to be consistent with documentation

See https://docs.bazel.build/versions/master/tutorial/java.html.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants