Skip to content

Commit a329b7d

Browse files
committed
refactor: remove deprecated Docker support and Testcontainers module
- Deleted Docker-related files (`Dockerfile`, `.dockerignore`, `kdc-entrypoint.sh`). - Removed Testcontainers module and E2E test dependencies. - Updated build configuration (`pom.xml`, parent modules) to exclude Docker and Testcontainers artifacts. - Cleaned up GitHub Actions workflow to disable Docker image handling.
1 parent ff2aa8b commit a329b7d

11 files changed

Lines changed: 563 additions & 49 deletions

File tree

.dockerignore

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

.github/workflows/docker-image.yaml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ permissions:
2727
contents: read
2828
packages: write
2929

30-
env:
31-
IMAGE_NAME: ghcr.io/${{ github.repository }}/kerby-kdc
32-
3330
jobs:
3431
build:
3532
runs-on: ubuntu-latest
@@ -39,6 +36,13 @@ jobs:
3936
- name: Checkout repository
4037
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4138

39+
- name: Set up JDK 8
40+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
41+
with:
42+
java-version: '8'
43+
distribution: 'temurin'
44+
cache: maven
45+
4246
- name: Set up Docker Buildx
4347
uses: docker/setup-buildx-action@v3
4448

@@ -50,38 +54,33 @@ jobs:
5054
username: ${{ github.actor }}
5155
password: ${{ secrets.GITHUB_TOKEN }}
5256

53-
- name: Extract project version
54-
id: project
57+
- name: Extract image metadata
58+
id: image
5559
shell: bash
5660
run: |
61+
image_name="ghcr.io/${GITHUB_REPOSITORY,,}/kerby-kdc"
62+
sha_tag="${GITHUB_SHA::8}"
5763
version="$(python3 -c "import xml.etree.ElementTree as ET; ns={'m':'http://maven.apache.org/POM/4.0.0'}; root=ET.parse('pom.xml').getroot(); version=root.find('m:version', ns); print(version.text.strip() if version is not None and version.text else '')")"
5864
if [ -z "${version}" ]; then
5965
echo "Could not find root project version in pom.xml" >&2
6066
exit 1
6167
fi
68+
echo "image_name=${image_name}" >> "${GITHUB_OUTPUT}"
69+
echo "sha_tag=${sha_tag}" >> "${GITHUB_OUTPUT}"
6270
echo "version=${version}" >> "${GITHUB_OUTPUT}"
6371
64-
- name: Extract Docker metadata
65-
id: meta
66-
uses: docker/metadata-action@v5
67-
env:
68-
DOCKER_METADATA_SHORT_SHA_LENGTH: 8
69-
with:
70-
images: ${{ env.IMAGE_NAME }}
71-
tags: |
72-
type=ref,event=branch
73-
type=ref,event=tag
74-
type=sha,format=short,prefix=
75-
type=raw,value=${{ steps.project.outputs.version }}
76-
type=raw,value=latest
72+
- name: Build Docker image with Maven
73+
run: |
74+
mvn -B -Pdist,docker -DskipTests \
75+
-Ddocker.image.name=${{ steps.image.outputs.image_name }} \
76+
-Ddocker.image.tag.sha=${{ steps.image.outputs.sha_tag }} \
77+
-pl kerby-dist/docker -am package
7778
78-
- name: Build and publish Docker image
79-
uses: docker/build-push-action@v6
80-
with:
81-
context: .
82-
file: ./Dockerfile
83-
push: ${{ github.event_name != 'pull_request' }}
84-
tags: ${{ steps.meta.outputs.tags }}
85-
labels: ${{ steps.meta.outputs.labels }}
86-
cache-from: type=gha
87-
cache-to: type=gha,mode=max
79+
- name: Publish Docker image to GHCR
80+
if: github.event_name != 'pull_request'
81+
run: >
82+
mvn -B -Pdist,docker -DskipTests
83+
-pl kerby-dist/docker
84+
-Ddocker.image.name=${{ steps.image.outputs.image_name }}
85+
-Ddocker.image.tag.sha=${{ steps.image.outputs.sha_tag }}
86+
io.fabric8:docker-maven-plugin:0.45.1:push

bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@
174174
<artifactId>kdc-dist</artifactId>
175175
<version>${project.version}</version>
176176
</dependency>
177+
<dependency>
178+
<groupId>org.apache.kerby</groupId>
179+
<artifactId>kerby-docker</artifactId>
180+
<version>${project.version}</version>
181+
</dependency>
177182
<dependency>
178183
<groupId>org.apache.kerby</groupId>
179184
<artifactId>kerby-testcontainers</artifactId>

