Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/linux-build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
with:
distribution: 'zulu'
java-version: 21
- name: Clean Docker environment before tests
run: |
docker system prune -af --volumes
docker builder prune -af
continue-on-error: true
- name: Set up Docker private registry
run: |
docker run -d -p 5000:5000 --restart=always --name registry registry:2
Expand All @@ -29,8 +34,12 @@ jobs:
run: ./gradlew test
- name: Integration tests
run: ./gradlew integrationTest
- name: Clean Docker cache
run: docker builder prune -af --filter "until=24h"
- name: Clean Docker cache before functional tests
run: |
docker system prune -af --volumes
docker builder prune -af
# Remove any dangling images that might have corrupted layers
docker images --filter "dangling=true" -q | xargs -r docker rmi -f || true
continue-on-error: true
- name: Functional tests
env:
Expand Down
9 changes: 6 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
`java-gradle-plugin`
Expand All @@ -17,9 +20,9 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JVM_11)
}
}

Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.caching=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
2 changes: 1 addition & 1 deletion gradle/buildsrc.libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
asciidoctor-jvm-plugin = "3.3.2"
asciidoctor-jvm-plugin = "5.0.0-alpha.1"
asciidoctorj-tabbed-code-extension = "0.3"
grgit = "1.9.1"
gradle-git = "1.7.1"
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugin-publish = "2.0.0"
docker-java = "3.6.0"
activation = "1.1.1"
asm = "9.9"
spock = "2.3-groovy-3.0"
spock = "2.3-groovy-4.0"
cglib-nodep = "3.3.0"
zt-zip = "1.13"
commons-vfs2 = "2.9.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/docs/asciidoc/user-guide/00-intro.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Docker remote API is handled by the https://github.com/docker-java/docker-java[D
Please refer to the library's documentation for more information on the supported Docker's client API and Docker server version.

[IMPORTANT]
This plugin requires Gradle >= 8.4.0 to work properly.
This plugin requires Gradle >= 9.2.0 to work properly.

=== Benefits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ plugins {
}

version = '1.0'
sourceCompatibility = 1.7

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ plugins {
}

version = '1.0'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,11 @@ ADD file2.txt /other/dir/file2.txt
apply plugin: com.bmuschko.gradle.docker.DockerJavaApplicationPlugin

version = '1.0'
sourceCompatibility = 8
targetCompatibility = 8

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
implementation 'org.eclipse.jetty.aggregate:jetty-all:9.4.29.v20200521'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,18 @@ class DockerSpringBootApplicationPluginFunctionalTest extends AbstractGroovyDslF
private void writeSpringBootBuildFile(String reactedPluginIdentifier) {
buildFile << """
plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
id '$reactedPluginIdentifier'
id 'com.bmuschko.docker-spring-boot-application'
}

version = '1.0'
sourceCompatibility = 8
targetCompatibility = 8

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DockerCreateContainerFunctionalTest extends AbstractGroovyDslFunctionalTes
task execContainer(type: DockerExecContainer) {
dependsOn startContainer
targetContainerId startContainer.getContainerId()
withCommand(['grep', 'tmpfs /testdata', '/proc/mounts'])
commands.add(['grep', 'tmpfs /testdata', '/proc/mounts'] as String[])
successOnExitCodes=[0]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,6 @@ LABEL maintainer=benjamin.muschko@gmail.com

then:
result.task(DOCKERFILE_TASK_PATH).outcome == TaskOutcome.UP_TO_DATE

when:
result = build(DOCKERFILE_TASK_NAME, "-PlabelVersion=1.1")

then:
result.task(DOCKERFILE_TASK_PATH).outcome == TaskOutcome.SUCCESS
}

def "can create multi-stage builds"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.bmuschko.gradle.docker

import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.JavaApplication
import org.gradle.testfixtures.ProjectBuilder

class DockerJavaApplicationPluginIntegrationTest extends AbstractIntegrationTest {
Expand Down Expand Up @@ -40,12 +40,13 @@ class DockerJavaApplicationPluginIntegrationTest extends AbstractIntegrationTest
when:
project.apply(plugin: 'application')
project.apply(plugin: DockerJavaApplicationPlugin)
def application = project.extensions.getByType(JavaApplication)

then:
DockerBuildImage task = project.tasks.findByName(DockerJavaApplicationPlugin.BUILD_IMAGE_TASK_NAME)
Set<String> images = task.images.get()
images.size() == 1
images.first() == "${project.applicationName}:latest"
images.first() == "${application.applicationName}:latest"
}

def "Configures image task without project group and but with version"() {
Expand All @@ -55,12 +56,13 @@ class DockerJavaApplicationPluginIntegrationTest extends AbstractIntegrationTest
when:
project.version = projectVersion
applyDockerJavaApplicationPluginAndApplicationPlugin(project)
def application = project.extensions.getByType(JavaApplication)

then:
DockerBuildImage task = project.tasks.findByName(DockerJavaApplicationPlugin.BUILD_IMAGE_TASK_NAME)
Set<String> images = task.images.get()
images.size() == 1
images.first() == "${project.applicationName}:${projectVersion}"
images.first() == "${application.applicationName}:${projectVersion}"
}

def "Configures image task with project group and version"() {
Expand All @@ -72,12 +74,13 @@ class DockerJavaApplicationPluginIntegrationTest extends AbstractIntegrationTest
project.group = projectGroup
project.version = projectVersion
applyDockerJavaApplicationPluginAndApplicationPlugin(project)
def application = project.extensions.getByType(JavaApplication)

then:
DockerBuildImage task = project.tasks.findByName(DockerJavaApplicationPlugin.BUILD_IMAGE_TASK_NAME)
Set<String> images = task.images.get()
images.size() == 1
images.first() == "${projectGroup}/${project.applicationName}:${projectVersion}"
images.first() == "${projectGroup}/${application.applicationName}:${projectVersion}"
}

def "Can access the dockerJava.javaApplication extension dynamically"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,29 +235,6 @@ protected void doRunRemoteCommand(DockerClient dockerClient) throws InterruptedE
}
}

/**
* Convenience method for adding commands.
*
* @param commandsToExecute The commands to execute
* @deprecated Use the method named {@link #getCommands()} directly
*/
@Deprecated
public void withCommand(List<String> commandsToExecute) {
withCommand(commandsToExecute.toArray(String[]::new));
}

/**
* Convenience method for adding commands.
*
* @param commandsToExecute The commands to execute
* @deprecated Use the method named {@link #getCommands()} directly
*/
@Deprecated
public void withCommand(String[] commandsToExecute) {
if (commandsToExecute != null) {
commands.add(commandsToExecute);
}
}

private void setContainerCommandConfig(ExecCreateCmd containerCommand, String[] commandToExecute) {
if (commandToExecute != null) {
Expand Down
Loading