From c6f9041535605ce0adee4508dc51300dfc77b674 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 8 Jan 2025 20:00:05 +0100 Subject: [PATCH 1/3] Fix instance of git_checkout In 70d9a4525b5b36e7644d817db04c554882485b54 the git_checkout function was removed but this remained. Fixes: 70d9a4525b5b ("drop smart-proxy-pr-test and all non-packaging PR testing remains") --- theforeman.org/pipelines/test/smart-proxy.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/theforeman.org/pipelines/test/smart-proxy.groovy b/theforeman.org/pipelines/test/smart-proxy.groovy index c391a0d6..8d28e63d 100644 --- a/theforeman.org/pipelines/test/smart-proxy.groovy +++ b/theforeman.org/pipelines/test/smart-proxy.groovy @@ -61,9 +61,7 @@ pipeline { stages { stage('Setup Git Repos') { steps { - script { - git_checkout() - } + git branch: git_branch, url: 'https://github.com/theforeman/smart-proxy' } } stage('Install dependencies') { From 109e75bbe333926ef104d0589e1b8cdb96cbcd49 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 8 Jan 2025 20:10:04 +0100 Subject: [PATCH 2/3] Set trigger package release jobs instead of on source jobs This inverses the relationship, but it makes it easier because we already have the source name because that's where we copy the artifacts from. --- .../pipelines/release/foreman-x-develop-release.groovy | 4 ++++ .../pipelines/release/source/foreman-installer.groovy | 8 -------- .../pipelines/release/source/foreman-selinux.groovy | 8 -------- theforeman.org/pipelines/release/source/foreman.groovy | 9 --------- .../pipelines/release/source/hammer-cli-x.groovy | 8 -------- theforeman.org/pipelines/release/source/katello.groovy | 8 -------- .../pipelines/release/source/smart-proxy.groovy | 8 -------- 7 files changed, 4 insertions(+), 49 deletions(-) diff --git a/theforeman.org/pipelines/release/foreman-x-develop-release.groovy b/theforeman.org/pipelines/release/foreman-x-develop-release.groovy index 158930fe..7978232d 100644 --- a/theforeman.org/pipelines/release/foreman-x-develop-release.groovy +++ b/theforeman.org/pipelines/release/foreman-x-develop-release.groovy @@ -17,6 +17,10 @@ pipeline { buildDiscarder(logRotator(daysToKeepStr: '7')) } + triggers { + upstream(upstreamProjects: source_project_name, threshold: hudson.model.Result.SUCCESS) + } + stages { stage('Build Package') { parallel { diff --git a/theforeman.org/pipelines/release/source/foreman-installer.groovy b/theforeman.org/pipelines/release/source/foreman-installer.groovy index 97cbd3bc..d4303854 100644 --- a/theforeman.org/pipelines/release/source/foreman-installer.groovy +++ b/theforeman.org/pipelines/release/source/foreman-installer.groovy @@ -34,14 +34,6 @@ pipeline { } } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } diff --git a/theforeman.org/pipelines/release/source/foreman-selinux.groovy b/theforeman.org/pipelines/release/source/foreman-selinux.groovy index 46b54949..415ab8d8 100644 --- a/theforeman.org/pipelines/release/source/foreman-selinux.groovy +++ b/theforeman.org/pipelines/release/source/foreman-selinux.groovy @@ -37,14 +37,6 @@ pipeline { } } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } diff --git a/theforeman.org/pipelines/release/source/foreman.groovy b/theforeman.org/pipelines/release/source/foreman.groovy index 9943a0bc..26e41f59 100644 --- a/theforeman.org/pipelines/release/source/foreman.groovy +++ b/theforeman.org/pipelines/release/source/foreman.groovy @@ -117,15 +117,6 @@ pipeline { } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } diff --git a/theforeman.org/pipelines/release/source/hammer-cli-x.groovy b/theforeman.org/pipelines/release/source/hammer-cli-x.groovy index b124d652..cfbc70ac 100644 --- a/theforeman.org/pipelines/release/source/hammer-cli-x.groovy +++ b/theforeman.org/pipelines/release/source/hammer-cli-x.groovy @@ -35,14 +35,6 @@ pipeline { } } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } diff --git a/theforeman.org/pipelines/release/source/katello.groovy b/theforeman.org/pipelines/release/source/katello.groovy index ce458255..99bb8ae1 100644 --- a/theforeman.org/pipelines/release/source/katello.groovy +++ b/theforeman.org/pipelines/release/source/katello.groovy @@ -135,14 +135,6 @@ pipeline { } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } diff --git a/theforeman.org/pipelines/release/source/smart-proxy.groovy b/theforeman.org/pipelines/release/source/smart-proxy.groovy index 5746a11f..727efa84 100644 --- a/theforeman.org/pipelines/release/source/smart-proxy.groovy +++ b/theforeman.org/pipelines/release/source/smart-proxy.groovy @@ -57,14 +57,6 @@ pipeline { } post { - success { - build( - job: "${project_name}-${git_ref}-package-release", - propagate: false, - wait: false - ) - } - failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } From b5030dbdc92758d33c4f2243ece57a03c8a5914f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 8 Jan 2025 20:01:14 +0100 Subject: [PATCH 3/3] Align the smart-proxy testing and source release jobs This attempts to align the stable testing job to the source release job as much as possible. --- .../release/source/smart-proxy.groovy | 46 ++++++++++--------- .../pipelines/test/smart-proxy.groovy | 11 ++--- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/theforeman.org/pipelines/release/source/smart-proxy.groovy b/theforeman.org/pipelines/release/source/smart-proxy.groovy index 727efa84..097ae406 100644 --- a/theforeman.org/pipelines/release/source/smart-proxy.groovy +++ b/theforeman.org/pipelines/release/source/smart-proxy.groovy @@ -1,9 +1,9 @@ pipeline { - agent any + agent none options { timestamps() - timeout(time: 2, unit: 'HOURS') + timeout(time: 1, unit: 'HOURS') ansiColor('xterm') buildDiscarder(logRotator(daysToKeepStr: '7')) } @@ -18,13 +18,22 @@ pipeline { values '2.7.6', '3.0.4', '3.1.0' } } + environment { + BUNDLE_WITHOUT = 'development' + } stages { stage("Clone repository") { steps { git url: git_url, branch: git_ref } } - stage("Test Ruby") { + stage('Install dependencies') { + steps { + bundleInstall(ruby) + archiveArtifacts(artifacts: 'Gemfile.lock') + } + } + stage('Run tests') { environment { // ci_reporters gem CI_REPORTS = 'jenkins/reports/unit' @@ -33,13 +42,20 @@ pipeline { MINITEST_REPORTERS_REPORTS_DIR = 'jenkins/reports/unit' } steps { - run_test(ruby: env.ruby) + bundleExec(ruby, 'rake jenkins:unit') + } + post { + always { + junit testResults: 'jenkins/reports/unit/*.xml' + } } } } } } stage('Build and Archive Source') { + agent any + steps { dir(project_name) { git url: git_url, branch: git_ref @@ -53,6 +69,11 @@ pipeline { sourcefile_paths = generate_sourcefiles(project_name: project_name, source_type: source_type) } } + post { + always { + deleteDir() + } + } } } @@ -60,22 +81,5 @@ pipeline { failure { notifyDiscourse(env, "${project_name} source release pipeline failed:", currentBuild.description) } - - cleanup { - deleteDir() - } - } -} - -def run_test(args) { - def ruby = args.ruby - - try { - sh "cp config/settings.yml.example config/settings.yml" - bundleInstall(ruby, "--without=development") - archiveArtifacts(artifacts: 'Gemfile.lock') - bundleExec(ruby, "rake jenkins:unit --trace") - } finally { - junit(testResults: 'jenkins/reports/unit/*.xml') } } diff --git a/theforeman.org/pipelines/test/smart-proxy.groovy b/theforeman.org/pipelines/test/smart-proxy.groovy index 8d28e63d..79ffd9a0 100644 --- a/theforeman.org/pipelines/test/smart-proxy.groovy +++ b/theforeman.org/pipelines/test/smart-proxy.groovy @@ -1,13 +1,10 @@ pipeline { agent none + options { timeout(time: 1, unit: 'HOURS') ansiColor('xterm') } - environment { - BUNDLE_JOBS = 4 - BUNDLE_RETRY = 3 - } stages { stage('Rubocop') { @@ -59,7 +56,7 @@ pipeline { BUNDLE_WITHOUT = 'development' } stages { - stage('Setup Git Repos') { + stage("Clone repository") { steps { git branch: git_branch, url: 'https://github.com/theforeman/smart-proxy' } @@ -67,9 +64,10 @@ pipeline { stage('Install dependencies') { steps { bundleInstall(ruby) + archiveArtifacts(artifacts: 'Gemfile.lock') } } - stage('Run Tests') { + stage('Run tests') { environment { // ci_reporters gem CI_REPORTS = 'jenkins/reports/unit' @@ -89,7 +87,6 @@ pipeline { } post { always { - archiveArtifacts artifacts: 'Gemfile.lock' deleteDir() } }