Skip to content

Commit

Permalink
Merge pull request #342 from xenit-eu/DEVEM-545-composev2
Browse files Browse the repository at this point in the history
Support docker compose v2
  • Loading branch information
vierbergenlars authored Aug 6, 2024
2 parents 3324187 + 1a3f384 commit c9e04e3
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 30 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
name: "build"
runs-on: ubuntu-latest
env:
TEST_GRADLE_VERSION: 6.7
TEST_GRADLE_VERSION: 7.6
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Pull docker images
run: 'parallel docker pull -- xenit/alfresco-repository-skeleton:6.0 alfresco/alfresco-content-repository-community:6.0.7-ga tomcat:7-jre8 hello-world alpine:edge'
- name: Check
Expand Down Expand Up @@ -49,18 +49,16 @@ jobs:
strategy:
matrix:
gradle-versions:
- 6.2,6.3,6.4
- 6.5,6.6,6.7
- 6.8,6.9,7.0
- 7.1,7.2,7.3
- 7.4,7.5,7.6
- 6.2,6.9
- 7.0,7.6
- 8.0,8.9
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Pull docker images
run: 'parallel docker pull -- alfresco/alfresco-content-repository-community:6.0.7-ga tomcat:7-jre8 hello-world alpine:edge'
- name: Check
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Alfresco Docker Gradle Plugins - Changelog


## Version 5.5.0 - 2024-08-06

> [!warning]
> This release drops support for Java < 11
> The docker-compose plugins drop support for Gradle < 7.0
### Changed

* [#342](https://github.com/xenit-eu/alfresco-docker-gradle-plugin/pull/342) - Support docker compose v2


## Version 5.4.0 - 2023-02-02

### Dependencies
Expand Down
10 changes: 10 additions & 0 deletions UPGRADING-5.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Upgrade guide: 5.4 -> 5.5

This version uses docker compose v2 by default. If you still want to keeping using docker-compose v1 instead, put:

```groovy
dockerCompose {
useDockerComposeV2 = false
}
```

8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocatio

group 'eu.xenit.gradle'

sourceCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

configurations {
packaged
Expand Down Expand Up @@ -132,7 +136,7 @@ dependencies {
}

implementation 'com.bmuschko:gradle-docker-plugin:9.3.1'
implementation 'com.avast.gradle:gradle-docker-compose-plugin:0.16.12'
implementation 'com.avast.gradle:gradle-docker-compose-plugin:0.17.7'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation 'org.hamcrest:hamcrest-core:2.2'
testImplementation gradleTestKit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.gradle.testkit.runner.BuildResult;
Expand Down Expand Up @@ -44,20 +41,11 @@ public static Collection<Object[]> testData() {
});
}
return Arrays.asList(new Object[][]{
{"7.6"},
{"7.5.1"},
{"7.4.2"},
{"7.3.3"},
{"7.2"},
{"7.1.1"},
{"8.9"},
{"8.0.1"},
{"7.6.4"},
{"7.0.2"},
{"6.9.3"},
{"6.8.3"},
{"6.7.1"},
{"6.6.1"},
{"6.5.1"},
{"6.4.1"},
{"6.3"},
{"6.2.2"},
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package eu.xenit.gradle.testrunner;

import static org.junit.Assume.assumeThat;
import static org.junit.Assume.assumeTrue;

import org.gradle.util.GradleVersion;
import org.hamcrest.Matchers;
import org.junit.Test;

import java.io.IOException;
Expand Down Expand Up @@ -43,26 +45,31 @@ public void testApplyAmpsExample() throws IOException {

@Test
public void testExampleDockerPlugin() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
testProjectFolder(EXAMPLES.resolve("example-docker-plugin"));
}

@Test
public void testExampleDockerPluginLegacy() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
testProjectFolder(EXAMPLES.resolve("example-docker-plugin-legacy"));
}

@Test
public void testComposeUp() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
testProjectFolder(EXAMPLES.resolve("example-docker-plugin"), ":integrationTest");
}

