From bc5a6b4a51dd630ee5c98207d58165487cc4c47b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Jan 2022 12:23:12 +0100 Subject: [PATCH 01/13] bump catch2 version to v3.0.0-preview4 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb3d48b83..67d07501f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ if(FSFW_BUILD_UNITTESTS) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview3 + GIT_TAG v3.0.0-preview4 ) FetchContent_MakeAvailable(Catch2) -- 2.34.1 From fe95c3337ab58dd5fd39fe8e10e898effcaadb2a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Jan 2022 12:28:30 +0100 Subject: [PATCH 02/13] changed builddir name in Jenkinsfile --- automation/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index d4a8e2ab8..ba3f5afbf 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - BUILDDIR = 'build-unittests' + BUILDDIR = 'build-tests' } stages { stage('Create Docker') { -- 2.34.1 From c453af591165b27a61eb86cfb8a258dd77bedb45 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Jan 2022 15:30:01 +0100 Subject: [PATCH 03/13] cleanCI --- automation/Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index ba3f5afbf..e7f85e28e 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -16,6 +16,18 @@ pipeline { sh 'rm -rf $BUILDDIR' } } + stage('Clean') { + when { + anyOf { + changelog 'cleanCI' + changeset '*.cmake' + changeset 'CMakeLists.txt' + } + } + steps { + sh 'rm -rf $BUILDDIR' + } + } stage('Configure') { agent { dockerfile { -- 2.34.1 From 441b3b83c883cd4ccc41e8c7c07d537998f0bdf7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 Jan 2022 11:30:33 +0100 Subject: [PATCH 04/13] Changes to Dockerfile and Jenkinsfile 1. Install Catch2 from sources inside a Docker stage/layer 2. Some tweaks to Jenkinsfile --- automation/Dockerfile | 6 ++++++ automation/Jenkinsfile | 36 +++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/automation/Dockerfile b/automation/Dockerfile index 93a4fe7db..52e5acfb4 100644 --- a/automation/Dockerfile +++ b/automation/Dockerfile @@ -6,3 +6,9 @@ RUN apt-get --yes upgrade #tzdata is a dependency, won't install otherwise ARG DEBIAN_FRONTEND=noninteractive RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano + +RUN git clone https://github.com/catchorg/Catch2.git && \ + cd Catch2 && \ + git checkout v3.0.0-preview4 && \ + cmake -Bbuild -H. -DBUILD_TESTING=OFF && \ + cmake --build build/ --target install diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index e7f85e28e..3050a68b4 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,22 +1,28 @@ pipeline { agent any environment { + DOCKER_TAG = 'fsfw-build' BUILDDIR = 'build-tests' } stages { - stage('Create Docker') { - agent { - dockerfile { - dir 'automation' - additionalBuildArgs '--no-cache' - reuseNode true + stage('Build Container') { + when { + anyOf { + changeset "automation/Dockerfile"; + changelog 'cleanDocker' } } steps { - sh 'rm -rf $BUILDDIR' + sh 'docker build -t $DOCKER_TAG - < automation/Dockerfile' } } stage('Clean') { + agent { + docker { + image '$DOCKER_TAG' + reuseNode true + } + } when { anyOf { changelog 'cleanCI' @@ -30,8 +36,8 @@ pipeline { } stage('Configure') { agent { - dockerfile { - dir 'automation' + docker { + image '$DOCKER_TAG' reuseNode true } } @@ -43,8 +49,8 @@ pipeline { } stage('Build') { agent { - dockerfile { - dir 'automation' + docker { + image '$DOCKER_TAG' reuseNode true } } @@ -56,8 +62,8 @@ pipeline { } stage('Unittests') { agent { - dockerfile { - dir 'automation' + docker { + image '$DOCKER_TAG' reuseNode true } } @@ -69,8 +75,8 @@ pipeline { } stage('Valgrind') { agent { - dockerfile { - dir 'automation' + docker { + image '$DOCKER_TAG' reuseNode true } } -- 2.34.1 From 386843e3e70e2249c1e880cdfbfb973e3bf35f59 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Jan 2022 13:33:06 +0100 Subject: [PATCH 05/13] update jenkinsfile --- automation/Jenkinsfile | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 3050a68b4..551dea847 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,25 +1,28 @@ pipeline { agent any environment { - DOCKER_TAG = 'fsfw-build' + DOCK_FILE_DIR = 'automation' BUILDDIR = 'build-tests' } stages { - stage('Build Container') { - when { - anyOf { - changeset "automation/Dockerfile"; - changelog 'cleanDocker' + stage('Create Docker') { + agent { + dockerfile { + dir '$DOCK_FILE_DIR' + additionalBuildArgs '--no-cache' } } - steps { - sh 'docker build -t $DOCKER_TAG - < automation/Dockerfile' + when { + anyOf { + changeset "$DOCK_FILE_DIR/Dockerfile"; + changelog 'cleanDocker' + } } } stage('Clean') { agent { - docker { - image '$DOCKER_TAG' + dockerfile { + dir '$DOCK_FILE_DIR' reuseNode true } } @@ -36,8 +39,8 @@ pipeline { } stage('Configure') { agent { - docker { - image '$DOCKER_TAG' + dockerfile { + dir '$DOCK_FILE_DIR' reuseNode true } } @@ -49,8 +52,8 @@ pipeline { } stage('Build') { agent { - docker { - image '$DOCKER_TAG' + dockerfile { + dir '$DOCK_FILE_DIR' reuseNode true } } @@ -62,8 +65,8 @@ pipeline { } stage('Unittests') { agent { - docker { - image '$DOCKER_TAG' + dockerfile { + dir '$DOCK_FILE_DIR' reuseNode true } } @@ -75,8 +78,8 @@ pipeline { } stage('Valgrind') { agent { - docker { - image '$DOCKER_TAG' + dockerfile { + dir '$DOCK_FILE_DIR' reuseNode true } } -- 2.34.1 From 8414c9d47193775ccaa898f35b3dd6755938458a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Jan 2022 13:36:43 +0100 Subject: [PATCH 06/13] added steps --- automation/Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 551dea847..eefcdabf4 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -10,6 +10,7 @@ pipeline { dockerfile { dir '$DOCK_FILE_DIR' additionalBuildArgs '--no-cache' + reuseNode true } } when { @@ -18,6 +19,9 @@ pipeline { changelog 'cleanDocker' } } + steps { + sh 'rm -rf $BUILDDIR' + } } stage('Clean') { agent { -- 2.34.1 From cf3d4d8de31fddad7ce439908d659688f3a67930 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Jan 2022 13:43:21 +0100 Subject: [PATCH 07/13] cleanDocker --- automation/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index eefcdabf4..595f6963f 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { } when { anyOf { - changeset "$DOCK_FILE_DIR/Dockerfile"; + changeset "${DOCK_FILE_DIR}/Dockerfile"; changelog 'cleanDocker' } } -- 2.34.1 From bf7fabd7bac4ef6932020ad11c1796a32cd97c6d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Jan 2022 13:46:05 +0100 Subject: [PATCH 08/13] commented out when block --- automation/Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 595f6963f..afb433653 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -13,12 +13,13 @@ pipeline { reuseNode true } } - when { - anyOf { - changeset "${DOCK_FILE_DIR}/Dockerfile"; - changelog 'cleanDocker' - } - } + // Does not work, but maybe not necessary anyway.. + //when { + // anyOf { + // changeset "${DOCK_FILE_DIR}/Dockerfile"; + // changelog 'cleanDocker' + // } + //} steps { sh 'rm -rf $BUILDDIR' } -- 2.34.1 From eba9abfc9aa1a97b5a13110f38c9cbdebf3521a0 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 28 Jan 2022 14:10:24 +0100 Subject: [PATCH 09/13] Jenkinsfile syntax is weird, maybe this works... --- automation/Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index afb433653..1853308ca 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stage('Create Docker') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR additionalBuildArgs '--no-cache' reuseNode true } @@ -27,7 +27,7 @@ pipeline { stage('Clean') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR reuseNode true } } @@ -45,7 +45,7 @@ pipeline { stage('Configure') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR reuseNode true } } @@ -58,7 +58,7 @@ pipeline { stage('Build') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR reuseNode true } } @@ -71,7 +71,7 @@ pipeline { stage('Unittests') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR reuseNode true } } @@ -84,7 +84,7 @@ pipeline { stage('Valgrind') { agent { dockerfile { - dir '$DOCK_FILE_DIR' + dir DOCK_FILE_DIR reuseNode true } } -- 2.34.1 From b98127cea6496487d3dbc9f0f19406c7431f9117 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 31 Jan 2022 14:59:45 +0100 Subject: [PATCH 10/13] Updated CI Build - Always clean and rebuild docker image. - Use single docker container --- automation/Jenkinsfile | 68 ++++++------------------------------------ 1 file changed, 9 insertions(+), 59 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 1853308ca..0d62538e6 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,54 +1,22 @@ pipeline { - agent any environment { - DOCK_FILE_DIR = 'automation' - BUILDDIR = 'build-tests' + DOCK_FILE_DIR = 'automation' + BUILDDIR = 'build-tests' + } + agent { + dockerfile { + dir DOCK_FILE_DIR + additionalBuildArgs '--no-cache' + reuseNode true + } } stages { - stage('Create Docker') { - agent { - dockerfile { - dir DOCK_FILE_DIR - additionalBuildArgs '--no-cache' - reuseNode true - } - } - // Does not work, but maybe not necessary anyway.. - //when { - // anyOf { - // changeset "${DOCK_FILE_DIR}/Dockerfile"; - // changelog 'cleanDocker' - // } - //} - steps { - sh 'rm -rf $BUILDDIR' - } - } stage('Clean') { - agent { - dockerfile { - dir DOCK_FILE_DIR - reuseNode true - } - } - when { - anyOf { - changelog 'cleanCI' - changeset '*.cmake' - changeset 'CMakeLists.txt' - } - } steps { sh 'rm -rf $BUILDDIR' } } stage('Configure') { - agent { - dockerfile { - dir DOCK_FILE_DIR - reuseNode true - } - } steps { dir(BUILDDIR) { sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' @@ -56,12 +24,6 @@ pipeline { } } stage('Build') { - agent { - dockerfile { - dir DOCK_FILE_DIR - reuseNode true - } - } steps { dir(BUILDDIR) { sh 'cmake --build . -j' @@ -69,12 +31,6 @@ pipeline { } } stage('Unittests') { - agent { - dockerfile { - dir DOCK_FILE_DIR - reuseNode true - } - } steps { dir(BUILDDIR) { sh 'cmake --build . -- fsfw-tests_coverage -j' @@ -82,12 +38,6 @@ pipeline { } } stage('Valgrind') { - agent { - dockerfile { - dir DOCK_FILE_DIR - reuseNode true - } - } steps { dir(BUILDDIR) { sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests' -- 2.34.1 From 5b968f7e5adcb173a229f20e984c4120b86b7382 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 31 Jan 2022 15:01:45 +0100 Subject: [PATCH 11/13] Can't use env variables in top leve agent section --- automation/Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 0d62538e6..af4ad6a52 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,11 +1,10 @@ pipeline { environment { - DOCK_FILE_DIR = 'automation' - BUILDDIR = 'build-tests' + BUILDDIR = 'build-tests' } agent { dockerfile { - dir DOCK_FILE_DIR + dir 'automation' additionalBuildArgs '--no-cache' reuseNode true } -- 2.34.1 From 1ead156c645c89cdea104268f34e8d7c291a66d1 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 31 Jan 2022 15:08:52 +0100 Subject: [PATCH 12/13] added --pull to the docker build --- automation/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index af4ad6a52..09ac9649d 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -5,7 +5,9 @@ pipeline { agent { dockerfile { dir 'automation' - additionalBuildArgs '--no-cache' + #force docker to redownload base image and rebuild all steps instead of caching them + #this way, we always get an up to date docker image one each build + additionalBuildArgs '--no-cache --pull' reuseNode true } } -- 2.34.1 From 8a39971a1c3b86b607814a3fe5738d7357ace588 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 31 Jan 2022 15:11:37 +0100 Subject: [PATCH 13/13] oops, wrong language --- automation/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 09ac9649d..dae2da2cb 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -5,8 +5,8 @@ pipeline { agent { dockerfile { dir 'automation' - #force docker to redownload base image and rebuild all steps instead of caching them - #this way, we always get an up to date docker image one each build + //force docker to redownload base image and rebuild all steps instead of caching them + //this way, we always get an up to date docker image one each build additionalBuildArgs '--no-cache --pull' reuseNode true } -- 2.34.1