From ac2c83a2f0593e8d802fe0dc910cb05e69a5f6df Mon Sep 17 00:00:00 2001 From: Stewart X Addison Date: Thu, 6 Apr 2023 18:29:26 +0100 Subject: [PATCH 1/2] Prune build cache to 10Gb after creating images Signed-off-by: Stewart X Addison --- Jenkinsfile | 2 +- build_all.sh | 1 + common_functions.sh | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f76a7bce..349e6ad27 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { def dockerBuild(version) { // dockerhub is the ID of the credentials stored in Jenkins docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') { - git poll: false, url: 'https://github.com/AdoptOpenJDK/openjdk-docker.git' + git poll: false, url: 'https://github.com/sxa/openjdk-docker.git', branch: 'purge_cache' if (version){ sh label: '', script: "./build_all.sh ${version}" } else { diff --git a/build_all.sh b/build_all.sh index 52662678e..4691816ce 100755 --- a/build_all.sh +++ b/build_all.sh @@ -120,3 +120,4 @@ remove_summary_table_file # Cleanup any old containers and images cleanup_images cleanup_manifest +clear_build_cache diff --git a/common_functions.sh b/common_functions.sh index 2dcef8869..6852874af 100755 --- a/common_functions.sh +++ b/common_functions.sh @@ -253,6 +253,19 @@ function cleanup_manifest() { rm -rf ~/.docker/manifests } +function clear_build_cache() { + # Reduce the size of the build cache to avoid exhaustion of the space + docker system df + echo Pruning builder cache to 10Gb + # docker on our arm32 machines gives parse error if bigger than this + if [ "$(uname -m)" = "armv7l" ]; then + SPACE_TO_KEEP=2100000000 + else + SPACE_TO_KEEP=10000000000 + fi + docker builder prune -f --keep-storage ${SPACE_TO_KEEP} +} + # Check if a given docker image exists on the server. # This script errors out if the image does not exist. function check_image() { From 0fd42167084b83f4220524c11047ab31506bc1ad Mon Sep 17 00:00:00 2001 From: Stewart X Addison Date: Thu, 27 Apr 2023 09:22:14 +0100 Subject: [PATCH 2/2] Revert Jenkinsfile back to AdoptOpenJDK awaiting merge Signed-off-by: Stewart X Addison --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 349e6ad27..0f76a7bce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { def dockerBuild(version) { // dockerhub is the ID of the credentials stored in Jenkins docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') { - git poll: false, url: 'https://github.com/sxa/openjdk-docker.git', branch: 'purge_cache' + git poll: false, url: 'https://github.com/AdoptOpenJDK/openjdk-docker.git' if (version){ sh label: '', script: "./build_all.sh ${version}" } else {