From 442c205f4ddc3353c6aecfaa85544656bb077c04 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 01:57:28 -0700 Subject: [PATCH 01/10] update input --- bye.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bye.c b/bye.c index a94bbde..595fcae 100644 --- a/bye.c +++ b/bye.c @@ -1,5 +1,7 @@ #include int retval(int inputval) { - return inputval; + if (inputval >= 5 && inputval <=5) { + return inputval; + } } From c0e8dd8e1958dcea155c7a1a1b20504e3d0f8667 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 03:46:18 -0700 Subject: [PATCH 02/10] add jenkins file --- agone_jenkins | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 agone_jenkins diff --git a/agone_jenkins b/agone_jenkins new file mode 100644 index 0000000..423e1cb --- /dev/null +++ b/agone_jenkins @@ -0,0 +1,135 @@ +pipeline { + agent any + + environment { + COVERITY_URL = 'http://sumo:8085' + COVERITY_STREAM = 'agone-full' + // Add Coverity binaries to PATH if not globally set on the Jenkins agent + PATH = "/opt/coverity/analysis/bin:${env.PATH}" + } + + options { + timestamps() + timeout(time: 2, unit: 'HOURS') + } + + stages { + // ================================================================= + // STAGE 1: AGONE-FULL (Triggers on main/master branch commits or nightlies) + // ================================================================= + stage('Agone Full Build & Analysis') { + when { + // Adjust this condition based on your default branch name + branch 'main' + } + steps { + script { + echo "Starting agone-full build..." + + // 1. Clean previous Coverity intermediate directory + sh 'rm -rf cov-int' + + // 2. Run full Bazel build wrapped in cov-build + // --spawn_strategy=standalone ensures Coverity intercepts compiler processes + sh ''' + cov-build --dir cov-int \ + bazel build --spawn_strategy=standalone //run + ''' + + // 3. Analyze captured code + sh 'cov-analyze --dir cov-int' + + // 4. Commit results to Coverity Connect + withCredentials([usernamePassword( + credentialsId: 'coverity-credentials', + passwordVariable: 'COV_PASSWORD', + usernameVariable: 'COV_USER' + )]) { + sh """ + cov-commit-defects --dir cov-int \ + --url ${COVERITY_URL} \ + --stream ${COVERITY_STREAM} \ + --user ${COV_USER} \ + --password ${COV_PASSWORD} + """ + } + } + } + } + + // ================================================================= + // STAGE 2: AGONE-PR (Triggers on Pull Request branches) + // ================================================================= + stage('Agone PR Build & Analysis') { + when { + // Matches Multibranch Pipeline PR branch patterns (e.g., PR-123) + changeRequest() + } + steps { + script { + echo "Starting agone-pr build..." + + // 1. Determine target branch and fetch changes + def targetBranch = env.CHANGE_TARGET ?: 'main' + sh "git fetch origin ${targetBranch}" + + // 2. Identify changed files relative to the target branch + def changedFiles = sh( + script: "git diff --name-only origin/${targetBranch}...HEAD", + returnStdout: true + ).trim() + + if (!changedFiles) { + echo "No files modified in this PR. Skipping build." + return + } + + // Write changed files to a temporary file for Coverity / Bazel querying + writeFile file: 'changed_files.txt', text: changedFiles + + // 3. Query Bazel reverse dependencies to find affected targets + // Formats file paths into a space-separated list for set() query + def bazelQueryTargetSet = changedFiles.split('\n').join(' ') + def affectedTargets = sh( + script: "bazel query --keep_going \"rdeps(//..., set(${bazelQueryTargetSet}))\" 2>/dev/null || true", + returnStdout: true + ).trim() + + if (!affectedTargets) { + echo "No Bazel targets affected by modified files. Skipping build." + return + } + + echo "Affected Bazel targets:\n${affectedTargets}" + + // 4. Clean PR-specific Coverity directory + sh 'rm -rf cov-int-pr' + + // 5. Build only the affected targets wrapped in cov-build + sh """ + cov-build --dir cov-int-pr \ + bazel build --spawn_strategy=standalone ${affectedTargets.replaceAll('\n', ' ')} + """ + + // 6. Run fast desktop analysis on only changed files + sh """ + cov-run-desktop --dir cov-int-pr \ + --target-url ${COVERITY_URL} \ + --stream ${COVERITY_STREAM} \ + ${changedFiles.replaceAll('\n', ' ')} + """ + } + } + } + } + + post { + always { + // Clean up workspace or temporary Bazel artifacts if required + echo "Pipeline complete." + } + failure { + echo "Pipeline failed. Check build logs for Bazel or Coverity errors." + } + } +} From 0d21c347c0711c43733c2232c6e78c4058dc1239 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 03:59:00 -0700 Subject: [PATCH 03/10] comment added --- bye.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bye.c b/bye.c index 595fcae..a310b92 100644 --- a/bye.c +++ b/bye.c @@ -1,5 +1,6 @@ #include +// dummy code added int retval(int inputval) { if (inputval >= 5 && inputval <=5) { return inputval; From a88b836a25f0deeb171b79add026da2d07cb2d16 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:09:57 -0700 Subject: [PATCH 04/10] updated when for PR --- agone_jenkins | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agone_jenkins b/agone_jenkins index 423e1cb..d4321e5 100644 --- a/agone_jenkins +++ b/agone_jenkins @@ -64,6 +64,8 @@ pipeline { when { // Matches Multibranch Pipeline PR branch patterns (e.g., PR-123) changeRequest() + // Triggers if running on any branch that is not 'main' + expression { env.BRANCH_NAME != 'main' } } steps { script { From c3451b24a5fcd7410b2c8fe2c7410a15bbfc6adf Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:18:13 -0700 Subject: [PATCH 05/10] tried updating logic --- agone_jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agone_jenkins b/agone_jenkins index d4321e5..64fe9f2 100644 --- a/agone_jenkins +++ b/agone_jenkins @@ -65,7 +65,7 @@ pipeline { // Matches Multibranch Pipeline PR branch patterns (e.g., PR-123) changeRequest() // Triggers if running on any branch that is not 'main' - expression { env.BRANCH_NAME != 'main' } + not { branch 'main' } } steps { script { From b1b5a5a1fb3cfc24655def10a8629e7d9f4ec2b1 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:21:33 -0700 Subject: [PATCH 06/10] commented branchname --- agone_jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agone_jenkins b/agone_jenkins index 64fe9f2..c4b0f51 100644 --- a/agone_jenkins +++ b/agone_jenkins @@ -65,7 +65,7 @@ pipeline { // Matches Multibranch Pipeline PR branch patterns (e.g., PR-123) changeRequest() // Triggers if running on any branch that is not 'main' - not { branch 'main' } + //not { branch 'main' } } steps { script { From 699b0858a82dd81e660c5eb711317e00d1c53a4c Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:35:57 -0700 Subject: [PATCH 07/10] added my_functions.h --- my_functions.h | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 my_functions.h diff --git a/my_functions.h b/my_functions.h new file mode 100644 index 0000000..79e52ef --- /dev/null +++ b/my_functions.h @@ -0,0 +1,8 @@ +// my_functions.h +#ifndef MY_FUNCTIONS_H +#define MY_FUNCTIONS_H + +// Function declaration (prototype) +int retval(int ); + +#endif From 6fffbc35844a4c15b387977f026842791556233b Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:42:51 -0700 Subject: [PATCH 08/10] fixed return in bye --- bye.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bye.c b/bye.c index a310b92..c61f27a 100644 --- a/bye.c +++ b/bye.c @@ -5,4 +5,5 @@ int retval(int inputval) { if (inputval >= 5 && inputval <=5) { return inputval; } + return inputval + 100; } From a3f3c9a9c0eb25f6000d085990db7d68e9325168 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 20:42:32 -0700 Subject: [PATCH 09/10] updated host to coverity.etechtips.com --- agone_jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agone_jenkins b/agone_jenkins index c4b0f51..f7b9806 100644 --- a/agone_jenkins +++ b/agone_jenkins @@ -2,7 +2,7 @@ pipeline { agent any environment { - COVERITY_URL = 'http://sumo:8085' + COVERITY_URL = 'http://coverity.etechtips.com' COVERITY_STREAM = 'agone-full' // Add Coverity binaries to PATH if not globally set on the Jenkins agent PATH = "/opt/coverity/analysis/bin:${env.PATH}" From d31f8b1250fda03e05bc4d7a58a32e2ea8c98e10 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 21:29:05 -0700 Subject: [PATCH 10/10] add git branch echo --- agone_jenkins | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agone_jenkins b/agone_jenkins index 97f1c6d..e5a03ee 100644 --- a/agone_jenkins +++ b/agone_jenkins @@ -25,6 +25,7 @@ COVERITY_URL = 'http://coverity.etechtips.com' steps { script { echo "Starting agone-full build..." + echo "The current branch is: ${env.BRANCH_NAME}" // 1. Clean previous Coverity intermediate directory sh 'rm -rf cov-int' @@ -70,6 +71,7 @@ bazel build --spawn_strategy=standalone //:run steps { script { echo "Starting agone-pr build..." + echo "The current branch is: ${env.BRANCH_NAME}" // 1. Determine target branch and fetch changes def targetBranch = env.CHANGE_TARGET ?: 'main'