kerby-dist/docker/pom.xml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. See accompanying LICENSE file.
14+
-->
15+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
16+
<modelVersion>4.0.0</modelVersion>
17+
18+
<parent>
19+
<groupId>org.apache.kerby</groupId>
20+
<artifactId>kerby-dist</artifactId>
21+
<version>2.1.2-SNAPSHOT</version>
22+
</parent>
23+
24+
<artifactId>kerby-docker</artifactId>
25+
<name>Kerby Docker Image</name>
26+
<description>Docker image build for the Kerby KDC distribution</description>
27+
<packaging>pom</packaging>
28+
29+
<properties>
30+
<docker.image.name>apache/kerby-kdc</docker.image.name>
31+
<docker.image.tag.latest>latest</docker.image.tag.latest>
32+
<docker.image.tag.sha>dev</docker.image.tag.sha>
33+
<docker.context.directory>${project.build.directory}/docker-context</docker.context.directory>
34+
</properties>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.apache.kerby</groupId>
39+
<artifactId>kdc-dist</artifactId>
40+
<version>${project.version}</version>
41+
<type>pom</type>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-clean-plugin</artifactId>
50+
<executions>
51+
<execution>
52+
<id>clean-docker-workdirs</id>
53+
<phase>prepare-package</phase>
54+
<goals>
55+
<goal>clean</goal>
56+
</goals>
57+
<configuration>
58+
<excludeDefaultDirectories>true</excludeDefaultDirectories>
59+
<filesets>
60+
<fileset>
61+
<directory>${docker.context.directory}</directory>
62+
</fileset>
63+
<fileset>
64+
<directory>${project.build.directory}/unpacked</directory>
65+
</fileset>
66+
</filesets>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-dependency-plugin</artifactId>
74+
<executions>
75+
<execution>
76+
<id>unpack-kdc-dist</id>
77+
<phase>prepare-package</phase>
78+
<goals>
79+
<goal>unpack</goal>
80+
</goals>
81+
<configuration>
82+
<artifactItems>
83+
<artifactItem>
84+
<groupId>org.apache.kerby</groupId>
85+
<artifactId>kdc-dist</artifactId>
86+
<version>${project.version}</version>
87+
<type>tar.gz</type>
88+
<outputDirectory>${project.build.directory}/unpacked</outputDirectory>
89+
<overWrite>true</overWrite>
90+
</artifactItem>
91+
</artifactItems>
92+
<overWriteReleases>true</overWriteReleases>
93+
<overWriteSnapshots>true</overWriteSnapshots>
94+
</configuration>
95+
</execution>
96+
</executions>
97+
</plugin>
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-resources-plugin</artifactId>
101+
<executions>
102+
<execution>
103+
<id>copy-docker-resources</id>
104+
<phase>prepare-package</phase>
105+
<goals>
106+
<goal>copy-resources</goal>
107+
</goals>
108+
<configuration>
109+
<outputDirectory>${docker.context.directory}</outputDirectory>
110+
<resources>
111+
<resource>
112+
<directory>src/main/docker</directory>
113+
</resource>
114+
</resources>
115+
</configuration>
116+
</execution>
117+
</executions>
118+
</plugin>
119+
<plugin>
120+
<groupId>org.apache.maven.plugins</groupId>
121+
<artifactId>maven-antrun-plugin</artifactId>
122+
<executions>
123+
<execution>
124+
<id>prepare-docker-context</id>
125+
<phase>prepare-package</phase>
126+
<goals>
127+
<goal>run</goal>
128+
</goals>
129+
<configuration>
130+
<target>
131+
<mkdir dir="${docker.context.directory}/kerby" />
132+
<copy todir="${docker.context.directory}/kerby">
133+
<fileset dir="${project.build.directory}/unpacked/kdc-dist-${project.version}" />
134+
</copy>
135+
</target>
136+
</configuration>
137+
</execution>
138+
</executions>
139+
</plugin>
140+
<plugin>
141+
<groupId>io.fabric8</groupId>
142+
<artifactId>docker-maven-plugin</artifactId>
143+
<version>${docker-maven-plugin.version}</version>
144+
<configuration>
145+
<images>
146+
<image>
147+
<name>${docker.image.name}</name>
148+
<build>
149+
<contextDir>${docker.context.directory}</contextDir>
150+
<dockerFile>${docker.context.directory}/Dockerfile</dockerFile>
151+
<tags>
152+
<tag>${project.version}</tag>
153+
<tag>${docker.image.tag.latest}</tag>
154+
<tag>${docker.image.tag.sha}</tag>
155+
</tags>
156+
</build>
157+
</image>
158+
</images>
159+
</configuration>
160+
</plugin>
161+
</plugins>
162+
</build>
163+
164+
<profiles>
165+
<profile>
166+
<id>docker</id>
167+
<build>
168+
<plugins>
169+
<plugin>
170+
<groupId>io.fabric8</groupId>
171+
<artifactId>docker-maven-plugin</artifactId>
172+
<version>${docker-maven-plugin.version}</version>
173+
<executions>
174+
<execution>
175+
<id>build-image</id>
176+
<phase>package</phase>
177+
<goals>
178+
<goal>build</goal>
179+
</goals>
180+
</execution>
181+
</executions>
182+
</plugin>
183+
</plugins>
184+
</build>
185+
</profile>
186+
</profiles>
187+
</project>

