-
Notifications
You must be signed in to change notification settings - Fork 1.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
CODENVY-560 : new types of docker recipes, remove InstanceKey, rework InstanceProvider #1366
Conversation
ok with me |
This PR can't be merged, please rebase |
* Alternate way is to provide a location | ||
* @param content the content instead of an external link like with location | ||
*/ | ||
void setContent(String content); |
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 don't use setters in model interfaces
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.
ok
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.
fixed
Build # 728 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/728/ to view the results. |
Build # 742 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/742/ to view the results. |
machine.getId(), | ||
userName, | ||
machine.getConfig().getName()); | ||
protected Instance doCreateInstanceImage(final Machine machine, String machineContainerName, |
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 method returns Instance which is representation of the container. Please rename this method.
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.
It's creating instance for type image si method name is accurate
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.
It looks to me as create instance of image
instead of create instance from image
. But if you don't want to change then ok.
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.
createInstanceFromImage() ?
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.
+1
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.
fixed
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.
thx
are we good now ? |
if (registry == null || repository == null) { | ||
LOG.error("Failed to remove instance snapshot: invalid instance key: {}", instanceKey); | ||
LOG.error("Failed to remove instance snapshot: invalid instance key: {}", dockerMachineSource); |
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.
It is not instance key anymore
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.
ok
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.
fixed
* it's based on optional registry followed by repository name followed by a digest or a tag | ||
* Examples are available in the test. | ||
*/ | ||
public static final Pattern IMAGE_PATTERN = Pattern.compile("^((?<registry>[^/]++)(?:\\/))?(?<repository>.*?)((?:\\:)(?<tag>.*?))?((?:@)(?<digest>.*))?$"); |
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.
As far as I can see this regexp is not tested. Please review your tests.
Also it looks like
user/repo will be treated as registry user and repository repo
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.
There is a current class DockerMachineSourceTest with REGEXP being tested by constructor calls
Also now it's delegating to DockerMachineIdentifierParser
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.
Thx
LGTM |
* Converts {@link MachineSource} to {@link MachineSourceDto}. | ||
*/ | ||
public MachineSourceDto asDto(MachineSource source) { | ||
return this.dtoFactory.createDto(MachineSourceDto.class).withType(source.getType()).withLocation(source.getLocation()).withContent(source.getContent()); |
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.
wrap lines? Would it be more readable?
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.
done
ok |
…ove InstanceKey #1 new docker recipe type currently we have type:"dockerfile", location: "http://path-to-recipe" now we could provide type:"dockerfile", content: "FROM codenvy/foo\nENV FLORENT=TRUE\" and type:"image", location or content: "codenvy/foo" #2 InstanceKey Up to now, InstanceKey was used to perform snapshot recovery. But machine source is a way to provide this information. So remove InstanceKey and replace it by MachineSource (and DockerMachineSource instead of DockerInstanceKey) InstanceProvider: void removeInstanceSnapshot(InstanceKey instanceKey) --> void removeInstanceSnapshot(MachineSource machineSource) Instance: InstanceKey saveToSnapshot(String owner) --> MachineSource saveToSnapshot(String owner) #3 InstanceProvider model To avoid also that MachineManager "knows" the inner type, the recipe handling is moved to the instance provider implementation And as the snapshot handling is with MachineSource (included in MachineConfig included in Machine), no need to give extra InstanceKey parameter Replace two previous methods Instance createInstance(Recipe recipe, Machine machine, LineConsumer creationLogsOutput) Instance createInstance(InstanceKey instanceKey, Machine machine, LineConsumer creationLogsOutput) throws NotFoundException, InvalidInstanceSnapshotException, MachineException; by only one: createInstance(Machine machine, LineConsumer creationLogsOutput) Change-Id: Ia7ea97bc1a44059b4892f5db387f54f2e1709fa3 Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
Build # 752 - FAILED Please check console output at http://ci.codenvy-dev.com/jenkins/job/che-pullrequests-build/752/ to view the results. |
1. new docker recipe type
currently we have type:"dockerfile", location: "http://path-to-recipe"
now we could provide
type:"dockerfile", content: "FROM codenvy/foo\nENV FLORENT=TRUE"
and
type:"image", location : "codenvy/foo"
2. InstanceKey
Up to now, InstanceKey was used to perform snapshot recovery.
But machine source is a way to provide this information.
So remove InstanceKey and replace it by MachineSource (and DockerMachineSource instead of DockerInstanceKey)
InstanceProvider:
void removeInstanceSnapshot(InstanceKey instanceKey)
--> void removeInstanceSnapshot(MachineSource machineSource)
Instance:
InstanceKey saveToSnapshot(String owner)
--> MachineSource saveToSnapshot(String owner)
3. InstanceProvider model
To avoid also that MachineManager "knows" the inner type, the recipe handling is moved to the instance provider implementation
And as the snapshot handling is with MachineSource (included in MachineConfig included in Machine), no need to give extra InstanceKey parameter
Replace two previous methods
Instance createInstance(Recipe recipe,
Machine machine,
LineConsumer creationLogsOutput)
Instance createInstance(InstanceKey instanceKey,
Machine machine,
LineConsumer creationLogsOutput) throws NotFoundException, InvalidInstanceSnapshotException, MachineException;
by only one:
createInstance(Machine machine,
LineConsumer creationLogsOutput)
Change-Id: Ia7ea97bc1a44059b4892f5db387f54f2e1709fa3
Signed-off-by: Florent BENOIT fbenoit@codenvy.com