Skip to content

Commit e62676e

Browse files
authored
Stabilize CI pipelines (#5108)
* Use server side apply to not pollute the logs * Build just the required module for each workflow * Remove parallel build * Use multi architecture kafka image * Clean up artifacts after each test * Randomize key names * Restore regular CI workflows * Use retries for producing messages in integration test
1 parent 6cfbfed commit e62676e

29 files changed

+267
-203
lines changed

.github/workflows/integration-tests.yaml

+17-17
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: mvn -N io.takari:maven:wrapper -Dmaven=3.8.2
6060

6161
- name: Build Application
62-
run: ./mvnw -T 1.5C clean install --no-transfer-progress -Pprod -DskipTests=true -Dmaven.javadoc.skip=true -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
62+
run: ./mvnw clean package -pl app,distro/docker -am --no-transfer-progress -Pprod -DskipTests=true -Dmaven.javadoc.skip=true -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
6363

6464
- name: Build and Push Application image
6565
run: |
@@ -143,21 +143,21 @@ jobs:
143143
run: minikube tunnel &> /dev/null &
144144

145145
- name: Run Integration Tests - H2
146-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
146+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
147147

148148
- name: Run Integration Tests - auth - H2
149-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
149+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
150150

151151
- name: Run Integration Tests - migration - H2
152-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
152+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
153153

154154
- name: Collect logs
155155
if: failure()
156156
run: sh ./.github/scripts/collect_logs.sh
157157

158158
- name: Upload tests logs artifacts
159159
if: failure()
160-
uses: actions/upload-artifact@v1.0.0
160+
uses: actions/upload-artifact@v4.0.0
161161
with:
162162
name: tests-logs-h2
163163
path: artifacts
@@ -188,21 +188,21 @@ jobs:
188188
run: minikube tunnel &> /dev/null &
189189

190190
- name: Run Integration Tests - Postgresql
191-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
191+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
192192

193193
- name: Run Integration Tests - auth - Postgresql
194-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
194+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
195195

196196
- name: Run Integration Tests - migration - Postgresql
197-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
197+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-sql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-sql -pl integration-tests -Dmaven.javadoc.skip=true
198198

199199
- name: Collect logs
200200
if: failure()
201201
run: sh ./.github/scripts/collect_logs.sh
202202

203203
- name: Upload tests logs artifacts
204204
if: failure()
205-
uses: actions/upload-artifact@v1.0.0
205+
uses: actions/upload-artifact@v4.0.0
206206
with:
207207
name: tests-logs-postgresql
208208
path: artifacts
@@ -234,24 +234,24 @@ jobs:
234234
run: minikube tunnel &> /dev/null &
235235

236236
- name: Run Integration Tests - Kafkasql
237-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
237+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pci -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
238238

239239
- name: Run Integration Tests - auth - Kafkasql
240-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
240+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pauth -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
241241

242242
- name: Run Integration Tests - migration - Kafkasql
243-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
243+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pmigration -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
244244

245245
- name: Run Integration Tests - snapshotting - Kafkasql
246-
run: ./mvnw -T 1.5C verify -am --no-transfer-progress -Pintegration-tests -Pkafkasql-snapshotting -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
246+
run: ./mvnw verify -am --no-transfer-progress -Pintegration-tests -Pkafkasql-snapshotting -Dregistry-kafkasql-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d -Premote-kafka -pl integration-tests -Dmaven.javadoc.skip=true
247247

248248
- name: Collect logs
249249
if: failure()
250250
run: sh ./.github/scripts/collect_logs.sh
251251

252252
- name: Upload tests logs artifacts
253253
if: failure()
254-
uses: actions/upload-artifact@v1.0.0
254+
uses: actions/upload-artifact@v4.0.0
255255
with:
256256
name: tests-logs-kafkasql
257257
path: artifacts
@@ -352,17 +352,17 @@ jobs:
352352
echo "Starting Registry App (In Memory)"
353353
docker run -it -p 8181:8080 -e apicurio.rest.deletion.artifact.enabled=true -d ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d
354354
cd registry-v2
355-
./mvnw -T 1.5C -Pintegration-tests clean install -DskipTests=true -DskipUiBuild=true -Dmaven.javadoc.skip=true
355+
./mvnw -Pintegration-tests clean install -DskipTests=true -DskipUiBuild=true -Dmaven.javadoc.skip=true
356356
cd integration-tests
357-
../mvnw -T 1.5C verify -Pregression -Dmaven.javadoc.skip=true -Dquarkus.http.test-host=localhost -Dquarkus.http.test-port=8181
357+
../mvnw verify -Pregression -Dmaven.javadoc.skip=true -Dquarkus.http.test-host=localhost -Dquarkus.http.test-port=8181
358358
359359
- name: Collect logs
360360
if: failure()
361361
run: sh ./.github/scripts/collect_logs.sh
362362

363363
- name: Upload tests logs artifacts
364364
if: failure()
365-
uses: actions/upload-artifact@v1.0.0
365+
uses: actions/upload-artifact@v4.0.0
366366
with:
367367
name: tests-logs-legacy-v2
368368
path: artifacts

.github/workflows/registry-rhbq-build.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: cd registry && java -jar /home/runner/.m2/pom-manipulation-cli.jar -DgroovyScripts=${{ github.event.inputs.script-url }}
6969

7070
- name: Build Registry
71-
run: pwd && cd registry && ./mvnw clean install -P${{ github.event.inputs.maven-profiles }} -DskipTests=${{ github.event.inputs.skip-tests }} ${{ github.event.inputs.extra-params }}
71+
run: pwd && cd registry && ./mvnw clean compile -P${{ github.event.inputs.maven-profiles }} -DskipTests=${{ github.event.inputs.skip-tests }} ${{ github.event.inputs.extra-params }}
7272

7373
- name: Set test profile to all
7474
run: echo "test_profile=all" >> $GITHUB_ENV
@@ -95,7 +95,7 @@ jobs:
9595

9696
- name: Upload tests logs artifacts
9797
if: failure()
98-
uses: actions/upload-artifact@v1.0.0
98+
uses: actions/upload-artifact@v4.0.0
9999
with:
100100
name: tests-logs
101101
path: artifacts

.github/workflows/release-images.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
- name: Build Registry
102102
run: |
103103
cd registry
104-
./mvnw -T 1.5C clean install --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
104+
./mvnw clean package -pl app,distro/docker -am --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
105105
106106
- name: Build the typescript-sdk
107107
run: |
@@ -154,7 +154,7 @@ jobs:
154154
SKIP_TESTS: "true"
155155
run: |
156156
cd registry
157-
./mvnw -T 1.5C package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
157+
./mvnw package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
158158
159159
- name: Build and Push Native image for testing
160160
run: |

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
- name: Build Registry (All Variants)
8787
run: |
8888
cd registry
89-
./mvnw -T 1.5C clean install --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
89+
./mvnw clean package -pl app -am --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
9090
9191
- name: Build the typescript-sdk
9292
run: |

.github/workflows/verify.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
fi
7070
7171
- name: Build and Test Application
72-
run: ./mvnw -T 1.5C clean install --no-transfer-progress -Pprod -DskipTests=false -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
72+
run: ./mvnw clean package --no-transfer-progress -Pprod -DskipTests=false -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
7373

7474
- name: Login to DockerHub Registry
7575
if: github.event_name == 'push'
@@ -224,13 +224,13 @@ jobs:
224224
( cd /tmp/coreutils-workaround && mvn dependency:get -DremoteRepositories=https://repo1.maven.org/maven2 -Dartifact=com.github.java-json-tools:jackson-coreutils:2.0 )
225225
226226
- name: Build Application
227-
run: ./mvnw -T 1.5C clean install -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 --no-transfer-progress
227+
run: ./mvnw clean package -pl app,distro/docker -am -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 --no-transfer-progress
228228

229229
- name: Build Native executables
230230
env:
231231
SKIP_TESTS: "true"
232232
run: |
233-
./mvnw -T 1.5C package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
233+
./mvnw package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
234234
235235
- name: Build and Push Temporary image for testing
236236
env:
@@ -262,7 +262,7 @@ jobs:
262262
run: ./.github/scripts/collect_logs.sh
263263
- name: Upload tests logs artifacts
264264
if: failure()
265-
uses: actions/upload-artifact@v1.0.0
265+
uses: actions/upload-artifact@v4.0.0
266266
with:
267267
name: tests-logs
268268
path: artifacts
@@ -336,7 +336,7 @@ jobs:
336336
run: make lint-check
337337

338338
- name: Build Registry
339-
run: mvn clean install -am -pl app -Dskip.npm -DskipTests=true --no-transfer-progress
339+
run: mvn clean package -pl app -am -Dskip.npm -DskipTests=true --no-transfer-progress
340340

341341
- name: Run the tests
342342
working-directory: python-sdk
@@ -363,7 +363,7 @@ jobs:
363363
go-version: '1.20'
364364

365365
- name: Build Registry
366-
run: mvn clean install -am -pl app -Dskip.npm -DskipTests=true --no-transfer-progress
366+
run: mvn clean package -pl app -am -Dskip.npm -DskipTests=true --no-transfer-progress
367367

368368
- name: Run the tests
369369
working-directory: go-sdk

app/src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ apicurio.import.workDir=${java.io.tmpdir}
164164

165165
## SQL Storage
166166
apicurio.storage.sql.kind=h2
167-
apicurio.datasource.url=jdbc:h2:mem:registry_db
167+
apicurio.datasource.url=jdbc:h2:mem:${quarkus.uuid}
168168
apicurio.datasource.username=sa
169169
apicurio.datasource.password=sa
170170
apicurio.datasource.jdbc.initial-size=20

integration-tests/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<dependency>
104104
<groupId>io.confluent</groupId>
105105
<artifactId>kafka-avro-serializer</artifactId>
106-
<scope>provided</scope>
106+
<scope>test</scope>
107107
</dependency>
108108
<dependency>
109109
<groupId>io.confluent</groupId>

integration-tests/src/test/java/io/apicurio/deployment/RegistryDeploymentManager.java

+27-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import io.fabric8.openshift.api.model.Route;
1010
import io.fabric8.openshift.client.DefaultOpenShiftClient;
1111
import io.fabric8.openshift.client.OpenShiftClient;
12+
import org.junit.platform.engine.TestExecutionResult;
1213
import org.junit.platform.launcher.TestExecutionListener;
14+
import org.junit.platform.launcher.TestIdentifier;
1315
import org.junit.platform.launcher.TestPlan;
1416
import org.slf4j.Logger;
1517
import org.slf4j.LoggerFactory;
@@ -33,6 +35,23 @@ public class RegistryDeploymentManager implements TestExecutionListener {
3335

3436
static List<LogWatch> logWatch;
3537

38+
static String testLogsIdentifier;
39+
40+
@Override
41+
public void executionStarted(TestIdentifier testIdentifier) {
42+
TestExecutionListener.super.executionStarted(testIdentifier);
43+
logWatch = streamPodLogs(testLogsIdentifier);
44+
}
45+
46+
@Override
47+
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
48+
TestExecutionListener.super.executionFinished(testIdentifier, testExecutionResult);
49+
50+
if (logWatch != null && !logWatch.isEmpty()) {
51+
logWatch.forEach(LogWatch::close);
52+
}
53+
}
54+
3655
@Override
3756
public void testPlanExecutionStarted(TestPlan testPlan) {
3857
if (Boolean.parseBoolean(System.getProperty("cluster.tests"))) {
@@ -81,27 +100,27 @@ public void testPlanExecutionFinished(TestPlan testPlan) {
81100

82101
private void handleInfraDeployment() throws Exception {
83102
// First, create the namespace used for the test.
84-
kubernetesClient.load(getClass().getResourceAsStream(E2E_NAMESPACE_RESOURCE)).create();
103+
kubernetesClient.load(getClass().getResourceAsStream(E2E_NAMESPACE_RESOURCE)).serverSideApply();
85104

86105
// Based on the configuration, deploy the appropriate variant
87106
if (Boolean.parseBoolean(System.getProperty("deployInMemory"))) {
88107
LOGGER.info(
89108
"Deploying In Memory Registry Variant with image: {} ##################################################",
90109
System.getProperty("registry-in-memory-image"));
91110
InMemoryDeploymentManager.deployInMemoryApp(System.getProperty("registry-in-memory-image"));
92-
logWatch = streamPodLogs("apicurio-registry-memory");
111+
testLogsIdentifier = "apicurio-registry-memory";
93112
} else if (Boolean.parseBoolean(System.getProperty("deploySql"))) {
94113
LOGGER.info(
95114
"Deploying SQL Registry Variant with image: {} ##################################################",
96115
System.getProperty("registry-sql-image"));
97116
SqlDeploymentManager.deploySqlApp(System.getProperty("registry-sql-image"));
98-
logWatch = streamPodLogs("apicurio-registry-sql");
117+
testLogsIdentifier = "apicurio-registry-sql";
99118
} else if (Boolean.parseBoolean(System.getProperty("deployKafka"))) {
100119
LOGGER.info(
101120
"Deploying Kafka SQL Registry Variant with image: {} ##################################################",
102121
System.getProperty("registry-kafkasql-image"));
103122
KafkaSqlDeploymentManager.deployKafkaApp(System.getProperty("registry-kafkasql-image"));
104-
logWatch = streamPodLogs("apicurio-registry-kafka");
123+
testLogsIdentifier = "apicurio-registry-kafka";
105124
}
106125
}
107126

@@ -133,7 +152,7 @@ static void prepareTestsInfra(String externalResources, String registryResources
133152
// Deploy all the resources associated to the registry variant
134153
kubernetesClient
135154
.load(IOUtils.toInputStream(registryLoadedResources, StandardCharsets.UTF_8.name()))
136-
.create();
155+
.serverSideApply();
137156
} catch (Exception ex) {
138157
LOGGER.debug("Error creating registry resources:", ex);
139158
}
@@ -153,7 +172,7 @@ private static void setupTestNetworking() {
153172
try {
154173
final Route registryRoute = openShiftClient.routes()
155174
.load(RegistryDeploymentManager.class.getResourceAsStream(REGISTRY_OPENSHIFT_ROUTE))
156-
.create();
175+
.serverSideApply();
157176

158177
System.setProperty("quarkus.http.test-host", registryRoute.getSpec().getHost());
159178
System.setProperty("quarkus.http.test-port", "80");
@@ -176,7 +195,8 @@ private static void setupTestNetworking() {
176195

177196
private static void deployResource(String resource) {
178197
// Deploy all the resources associated to the external requirements
179-
kubernetesClient.load(RegistryDeploymentManager.class.getResourceAsStream(resource)).create();
198+
kubernetesClient.load(RegistryDeploymentManager.class.getResourceAsStream(resource))
199+
.serverSideApply();
180200

181201
// Wait for all the external resources pods to be ready
182202
kubernetesClient.pods().inNamespace(TEST_NAMESPACE).waitUntilReady(360, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)