Skip to content

Commit 2b78c46

Browse files
authored
Merge pull request #152 from xdev-software/develop
Release
2 parents 5b085a9 + 4f42b07 commit 2b78c46

File tree

21 files changed

+271
-139
lines changed

21 files changed

+271
-139
lines changed

.github/workflows/broken-links.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
GH_TOKEN: ${{ github.token }}
3232

3333
- name: Close issue if everything is fine
34-
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != ''
34+
if: steps.lychee.outputs.exit_code == 0 && steps.find-issue.outputs.number != ''
3535
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
3636
env:
3737
GH_TOKEN: ${{ github.token }}
3838

3939
- name: Create Issue From File
40-
if: env.lychee_exit_code != 0
40+
if: steps.lychee.outputs.exit_code != 0
4141
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
4242
with:
4343
issue-number: ${{ steps.find-issue.outputs.number }}

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ jobs:
104104
runs-on: ubuntu-latest
105105
needs: [prepare-release]
106106
timeout-minutes: 60
107-
permissions:
108-
contents: read
109-
packages: write
110107
steps:
111108
- uses: actions/checkout@v4
112109

@@ -121,15 +118,17 @@ jobs:
121118
with: # running setup-java overwrites the settings.xml
122119
distribution: 'temurin'
123120
java-version: '17'
121+
server-id: github-central
122+
server-password: PACKAGES_CENTRAL_TOKEN
124123
gpg-passphrase: MAVEN_GPG_PASSPHRASE
125124
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
126125

127-
- name: Publish to Central Portal
128-
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }}
126+
- name: Publish to GitHub Packages Central
127+
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
128+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
129129
env:
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
131131
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
132-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
133132

134133
- name: Set up JDK
135134
uses: actions/setup-java@v4

.github/workflows/sonar.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

.github/workflows/test-deploy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ jobs:
1010
publish-maven:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 60
13-
permissions:
14-
contents: read
15-
packages: write
1613
steps:
1714
- uses: actions/checkout@v4
1815

@@ -21,14 +18,16 @@ jobs:
2118
with: # running setup-java overwrites the settings.xml
2219
distribution: 'temurin'
2320
java-version: '17'
21+
server-id: github-central
22+
server-password: PACKAGES_CENTRAL_TOKEN
2423
gpg-passphrase: MAVEN_GPG_PASSPHRASE
2524
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
2625

27-
- name: Publish to GitHub Packages
28-
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }}
26+
- name: Publish to GitHub Packages Central
27+
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
2928
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
3029
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
3231
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
3332

3433
- name: Set up JDK

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.1.0
2+
* Add customizer for ``TransferArchiveTARCompressor``
3+
* Create more predefined FileContentModifiers
4+
* This allows to e.g. remove not needed Maven modules when building
5+
16
# 2.0.2
27
* Don't try to pull reserved ``scratch`` image during build
38

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/testcontainers-advanced-imagebuilder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/testcontainers-advanced-imagebuilder)
22
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/testcontainers-advanced-imagebuilder/check-build.yml?branch=develop)](https://github.com/xdev-software/testcontainers-advanced-imagebuilder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_testcontainers-advanced-imagebuilder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_testcontainers-advanced-imagebuilder)
43

54
# Advanced Image-Builder for Testcontainers Java
65

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>testcontainers-advanced-imagebuilder-root</artifactId>
9-
<version>2.0.3-SNAPSHOT</version>
9+
<version>2.1.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>

testcontainers-advanced-imagebuilder-demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<groupId>software.xdev</groupId>
99
<artifactId>testcontainers-advanced-imagebuilder-root</artifactId>
10-
<version>2.0.3-SNAPSHOT</version>
10+
<version>2.1.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>testcontainers-advanced-imagebuilder-demo</artifactId>
14-
<version>2.0.3-SNAPSHOT</version>
14+
<version>2.1.0-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>

testcontainers-advanced-imagebuilder-demo/src/main/java/software/xdev/Application.java

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package software.xdev;
22

3+
import java.nio.file.Path;
34
import java.nio.file.Paths;
5+
import java.util.List;
46

7+
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
58
import org.slf4j.LoggerFactory;
69

710
import software.xdev.testcontainers.imagebuilder.AdvancedImageFromDockerFile;
811
import software.xdev.testcontainers.imagebuilder.compat.DockerfileCOPYParentsEmulator;
12+
import software.xdev.testcontainers.imagebuilder.transfer.fcm.FileLinesContentModifier;
913

1014

1115
public final class Application
@@ -25,13 +29,46 @@ public static void main(final String[] args)
2529
".md",
2630
".cmd",
2731
"/renovate.json5",
28-
// We need to keep the pom.xml as maven can't resolve the modules otherwise
29-
"testcontainers-advanced-imagebuilder/src/**",
30-
"testcontainers-advanced-imagebuilder-demo/src/**"
32+
"testcontainers-advanced-imagebuilder/**",
33+
"testcontainers-advanced-imagebuilder-demo/**"
3134
)
3235
.withDockerFilePath(Paths.get("../testcontainers-advanced-imagebuilder-demo/Dockerfile"))
3336
.withBaseDir(Paths.get("../"))
34-
.withDockerFileLinesModifier(new DockerfileCOPYParentsEmulator());
37+
.withDockerFileLinesModifier(new DockerfileCOPYParentsEmulator())
38+
// Only copy the required maven modules and remove the not required ones
39+
.withTransferArchiveTARCompressorCustomizer(c -> c.withContentModifier(
40+
new FileLinesContentModifier()
41+
{
42+
@Override
43+
public boolean shouldApply(
44+
final Path sourcePath,
45+
final String targetPath,
46+
final TarArchiveEntry tarArchiveEntry)
47+
{
48+
return "pom.xml".equals(targetPath);
49+
}
50+
51+
@Override
52+
public List<String> modify(
53+
final List<String> lines,
54+
final Path sourcePath,
55+
final String targetPath,
56+
final TarArchiveEntry tarArchiveEntry)
57+
{
58+
return lines.stream()
59+
// Only keep the dummy-app submodule as this is only needed for building
60+
.filter(s -> !(s.contains("<module>testcontainers-advanced-imagebuilder")
61+
&& !s.contains("<module>testcontainers-advanced-imagebuilder-dummy-app")))
62+
.toList();
63+
}
64+
65+
@Override
66+
public boolean isIdentical(final List<String> original, final List<String> created)
67+
{
68+
return original.size() == created.size();
69+
}
70+
}
71+
));
3572

3673
final String imageName = builder.get();
3774

0 commit comments

Comments
 (0)