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

Specifying client config.json with Bazel label #2032

Merged
merged 2 commits into from
Feb 28, 2022

Conversation

linzhp
Copy link
Collaborator

@linzhp linzhp commented Feb 26, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The client_config attribute of docker_toolchain_configure only accepts an absolute path to a directory. This is not portable, because absolute paths are machine dependent.

Issue Number: N/A

What is the new behavior?

Allow the client_config attribute of docker_toolchain_configure to accept a Bazel label to the config.json file, so we can check the file into a repository and check out the repository anywhere.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Ideally, we should declare docker_client_config attribute of container_pull as a label instead of a string, so the changes in the content of client config will invalidate the cache and trigger a rebuild. However, this will be a backward-incompatible change, as absolute paths will no longer work. What do you think?

@gravypod
Copy link
Collaborator

This looks good. Is there any specific use case you're attempting to satisfy here @linzhp?

@linzhp
Copy link
Collaborator Author

linzhp commented Feb 26, 2022

Yes, we want to configure the credHelpers in config.json, so we can access our internal docker registry with a custom authentication, but we don't want require all dev and CI machines to check out our repository in exactly the same location. So we hope to have something like:

    docker_toolchain_configure(
        name = "docker_config",
        client_config = "@//third_party/docker/registry/config:config.json",
    )

@linzhp
Copy link
Collaborator Author

linzhp commented Feb 26, 2022

@gravypod What's the process to merge a PR after getting approved? I saw #2000 was also approved, but not merged for a long time.

@gravypod gravypod merged commit a17900c into bazelbuild:master Feb 28, 2022
@gravypod
Copy link
Collaborator

Thanks @linzhp. Just wanted to get a "reason" on the issue so that when someone Googles "how do I X rules_docker" they find this page :)

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