Dockerfile renamed to kerby-dist/docker/src/main/docker/Dockerfile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,11 @@
1414
# specific language governing permissions and limitations
1515
# under the License.
1616

17-
FROM maven:3.9-eclipse-temurin-8 AS build
18-
19-
WORKDIR /src
20-
COPY . .
21-
RUN mvn -pl kerby-dist/kdc-dist -am -Pdist -DskipTests package
22-
RUN mkdir -p /opt/kerby \
23-
&& tar -xzf kerby-dist/kdc-dist/target/kdc-dist-*.tar.gz -C /opt/kerby --strip-components=1
24-
2517
FROM eclipse-temurin:8-jre
2618

2719
WORKDIR /opt/kerby
28-
COPY --from=build /opt/kerby /opt/kerby
29-
COPY docker/kdc-entrypoint.sh /opt/kerby/bin/kdc-entrypoint.sh
20+
COPY kerby/ /opt/kerby/
21+
COPY kdc-entrypoint.sh /opt/kerby/bin/kdc-entrypoint.sh
3022
RUN chmod +x /opt/kerby/bin/*.sh \
3123
&& mkdir -p /var/lib/kerby /var/run/kerby
3224

docker/kdc-entrypoint.sh renamed to kerby-dist/docker/src/main/docker/kdc-entrypoint.sh

File renamed without changes.

kerby-dist/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<modules>
3131
<module>kdc-dist</module>
32+
<module>docker</module>
3233
<module>tool-dist</module>
3334
</modules>
3435

kerby-testcontainers/pom.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,30 @@
2727
<description>Testcontainers support for Apache Kerby KDC integration tests</description>
2828

2929
<dependencies>
30+
<dependency>
31+
<groupId>org.apache.kerby</groupId>
32+
<artifactId>kerby-docker</artifactId>
33+
<version>${project.version}</version>
34+
<type>pom</type>
35+
<scope>test</scope>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.apache.kerby</groupId>
39+
<artifactId>kerb-client</artifactId>
40+
<scope>test</scope>
41+
</dependency>
3042
<dependency>
3143
<groupId>org.testcontainers</groupId>
3244
<artifactId>testcontainers</artifactId>
3345
<version>${testcontainers.version}</version>
3446
</dependency>
47+
<dependency>
48+
<groupId>org.junit.jupiter</groupId>
49+
<artifactId>junit-jupiter-engine</artifactId>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.assertj</groupId>
53+
<artifactId>assertj-core</artifactId>
54+
</dependency>
3555
</dependencies>
3656
</project>
37-

kerby-testcontainers/src/main/java/org/apache/kerby/testcontainers/KerbyKdcContainer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.testcontainers.containers.wait.strategy.Wait;
2323
import org.testcontainers.utility.DockerImageName;
2424

25+
import java.nio.file.Path;
2526
import java.time.Duration;
2627

2728
/**
@@ -111,6 +112,10 @@ public String getServiceKeytab() {
111112
return serviceKeytab;
112113
}
113114

115+
public void copyServiceKeytabTo(Path target) {
116+
copyFileFromContainer(serviceKeytab, target.toAbsolutePath().toString());
117+
}
118+
114119
public String getKdcHost() {
115120
return getHost();
116121
}
@@ -150,4 +155,3 @@ private String qualifyPrincipal(String principal) {
150155
return principal + "@" + realm;
151156
}
152157
}
153-

0 commit comments

Comments
 (0)