-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow extra options to be passed to docker build #142
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
A disadvantage of using a dict is that repeated arguments aren't allowed. |
I support adding this feature! Good point @manics! Go for a list, and the name should be more explicit i think. Args is too vague as it there are both docker build args and docker push args, and even helm cli args of possible relevance. Perhaps dockerBuildArgs or maybe with an extra prefix so it is extraDockerBuildArgs. |
@consideRatio I chose Since the docker build documentation calls these "options" I thought it was a good choice (here's the command interface from their docs Here's a more full example of a chartpress.yaml that would use this key. I made the charts:
- name: some-jupyter-hub
imagePrefix: a-nice-prefix/
images:
k8s-hub:
valuesPath: hub.image
buildArgs:
TIMEOUT: "15m"
COMMIT_REF: "1.4.5"
extraOptions:
- rm # uses default value
- label: "maintainer=octocat"
- label: "version=0.1.0"
- ssh: "default=secrets/secret-auth-key" I'll implement the list, and please let me know what you think would be the best key name! |
Great point about the @manics, what do you think about the naming? I'm generally in favor of any name, almost no matter how long it is, that makes it quite clear directly from the name what it does. I think I'd prefer an API that minimizes complexity and embedded logic, so for example... charts:
- name: some-jupyter-hub
imagePrefix: a-nice-prefix/
images:
k8s-hub:
valuesPath: hub.image
buildArgs:
TIMEOUT: "15m"
COMMIT_REF: "1.4.5"
extraBuildCommandArgs:
- --rm
- --label=maintainer=octocat
- --label=version=0.1.0
- --ssh=default=secrets/secret-auth-key
# Equivalently, one can split apart a args key/value into
# two separate elements in the list.
# extraBuildCommandArgs:
# - --rm
# - --label
# - maintainer=octocat
# - --label
# - version=0.1.0
# - --ssh
# - default=secrets/secret-auth-key We currently have buildArgs support a structure like above though, where it's key/values are the value of the --build-arg flag... hmmm.... Brainstorming:
Perhaps @manics @minrk could join in and opine on this?
I'm leaning towards |
I think I think the mix of single values and dicts adds unnecessary complexity. These arguments are being passed directly to a command line program which expects a list of strings, so let's keep it as that? |
I do think a simple opaque list of strings to pass through is the way to go. One more option is to specify For the extra options path, to avoid confusion with |
It seems like a list of strings and a name like (I'll leave the other suggestion about the full command for now because I'm not sure how that would play with the other chartpress keys.) |
Sounds great to me, thank you @adamblake! I think the name |
- Use more explicitly named key extraBuildCommandOptions to more clearly convey what the key will do - Update README with example usage - Change extraBuildCommandOptions to accept a list of strings - Add tests
I would fix the issue with the pre_commit GitHub Action, but I don't understand the error. I did run |
The options should be a list of strings now; dicts are not allowed.
Thank you @adamblake for the PR and @manics and @minrk for review!! 🎉 ❤️ |
This is a first pass at implementing #141 (Ability to include extra options to
docker build
). It allows users to specify extra build options in chartpress.yaml on a per-image basis. This is useful for taking advantage of other build options that chartpress does not explicitly support.I am not very familiar with pytest, so there are no tests included here. I can confirm that it is working using the --ssh option to clone a private GitHub repo in my local builds.