fix build failure related to disk usage (#1372)

This commit is contained in:
erabii
2023-06-21 16:22:15 +03:00
committed by GitHub
parent 065a3cbd3c
commit f6e15ae58c
45 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
name: clean space
description: clean space
runs:
using: "composite"
steps:
- name: apt-update
shell: bash
run: |
sudo apt-get update
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true

View File

@@ -12,6 +12,7 @@ runs:
cd ..
docker load -i /tmp/docker/images/spring-cloud-kubernetes-fabric8-istio-it.tar
rm -fr /tmp/docker/images/spring-cloud-kubernetes-fabric8-istio-it.tar
cd spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/
../.././mvnw clean install -Dskip.build.image=true
cd ../..

View File

@@ -16,6 +16,9 @@ jobs:
- name: checkout project
uses: actions/checkout@v2
- name: clean space
uses: ./.github/workflows/composites/clean-space
- name: set env variables
uses: ./.github/workflows/composites/env-variables
@@ -111,6 +114,9 @@ jobs:
- name: checkout project
uses: actions/checkout@v2
- name: clean space
uses: ./.github/workflows/composites/clean-space
- name: set env variables
uses: ./.github/workflows/composites/env-variables

View File

@@ -23,6 +23,7 @@ import java.util.Objects;
import io.kubernetes.client.openapi.models.V1Deployment;
import io.kubernetes.client.openapi.models.V1Ingress;
import io.kubernetes.client.openapi.models.V1Service;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@@ -66,6 +67,11 @@ class KubernetesClientCatalogWatchIT {
util.setUp(NAMESPACE);
}
@AfterAll
static void afterAll() {
Commons.systemPrune();
}
@BeforeEach
void beforeEach() {
util.busybox(NAMESPACE, Phase.CREATE);

View File

@@ -29,6 +29,7 @@ import io.kubernetes.client.openapi.models.V1EnvVar;
import io.kubernetes.client.openapi.models.V1EnvVarBuilder;
import io.kubernetes.client.openapi.models.V1Ingress;
import io.kubernetes.client.openapi.models.V1Service;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
@@ -74,6 +75,11 @@ public class KubernetesClientCatalogWatchNamespacesIT {
util.setUp(NAMESPACE_DEFAULT);
}
@AfterAll
static void afterAll() {
Commons.systemPrune();
}
@BeforeEach
void beforeEach() {
util.createNamespace(NAMESPACE_A);

View File

@@ -84,6 +84,7 @@ class ConfigMapAndSecretIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(K8S_CONFIG_CLIENT_IT_SERVICE_NAME, K3S);
Commons.systemPrune();
}
@AfterEach

View File

@@ -86,6 +86,7 @@ class ConfigurationWatcherMultipleAppsIT {
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.cleanUp(CONFIG_WATCHER_APP_A_IMAGE, K3S);
Commons.cleanUp(CONFIG_WATCHER_APP_B_IMAGE, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -86,6 +86,7 @@ class ConfigMapEventReloadIT {
util.deleteNamespace("left");
util.deleteNamespace("right");
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -83,6 +83,7 @@ class DataChangesInConfigMapReloadIT {
static void afterAll() throws Exception {
util.deleteNamespace(LEFT_NAMESPACE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -78,6 +78,7 @@ class BootstrapEnabledPollingReloadConfigMapMountIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -78,6 +78,7 @@ class PollingReloadConfigMapMountIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -90,6 +90,7 @@ class KubernetesClientDiscoveryClientIT {
static void afterAll() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -102,6 +102,7 @@ class KubernetesClientDiscoverySelectiveNamespacesIT {
util.deleteNamespace(NAMESPACE_A);
util.deleteNamespace(NAMESPACE_B);
manifests(Phase.DELETE);
Commons.systemPrune();
}
/**

View File

@@ -70,6 +70,7 @@ class LoadBalancerIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(SPRING_CLOUD_K8S_LOADBALANCER_APP_NAME, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -73,6 +73,7 @@ class ReactiveDiscoveryClientIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(SPRING_CLOUD_K8S_REACTIVE_DISCOVERY_APP_NAME, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -85,6 +85,7 @@ class ConfigurationWatcherMultipleAppIT {
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.cleanUp(CONFIG_WATCHER_APP_A_IMAGE, K3S);
Commons.cleanUp(CONFIG_WATCHER_APP_B_IMAGE, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -79,6 +79,7 @@ class DataChangesInSecretsReloadIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -76,6 +76,7 @@ class SecretsEventReloadIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -73,6 +73,7 @@ class ActuatorRefreshIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -76,6 +76,7 @@ class ActuatorRefreshKafkaIT {
static void afterAll() throws Exception {
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.cleanUp(CONFIG_WATCHER_IT_IMAGE, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -81,6 +81,7 @@ class ActuatorRefreshMultipleNamespacesIT {
util.deleteNamespace(LEFT_NAMESPACE);
util.deleteNamespace(RIGHT_NAMESPACE);
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -76,6 +76,7 @@ class ActuatorRefreshRabbitMQIT {
static void afterAll() throws Exception {
Commons.cleanUp(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S);
Commons.cleanUp(CONFIG_WATCHER_IT_IMAGE, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -68,6 +68,7 @@ class ActuatorEndpointIT {
@AfterAll
static void afterAll() {
coreK8sClientIt(Phase.DELETE);
Commons.systemPrune();
}
@Test

View File

@@ -100,6 +100,7 @@ class DiscoveryClientFilterNamespaceIT {
discoveryServer(Phase.DELETE);
util.deleteNamespace(NAMESPACE_LEFT);
util.deleteNamespace(NAMESPACE_RIGHT);
Commons.systemPrune();
}
@AfterEach

View File

@@ -80,6 +80,7 @@ class DiscoveryClientIT {
discoveryServer(Phase.DELETE);
discoveryIt(Phase.DELETE);
Commons.systemPrune();
}
@Test

View File

@@ -25,6 +25,7 @@ import io.fabric8.kubernetes.api.model.Service;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.fabric8.kubernetes.api.model.networking.v1.Ingress;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@@ -73,6 +74,11 @@ class Fabric8CatalogWatchIT {
util.setUp(NAMESPACE);
}
@AfterAll
static void afterAll() {
Commons.systemPrune();
}
@BeforeEach
void beforeEach() {
util.busybox(NAMESPACE, Phase.CREATE);

View File

@@ -95,6 +95,7 @@ class Fabric8CatalogWatchWithNamespacesIT {
static void afterAll() {
util.deleteNamespace(NAMESPACE_A);
util.deleteNamespace(NAMESPACE_B);
Commons.systemPrune();
}
/**

View File

@@ -87,6 +87,7 @@ class ConfigMapEventReloadIT {
util.deleteNamespace("left");
util.deleteNamespace("right");
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -83,6 +83,7 @@ class DataChangesInConfigMapReloadIT {
static void afterAll() throws Exception {
util.deleteNamespace(LEFT_NAMESPACE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -76,6 +76,7 @@ public class BootstrapEnabledPollingReloadConfigMapMountIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -80,6 +80,7 @@ class ConfigMapPollingReloadIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -79,6 +79,7 @@ class PollingReloadConfigMapMountIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -70,6 +70,7 @@ class Fabric8ConfigMapIT {
static void afterAll() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -80,6 +80,7 @@ class Fabric8DiscoveryBootstrapIT {
util.wiremock(NAMESPACE, "/wiremock", Phase.DELETE);
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -82,6 +82,7 @@ class Fabric8DiscoveryClientHealthIT {
@AfterAll
static void after() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -81,6 +81,11 @@ class Fabric8DiscoveryFilterIT {
util.setUp(NAMESPACE);
}
@AfterAll
static void afterAll() {
Commons.systemPrune();
}
@BeforeEach
void beforeEach() {
util.createNamespace(NAMESPACE_A_UAT);

View File

@@ -82,6 +82,7 @@ class Fabric8DiscoveryIT {
util.wiremock(NAMESPACE, "/wiremock", Phase.DELETE);
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -90,6 +90,7 @@ class Fabric8DiscoveryNamespaceFilterIT {
util.deleteNamespace(NAMESPACE_LEFT);
util.deleteNamespace(NAMESPACE_RIGHT);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -82,6 +82,7 @@ class Fabric8DiscoveryPodMetadataIT {
util.busybox(NAMESPACE, Phase.DELETE);
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -76,6 +76,7 @@ public class Fabric8ClientLoadbalancerIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@BeforeEach

View File

@@ -81,6 +81,7 @@ class DataChangesInSecretsReloadIT {
@AfterAll
static void after() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
/**

View File

@@ -80,6 +80,7 @@ class SecretsEventsReloadIT {
@AfterAll
static void after() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -72,6 +72,7 @@ class SimpleCoreIT {
static void after() throws Exception {
manifests(Phase.DELETE);
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@Test

View File

@@ -100,6 +100,7 @@ class Fabric8IstioIT {
@AfterAll
static void afterAll() throws Exception {
Commons.cleanUp(IMAGE_NAME, K3S);
Commons.systemPrune();
}
@AfterAll

View File

@@ -191,6 +191,19 @@ public final class Commons {
return execResult.getStdout();
}
/**
* equivalent of 'docker system prune', but for crictl.
*/
public static void systemPrune() {
try {
CONTAINER.execInContainer("sh", "-c",
"crictl ps -a | grep -v Running | awk '{print $1}' | xargs crictl rm && crictl rmi --prune");
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String pomVersion() {
try (InputStream in = new ClassPathResource(KUBERNETES_VERSION_FILE).getInputStream()) {
String version = StreamUtils.copyToString(in, StandardCharsets.UTF_8);