Skip to content

Specifying client config.json with Bazel label - #2032

Merged
gravypod merged 2 commits into
bazelbuild:masterfrom
linzhp:config
Feb 28, 2022
Merged

Specifying client config.json with Bazel label#2032
gravypod merged 2 commits into
bazelbuild:masterfrom
linzhp:config

Conversation

@linzhp

@linzhp linzhp commented Feb 26, 2022

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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

@linzhp

linzhp commented Feb 26, 2022

Copy link
Copy Markdown
Collaborator Author

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

linzhp commented Feb 26, 2022

Copy link
Copy Markdown
Collaborator Author

@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
Copy Markdown
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