Skip to content

Image pull policy (#1345) - #2024

Merged
bsideup merged 12 commits into
masterfrom
image_pull_policy
Nov 27, 2019
Merged

Image pull policy (#1345)#2024
bsideup merged 12 commits into
masterfrom
image_pull_policy

Conversation

@bsideup

@bsideup bsideup commented Nov 1, 2019

Copy link
Copy Markdown
Member

See #1345 by @dmarkhas

Fixes #1324

* get exitcode from inspectExecCmd

* Update core/src/main/java/org/testcontainers/containers/Container.java

Co-Authored-By: dmarkhas <minimizer@gmail.com>

* Update core/src/main/java/org/testcontainers/containers/Container.java

Co-Authored-By: dmarkhas <minimizer@gmail.com>

* Update core/src/main/java/org/testcontainers/containers/Container.java

Co-Authored-By: dmarkhas <minimizer@gmail.com>

* Use Lombok's `@Value` in `ExecResult`

* Update Container.java

* Add image pull policy

* dont expose docker-java Image directly

* fixed pullingNonExistentImageFailsGracefully test

* fixed failing tests

* use OffsetDateTime instead of System.currentMillis

* use java.time.Instant

* make Wait and PullPolicy non-instantiable

* code review changes

* fixed failing tests

* use hamcreset anyOf

* fix ImagePullPolicyTest

* make ImageData an interface

*  revert ContainerCreationTest.java

* use java.time.Instant

* revert an unrelated change in ContainerLogsTest

* use java.time.Instant

* use redis instead of alpine in example

* use OptionalLong instead of Long in ImageData

* resolve conflict with master

* resolve conflict with master

* resolve conflict with master

* resolve conflict with master
@bsideup bsideup added this to the next milestone Nov 1, 2019
@bsideup bsideup self-assigned this Nov 1, 2019
@bsideup
bsideup marked this pull request as ready for review November 3, 2019 15:33
@bsideup
bsideup requested review from kiview and rnorth as code owners November 3, 2019 15:33
@bsideup

bsideup commented Nov 3, 2019

Copy link
Copy Markdown
Member Author

Hey @dmarkhas,

Could you please take a look and tell us if this implementation will cover your use cases? Thanks!

@dmarkhas

dmarkhas commented Nov 4, 2019

Copy link
Copy Markdown
Contributor

Hey @dmarkhas,

Could you please take a look and tell us if this implementation will cover your use cases? Thanks!

@bsideup this look great :)

Logger logger = DockerLoggerFactory.getLogger(imageName.toString());

// Does our cache already know the image?
ImageData imageData = LOCAL_IMAGES_CACHE.get(imageName);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm half tempted to suggest having an additional boolean that can be used in line 27, e.g. something like:

if (isCached && !shouldPullCached(...

Alternatively, perhaps renaming this to cachedImageData would be equivalently clear.

return false;
}

log.trace("Should pull image: {}", imageName);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have the feeling that we should always log, maybe at debug level, about the pull decision (including if we've decided not to pull!)

@kostapc

kostapc commented Nov 9, 2019

Copy link
Copy Markdown

Also covers case described in #2048

@bsideup
bsideup requested a review from rnorth November 10, 2019 21:07
@bsideup
bsideup merged commit 17d86c9 into master Nov 27, 2019
@delete-merged-branch
delete-merged-branch Bot deleted the image_pull_policy branch November 27, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for image pull policy

4 participants