From 442c205f4ddc3353c6aecfaa85544656bb077c04 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 01:57:28 -0700 Subject: [PATCH 1/5] 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; + } } -- 2.54.0 From c0e8dd8e1958dcea155c7a1a1b20504e3d0f8667 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 03:46:18 -0700 Subject: [PATCH 2/5] 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." + } + } +} -- 2.54.0 From 0d21c347c0711c43733c2232c6e78c4058dc1239 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 03:59:00 -0700 Subject: [PATCH 3/5] 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; -- 2.54.0 From a88b836a25f0deeb171b79add026da2d07cb2d16 Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:09:57 -0700 Subject: [PATCH 4/5] 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 { -- 2.54.0 From c3451b24a5fcd7410b2c8fe2c7410a15bbfc6adf Mon Sep 17 00:00:00 2001 From: Eric Downing Date: Wed, 23 Sep 2026 04:18:13 -0700 Subject: [PATCH 5/5] 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 { -- 2.54.0