-
Notifications
You must be signed in to change notification settings - Fork 18
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 chromium container #1
Merged
Merged
Changes from all commits
Commits
Show all changes
2 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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
src/main/kotlin/com/atlassian/performance/tools/dockerinfrastructure/Ryuk.kt
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,48 @@ | ||
package com.atlassian.performance.tools.dockerinfrastructure | ||
|
||
import org.testcontainers.DockerClientFactory | ||
import org.testcontainers.dockerclient.DockerClientProviderStrategy | ||
import java.util.* | ||
import java.util.concurrent.atomic.AtomicBoolean | ||
|
||
/** | ||
* Test containers 1.9.1 doesn't work with Bitbucket pipelines. | ||
* Test containers start a docker with Ryuk. Ryuk needs to mount the docker socket, and this is forbidden in Bitbucket pipelines. | ||
* Ryuk isn't a critical feature. It makes after test docker container cleanup more robust. | ||
* This class is a hack to disable the feature. | ||
* Sorry for the hack, but I neither understand how to fix Ryuk problems, neither want to fork and release forked test-containers. | ||
* | ||
* See: | ||
* https://github.com/testcontainers/testcontainers-java/issues/712 | ||
* | ||
* Please remove it after the issue resolved, and keep the class updated when upgrading test-containers. | ||
*/ | ||
internal object Ryuk { | ||
private val initialized = AtomicBoolean(false) | ||
|
||
internal fun disable() { | ||
val dockerClientFactory = DockerClientFactory.instance() | ||
synchronized(dockerClientFactory) { | ||
if (this.initialized.get().not()) { | ||
val configurationStrategies = ArrayList<DockerClientProviderStrategy>() | ||
ServiceLoader.load(DockerClientProviderStrategy::class.java).forEach { cs -> configurationStrategies.add(cs) } | ||
val strategy = DockerClientProviderStrategy.getFirstValidStrategy(configurationStrategies) | ||
val client = strategy.getClient() | ||
val version = client.versionCmd().exec() | ||
val activeApiVersion = DockerClientFactory::class.java.getDeclaredField("activeApiVersion") | ||
activeApiVersion.isAccessible = true | ||
activeApiVersion.set(dockerClientFactory, version.getApiVersion()) | ||
|
||
val dockerInfo = client.infoCmd().exec() | ||
val activeExecutionDriver = DockerClientFactory::class.java.getDeclaredField("activeExecutionDriver") | ||
activeExecutionDriver.isAccessible = true | ||
activeExecutionDriver.set(dockerClientFactory, dockerInfo.getExecutionDriver()) | ||
|
||
val initialized = DockerClientFactory::class.java.getDeclaredField("initialized") | ||
initialized.isAccessible = true | ||
initialized.set(dockerClientFactory, true) | ||
this.initialized.set(true) | ||
} | ||
} | ||
} | ||
} |
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.
Soon, we will make it possible to disable Ryuk if you env allows it :) See testcontainers/testcontainers-java#1023
Good that you have a workaround meanwhile!
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.
Great to hear that. Disabling Ryuk will still be a workaround, but more straightforward and managed on the product's side. Are there any plans to make Ryuk work on BB pipelines?
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.
Well, it used to work but then there was some change on BB side and it got broken.
We track the current state of BitBucket here:
testcontainers/testcontainers-java#700 (comment)
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.
@wyrzyk FYI testcontainers/testcontainers-java#700 (comment)