From eb75a12a4f4858b0763128b396ad52755306a056 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Fri, 26 Jan 2024 11:49:50 -0500 Subject: [PATCH 1/7] specify PR head commit instead of Jenkins merge commit to codecov --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1f6245051..8b80884fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -60,7 +60,9 @@ pipeline { shasum -a 256 -c codecov.SHA256SUM chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} -f .test_reports/coverage.xml + ./codecov -t ${CODECOV_TOKEN} \ + -f .test_reports/coverage.xml \ + -C ${GIT_PREVIOUS_COMMIT} ''' } } From 751a2ff7498d7af563518bbd8dc370ce300636eb Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Sat, 27 Jan 2024 00:22:00 -0500 Subject: [PATCH 2/7] remove inner jenkins coverage reporting. the plugin has a vulnerability breach --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b80884fb..07cc5a81a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,11 +45,6 @@ pipeline { ''' } discoverGitReferenceBuild() - recordCoverage( - name: 'Scilpy Coverage Report', - sourceCodeRetention: 'MODIFIED', - tools: [[parser: 'COBERTURA', - pattern: '**/.test_reports/coverage.xml']]) sh ''' curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --import # One-time step curl -Os https://uploader.codecov.io/latest/linux/codecov From 987b5dbc12896b9d2a47ca02a368f4ead248a3e7 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Sat, 27 Jan 2024 02:26:13 -0500 Subject: [PATCH 3/7] fix jenkins commit in env --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07cc5a81a..14531517a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,7 @@ pipeline { pip3 install -e . ''' } + } } } @@ -44,6 +45,9 @@ pipeline { pytest --cov-report term-missing:skip-covered ''' } + script { + GIT_COMMIT = sh(returnStdout: true, script: 'git rev-parse $GIT_BRANCH').trim() + } discoverGitReferenceBuild() sh ''' curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --import # One-time step @@ -55,9 +59,8 @@ pipeline { shasum -a 256 -c codecov.SHA256SUM chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} \ - -f .test_reports/coverage.xml \ - -C ${GIT_PREVIOUS_COMMIT} + ./codecov -v -t ${CODECOV_TOKEN} \ + -f .test_reports/coverage.xml ''' } } From 7741a93f2f6485845f579dbf086de2e5363482f3 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 29 Jan 2024 12:09:24 -0500 Subject: [PATCH 4/7] force codecov commits to use --- Jenkinsfile | 5 ++++- codecov.yml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 codecov.yml diff --git a/Jenkinsfile b/Jenkinsfile index 14531517a..c31441d8f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,7 @@ pipeline { } script { GIT_COMMIT = sh(returnStdout: true, script: 'git rev-parse $GIT_BRANCH').trim() + GIT_PREVIOUS_COMMIT = sh(returnStdout: true, script: 'git merge-base origin/master $GIT_BRANCH').trim() } discoverGitReferenceBuild() sh ''' @@ -60,7 +61,9 @@ pipeline { chmod +x codecov ./codecov -v -t ${CODECOV_TOKEN} \ - -f .test_reports/coverage.xml + -f .test_reports/coverage.xml \ + -C ${GIT_COMMIT} \ + -N ${GIT_PREVIOUS_COMMIT} ''' } } diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..6a204f89f --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +codecov: + allow_coverage_offsets: True \ No newline at end of file From 21a439748f1cf5f887de860dae57d2c140ea5567 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 29 Jan 2024 12:38:45 -0500 Subject: [PATCH 5/7] refine codecov config --- codecov.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index 6a204f89f..42d8ef542 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,2 +1,34 @@ codecov: - allow_coverage_offsets: True \ No newline at end of file + allow_coverage_offsets: True + + comment: + layout: "header, diff, flags, components" + + component_management: + individual_components: + - component_id: scilpy_scripts + name: Scripts + paths: + - scripts/ + - component_id: scilpy_library + name: Library + paths: + - scilpy/ + + status: + project: + default: + target: 75% + threshold: 2% + branches: + - master + if_ci_failed: error + only_pulls: false + patch: + default: + target: 90% + branches: + - master + if_ci_failed: error + only_pulls: false + From ea531cd6922473bcd6c08b711fc2ea96a6266382 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 29 Jan 2024 13:58:10 -0500 Subject: [PATCH 6/7] Fix codecov config --- codecov.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/codecov.yml b/codecov.yml index 42d8ef542..9f9d97b6f 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,20 +1,7 @@ codecov: allow_coverage_offsets: True - - comment: - layout: "header, diff, flags, components" - - component_management: - individual_components: - - component_id: scilpy_scripts - name: Scripts - paths: - - scripts/ - - component_id: scilpy_library - name: Library - paths: - - scilpy/ +coverage: status: project: default: @@ -32,3 +19,16 @@ codecov: if_ci_failed: error only_pulls: false +component_management: + individual_components: + - component_id: scilpy_scripts + name: Scripts + paths: + - scripts/ + - component_id: scilpy_library + name: Library + paths: + - scilpy/ + +comment: + layout: "condensed_header, diff, components" \ No newline at end of file From 13b8128a04f2fc9b4422892fc8af959131b821e7 Mon Sep 17 00:00:00 2001 From: AlexVCaron Date: Mon, 29 Jan 2024 14:34:08 -0500 Subject: [PATCH 7/7] set codecov commits in env clause for the stage --- Jenkinsfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c31441d8f..d13a0e7ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,6 +31,14 @@ pipeline { stage('Test') { environment { CODECOV_TOKEN = credentials('scilpy-codecov-token') + CODECOV_GIT_COMMIT = """${sh( + returnStdout: true, + script: 'git rev-parse $GIT_BRANCH' + ).trim()}""" + CODECOV_PARENT_COMMIT = """${sh( + returnStdout: true, + script: 'git merge-base origin/master $GIT_BRANCH' + ).trim()}""" } steps { withPythonEnv('CPython-3.10') { @@ -45,10 +53,6 @@ pipeline { pytest --cov-report term-missing:skip-covered ''' } - script { - GIT_COMMIT = sh(returnStdout: true, script: 'git rev-parse $GIT_BRANCH').trim() - GIT_PREVIOUS_COMMIT = sh(returnStdout: true, script: 'git merge-base origin/master $GIT_BRANCH').trim() - } discoverGitReferenceBuild() sh ''' curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --import # One-time step @@ -62,8 +66,8 @@ pipeline { chmod +x codecov ./codecov -v -t ${CODECOV_TOKEN} \ -f .test_reports/coverage.xml \ - -C ${GIT_COMMIT} \ - -N ${GIT_PREVIOUS_COMMIT} + -C ${CODECOV_GIT_COMMIT} \ + -N ${CODECOV_PARENT_COMMIT} ''' } }