-
Notifications
You must be signed in to change notification settings - Fork 2k
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 'build' to types.go #481
Conversation
cb598dd
to
081642f
Compare
ping @vdemeester @dnephin This unblocks us on kubernetes/kompose#636 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the other fields are added please add them to the full-example.yml as well.
cli/compose/types/types.go
Outdated
type BuildConfig struct { | ||
Context string | ||
Dockerfile string | ||
Args map[string]*string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks incomplete. It should have all the fields from here:
cli/cli/compose/schema/data/config_schema_v3.4.json
Lines 84 to 90 in e600621
"context": {"type": "string"}, | |
"dockerfile": {"type": "string"}, | |
"args": {"$ref": "#/definitions/list_or_dict"}, | |
"labels": {"$ref": "#/definitions/list_or_dict"}, | |
"cache_from": {"$ref": "#/definitions/list_of_strings"}, | |
"network": {"type": "string"}, | |
"target": {"type": "string"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnephin I'm following @vdemeester 's implementation, but sure, I'll add the other options.
cli/compose/types/types.go
Outdated
@@ -6,7 +6,6 @@ import ( | |||
|
|||
// UnsupportedProperties not yet supported by this implementation of the compose file | |||
var UnsupportedProperties = []string{ | |||
"build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep build
in the list of unsupported properties because it's still not used by the cli right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnephin Okay 👍
Man you're fast, I'm just fixing the tests failing now @dnephin I've already added the Other than that, it's adding the rest of the types from the schema document. |
be81f80
to
e0255ba
Compare
Problem I have @dnephin in regards to adding |
The test failure is because the example config in that test is using a string for build:
context: ./web Unsupported properties are only used as a warning, and that warning comes from the cli, not from the |
Design LGTM 🐸 |
Perfect, thank you @dnephin for the explanation. I wasn't too sure about removing I've gone ahead and removed it, hopefully tests pass this time now! Also greetings fellow Canadian 🇨🇦 |
e0255ba
to
a8c0201
Compare
Adding WIP tag so I make sure to do two things:
|
a8c0201
to
26b406c
Compare
Hey @vdemeester @dnephin is it possible to help out with the failing test? Not too sure what's happening TBH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the test failures are related to changes in this PR.
One problem I notice is that there are tabs in your yaml examples, which are invalid. It must be spaces.
26b406c
to
0645adf
Compare
@dnephin Finally passes! But looks like the tests flaked / need rebuilding on circleci. I'm going to update my commit message and see if it fixes it. |
0645adf
to
7dbd194
Compare
Codecov Report
@@ Coverage Diff @@
## master #481 +/- ##
==========================================
- Coverage 49.06% 48.62% -0.45%
==========================================
Files 200 199 -1
Lines 16407 16396 -11
==========================================
- Hits 8050 7972 -78
- Misses 7938 8008 +70
+ Partials 419 416 -3 |
Ayyy, tests pass 👍 |
cli/compose/types/types.go
Outdated
CapAdd []string `mapstructure:"cap_add"` | ||
CapDrop []string `mapstructure:"cap_drop"` | ||
CgroupParent string `mapstructure:"cgroup_parent"` | ||
Build BuildConfig `mapstructure:"build"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a problem, but technically you don't need the mapstructure annotation here, since it defaults to build
cli/compose/types/types.go
Outdated
Dockerfile string | ||
Args MappingWithEquals | ||
Labels Labels | ||
CacheFrom StringList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one will need a mapstructure:
annotation because it defaults to using a dash instead of an underscore to separate the words.
context: ./dir | ||
dockerfile: Dockerfile | ||
args: | ||
foo: bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the other fields (target, network, cache_from, labels) to this as well.
@cdrage can you address the review comments? |
c38a892
to
452cd21
Compare
This adds 'build' to types.go in order for projects that use docker/cli to parse Docker Compose files to correctly retrieve `build` keys Signed-off-by: Charlie Drage <charlie@charliedrage.com>
452cd21
to
9bdb076
Compare
Done! Updated the full-example.yml as well as the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🦁
Updated vendoring for getting changes from docker/cli for build key in v3 (since docker/cli#481 is merged now)
Resolves kubernetes#636 This PR will add support for `build` in docker compose v3. As docker/cli#481 got merged now
Resolves kubernetes#636 This PR will add support for `build` in docker compose v3. As docker/cli#481 got merged now
Resolves kubernetes#636 This PR will add support for `build` in docker compose v3. As docker/cli#481 got merged now
This adds 'build' to types.go in order for projects that use docker/cli
to parse Docker Compose files to correctly retrieve
build
keys.