From 53a4c2a4b7a19530ff57818c03f07af5eb932a32 Mon Sep 17 00:00:00 2001 From: Marcelo Mendes Spessoto Junior Date: Tue, 28 May 2024 17:57:12 -0300 Subject: [PATCH] docker agent prototype Signed-off-by: Marcelo Mendes Spessoto Junior --- Dockerfile | 23 +++++++++++++++++++++++ jenkinsfiles/codecov | 2 +- jenkinsfiles/formatter-shfmt | 26 ++++++++++++++++++++++++++ jenkinsfiles/integration_tests | 26 ++++++++++++++++++++++++++ jenkinsfiles/setup_and_doc | 26 ++++++++++++++++++++++++++ jenkinsfiles/shellcheck-reviewdog | 26 ++++++++++++++++++++++++++ jenkinsfiles/unit_tests | 26 ++++++++++++++++++++++++++ 7 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..6dbbd33b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM jenkins/jenkins:lts +USER root +#COPY /kcov/ /setup/ +COPY /configuration/ /usr/local/configuration/ + +WORKDIR /setup/ +RUN apt update -y \ + && apt install -y binutils-dev libssl-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake build-essential python3\ + && cmake . \ + && make \ + && make install +# +COPY /kworkflow/ /tests/ +WORKDIR /tests/ +RUN apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl +USER kworkflow +# && ls \ +# && ./run_tests.sh prepare \ +# && mkdir kcov_out/ \ +# && git config --global user.email "kw@kworkflow.net" \ +# && git config --global user.name "Kworkflow" \ +# && ./run_tests.sh prepare \ +# && kcov --include-path=src,kw --exclude-pattern=src/bash_autocomplete.sh,src/help.sh kcov_out/ ./run_tests.sh diff --git a/jenkinsfiles/codecov b/jenkinsfiles/codecov index b5b8a12ed..cad97c74a 100644 --- a/jenkinsfiles/codecov +++ b/jenkinsfiles/codecov @@ -1,5 +1,5 @@ pipeline { - agent any + agents any stages { stage('Build'){ diff --git a/jenkinsfiles/formatter-shfmt b/jenkinsfiles/formatter-shfmt index e69de29bb..dc2fbdf6f 100644 --- a/jenkinsfiles/formatter-shfmt +++ b/jenkinsfiles/formatter-shfmt @@ -0,0 +1,26 @@ +pipeline { + agent { dockerfile true } + stages { + + stage('Build'){ + steps{ + sh ''' + apt update -y + apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl + ./run_tests.sh prepare + rm -rf kcov_out + mkdir kcov_out/ + git config --global user.email "kw@kworkflow.net" + git config --global user.name "Kworkflow" + ./run_tests.sh + kcov --include-path=src,kw \ + --exclude-pattern=src/bash_autocomplete.sh,src/help.sh \ + kcov_out/ ./run_tests.sh + mv kcov_out/run_tests.sh.*/cobertura.xml $(pwd)/cobertura.xml + ''' + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + + } +} diff --git a/jenkinsfiles/integration_tests b/jenkinsfiles/integration_tests index e69de29bb..dc2fbdf6f 100644 --- a/jenkinsfiles/integration_tests +++ b/jenkinsfiles/integration_tests @@ -0,0 +1,26 @@ +pipeline { + agent { dockerfile true } + stages { + + stage('Build'){ + steps{ + sh ''' + apt update -y + apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl + ./run_tests.sh prepare + rm -rf kcov_out + mkdir kcov_out/ + git config --global user.email "kw@kworkflow.net" + git config --global user.name "Kworkflow" + ./run_tests.sh + kcov --include-path=src,kw \ + --exclude-pattern=src/bash_autocomplete.sh,src/help.sh \ + kcov_out/ ./run_tests.sh + mv kcov_out/run_tests.sh.*/cobertura.xml $(pwd)/cobertura.xml + ''' + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + + } +} diff --git a/jenkinsfiles/setup_and_doc b/jenkinsfiles/setup_and_doc index e69de29bb..dc2fbdf6f 100644 --- a/jenkinsfiles/setup_and_doc +++ b/jenkinsfiles/setup_and_doc @@ -0,0 +1,26 @@ +pipeline { + agent { dockerfile true } + stages { + + stage('Build'){ + steps{ + sh ''' + apt update -y + apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl + ./run_tests.sh prepare + rm -rf kcov_out + mkdir kcov_out/ + git config --global user.email "kw@kworkflow.net" + git config --global user.name "Kworkflow" + ./run_tests.sh + kcov --include-path=src,kw \ + --exclude-pattern=src/bash_autocomplete.sh,src/help.sh \ + kcov_out/ ./run_tests.sh + mv kcov_out/run_tests.sh.*/cobertura.xml $(pwd)/cobertura.xml + ''' + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + + } +} diff --git a/jenkinsfiles/shellcheck-reviewdog b/jenkinsfiles/shellcheck-reviewdog index e69de29bb..dc2fbdf6f 100644 --- a/jenkinsfiles/shellcheck-reviewdog +++ b/jenkinsfiles/shellcheck-reviewdog @@ -0,0 +1,26 @@ +pipeline { + agent { dockerfile true } + stages { + + stage('Build'){ + steps{ + sh ''' + apt update -y + apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl + ./run_tests.sh prepare + rm -rf kcov_out + mkdir kcov_out/ + git config --global user.email "kw@kworkflow.net" + git config --global user.name "Kworkflow" + ./run_tests.sh + kcov --include-path=src,kw \ + --exclude-pattern=src/bash_autocomplete.sh,src/help.sh \ + kcov_out/ ./run_tests.sh + mv kcov_out/run_tests.sh.*/cobertura.xml $(pwd)/cobertura.xml + ''' + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + + } +} diff --git a/jenkinsfiles/unit_tests b/jenkinsfiles/unit_tests index e69de29bb..dc2fbdf6f 100644 --- a/jenkinsfiles/unit_tests +++ b/jenkinsfiles/unit_tests @@ -0,0 +1,26 @@ +pipeline { + agent { dockerfile true } + stages { + + stage('Build'){ + steps{ + sh ''' + apt update -y + apt install -y shunit2 bc sqlite3 bsdmainutils libxml-xpath-perl + ./run_tests.sh prepare + rm -rf kcov_out + mkdir kcov_out/ + git config --global user.email "kw@kworkflow.net" + git config --global user.name "Kworkflow" + ./run_tests.sh + kcov --include-path=src,kw \ + --exclude-pattern=src/bash_autocomplete.sh,src/help.sh \ + kcov_out/ ./run_tests.sh + mv kcov_out/run_tests.sh.*/cobertura.xml $(pwd)/cobertura.xml + ''' + cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'cobertura.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false + } + } + + } +}