@Test
public void testDockerComposeAutoExample() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
testProjectFolder(EXAMPLES.resolve("docker-compose-auto-example"), ":integrationTest");
}

@Test
public void testDockerComposeExample() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
testProjectFolder(EXAMPLES.resolve("docker-compose-example"), ":integrationTest");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeThat;

import eu.xenit.gradle.docker.alfresco.tasks.extension.internal.DockerfileWithWarsExtensionImpl;
import java.io.IOException;
Expand All @@ -12,6 +13,8 @@
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.BuildTask;
import org.gradle.testkit.runner.TaskOutcome;
import org.gradle.util.GradleVersion;
import org.hamcrest.Matchers;
import org.junit.Ignore;
import org.junit.Test;

Expand Down Expand Up @@ -81,6 +84,7 @@ public void testDockerAlfrescoPluginWithoutConfiguration() throws IOException {

@Test
public void testAlfrescoAmpDependencyOrder() throws IOException {
assumeThat("The amp plugin requires Gradle 7.1", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.1")));
testProjectFolder(REPRODUCTIONS.resolve("alfresco-amp-dependency-order"), ":applyAlfrescoAmp");

}
Expand All @@ -103,6 +107,7 @@ public void testIssue97() throws IOException {

@Test
public void testIssue96() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
final String folder = "issue-96";
final String task = ":buildDockerImage";

Expand All @@ -116,6 +121,7 @@ public void testIssue96() throws IOException {

@Test
public void testIssue104() throws IOException {
assumeThat("The docker-compose plugin requires Gradle 7", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.0")));
final String folder = "issue-104";
final String task = ":functionalTest";

Expand All @@ -133,6 +139,7 @@ public void testIssue107() throws IOException {

@Test
public void testIssue50() throws IOException {
assumeThat("The amp plugin requires Gradle 7.1", GradleVersion.version(gradleVersion), Matchers.greaterThanOrEqualTo(GradleVersion.version("7.1")));
testProjectFolder(REPRODUCTIONS.resolve("issue-50"), ":alfrescoWar");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "eu.xenit.amp" version "1.0.1"
id "eu.xenit.alfresco" version "1.0.1"
id "eu.xenit.amp" version "1.2.0"
id "eu.xenit.alfresco" version "1.2.0"
id "eu.xenit.docker-alfresco"
}

Expand Down
4 changes: 2 additions & 2 deletions src/integrationTest/reproductions/issue-50/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "eu.xenit.amp" version "1.0.1"
id "eu.xenit.alfresco" version "1.0.1"
id "eu.xenit.amp" version "1.2.0"
id "eu.xenit.alfresco" version "1.2.0"
id "eu.xenit.docker-alfresco"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ protected ComposeSettings cloneAsNested(String name) {
r.setProjectNamePrefix(this.getProjectNamePrefix());

r.getExecutable().set(this.getExecutable().get());
r.getUseDockerComposeV2().set(this.getUseDockerComposeV2().get());
r.getDockerExecutable().set(this.getDockerExecutable().get());
r.getEnvironment().set(new HashMap<String, Object>(this.getEnvironment().get()));
r.getEnvironment().set(new HashMap<>(this.getEnvironment().get()));

r.getDockerComposeWorkingDirectory().set(this.getDockerComposeWorkingDirectory().getOrNull());
r.getDockerComposeStopTimeout().set(this.getDockerComposeStopTimeout().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.avast.gradle.dockercompose.ComposeSettings;
import eu.xenit.gradle.docker.config.DockerConfigPlugin;
import eu.xenit.gradle.docker.internal.GradleVersionRequirement;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

Expand All @@ -13,6 +14,7 @@ public class DockerComposePlugin implements Plugin<Project> {

@Override
public void apply(Project project) {
GradleVersionRequirement.atLeast("7.0", String.format("use the %s plugin", PLUGIN_ID));
dockerComposeConvention = project.getExtensions()
.create("dockerCompose", DockerComposeExtensionOverride.class, project);
project.getPluginManager().apply(DockerConfigPlugin.class);
Expand Down

0 comments on commit c9e04e3

Please sign in to comment.