-
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
CHE-4197: Apply CHE_DOCKER_ALWAYS__PULL__IMAGE to container creation #5112
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
...er-client/src/main/java/org/eclipse/che/plugin/docker/client/params/ListImagesParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.plugin.docker.client.params; | ||
|
||
import org.eclipse.che.plugin.docker.client.json.Filters; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Arguments holder for {@link org.eclipse.che.plugin.docker.client.DockerConnector#listImages(ListImagesParams)}. | ||
* | ||
* @author Mykola Morhun | ||
*/ | ||
public class ListImagesParams { | ||
|
||
private Boolean all; | ||
private Filters filters; | ||
private Boolean digests; | ||
|
||
/** | ||
* Creates arguments holder. | ||
*/ | ||
public static ListImagesParams create() { | ||
return new ListImagesParams(); | ||
} | ||
|
||
private ListImagesParams() {} | ||
|
||
/** | ||
* Adds all flag to this parameters. | ||
* | ||
* @param all | ||
* if true show all images. | ||
* Only images from a final layer (no children) are shown by default. | ||
* @return this params instance | ||
*/ | ||
public ListImagesParams withAll(Boolean all) { | ||
this.all = all; | ||
return this; | ||
} | ||
|
||
/** | ||
* Adds filters to this parameters. | ||
* | ||
* @param filters | ||
* Available filters: | ||
* <ul> | ||
* <li><code>before</code>=(<code><image-name>[:<tag>]</code>, <code><image id></code> or <code><image@digest></code>)</li> | ||
* <li><code>dangling=true</code></li> | ||
* <li><code>label=key</code> or <code>label="key=value"</code> of an image label</li> | ||
* <li><code>reference</code>=(<code><image-name>[:<tag>]</code>)</li> | ||
* <li><code>since</code>=(<code><image-name>[:<tag>]</code>, <code><image id></code> or <code><image@digest></code>)</li> | ||
* </ul> | ||
* @return this params instance | ||
*/ | ||
public ListImagesParams withFilters(Filters filters) { | ||
this.filters = filters; | ||
return this; | ||
} | ||
|
||
/** | ||
* Adds all flag to this parameters. | ||
* | ||
* @param digests | ||
* if true show digest information on each image | ||
* @return this params instance | ||
*/ | ||
public ListImagesParams withDigestst(Boolean digests) { | ||
this.digests = digests; | ||
return this; | ||
} | ||
|
||
public Boolean getAll() { | ||
return all; | ||
} | ||
|
||
public Filters getFilters() { | ||
return filters; | ||
} | ||
|
||
public Boolean getDigests() { | ||
return digests; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ListImagesParams that = (ListImagesParams)o; | ||
return Objects.equals(all, that.all) && | ||
Objects.equals(filters, that.filters) && | ||
Objects.equals(digests, that.digests); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(all, filters, digests); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...lient/src/test/java/org/eclipse/che/plugin/docker/client/params/ListImagesParamsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.plugin.docker.client.params; | ||
|
||
import org.eclipse.che.plugin.docker.client.json.Filters; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
/** | ||
* @author Mykola Morhun | ||
*/ | ||
public class ListImagesParamsTest { | ||
|
||
private static final boolean WITH_ALL = true; | ||
private static final boolean WITH_DIGEST = true; | ||
private static final Filters FILTERS = new Filters().withFilter("reference", "imageName"); | ||
|
||
private ListImagesParams listImagesParams; | ||
|
||
@Test | ||
public void shouldCreateParamsObjectWithAllPossibleParameters() { | ||
listImagesParams = ListImagesParams.create() | ||
.withAll(WITH_ALL) | ||
.withDigestst(WITH_DIGEST) | ||
.withFilters(FILTERS); | ||
|
||
assertTrue(listImagesParams.getAll() == WITH_ALL); | ||
assertTrue(listImagesParams.getDigests() == WITH_DIGEST); | ||
assertEquals(listImagesParams.getFilters(), FILTERS); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In my opinion, this code would be more clear if operands wouldn't rely on remembering operations priority. E.g. next equivalent code looks clearer for me:
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.
I divided this with new line, but I do not mind about brackets. Let be so.