Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

build: Add ability to override images with YAML #96

Closed
wants to merge 1 commit into from

Conversation

dave-tucker
Copy link
Contributor

This commit adds a schema and parsing logic for an override.yml.
This file is applied to an already parsed Moby config and will replace
all instances of the source pattern with the substitute pattern.
This allows for easy replacement of images in a config file for
development or test.

Fixes: #95

Signed-off-by: Dave Tucker dave@dtucker.co.uk

@justincormack
Copy link
Collaborator

See my comments in the issue, filenames must not be special.

@dave-tucker
Copy link
Contributor Author

Rebased and updated to add an overrides section to the YAML.

@@ -18,6 +18,7 @@ import (
)

const defaultNameForStdin = "moby"
const overrideFile = "override.yml"
Copy link
Collaborator

Choose a reason for hiding this comment

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

you need to remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch!

@dave-tucker
Copy link
Contributor Author

Removed the unused const overrideFile

This commit adds a schema and parsing logic for an override.yml.
This file is applied to an already parsed Moby config and will replace
all instances of the source pattern with the substitute pattern.
This allows for easy replacement of images in a config file for
development or test.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
@dave-tucker
Copy link
Contributor Author

Updated again to fix a bug. The AppendConfig wasn't appending the newly added Overrides section.

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

This feature seems a bit strange to me. Why does it just blanket override every image in different sections (that happens to match)? How would you override non-image properties?

Why wouldn't overrides just be one file applies over another?

@justincormack
Copy link
Collaborator

@dnephin the use case is for CI, see #95. so we can build a set of packages to test in a local registry. We don't have any use case for non-image overrides, you would just change the file. Maybe there is a better way to do this...

@dnephin
Copy link
Member

dnephin commented Jun 30, 2017

Ok, I understand the use case is pretty limited right now, but I think we should expect that more use cases will present themselves as this tool becomes more popular. We should try to design something that can be extended. I think the current design is really limited.

What do you think about supporting multiple files and applying the config of one other the other? That way every field can be updated. It would also let you override just one image if they have the same value.

@justincormack
Copy link
Collaborator

We already support multiple files. But they don't currently override, they are additive. In some cases we could support override, by saying that if the name was the same for onboot and services that will override.

@dave-tucker
Copy link
Contributor Author

Closing as the design of this feature needs more thought

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants