From 83ad4c20ac530b9d38ab1ad143ead866405c38c8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 8 May 2024 12:03:00 +0200 Subject: [PATCH] drop rpm_packaging.groovy Fixes: 8d73ce80678c52cb0f80cfcae3154995e29a813b --- .../pipelines/test/rpm_packaging.groovy | 153 ------------------ 1 file changed, 153 deletions(-) delete mode 100644 theforeman.org/pipelines/test/rpm_packaging.groovy diff --git a/theforeman.org/pipelines/test/rpm_packaging.groovy b/theforeman.org/pipelines/test/rpm_packaging.groovy deleted file mode 100644 index 5305be77..00000000 --- a/theforeman.org/pipelines/test/rpm_packaging.groovy +++ /dev/null @@ -1,153 +0,0 @@ -def packages_to_build -def packages = [:] -def VERCMP_NEWER = 12 -def VERCMP_OLDER = 11 -def VERCMP_EQUAL = 0 - -pipeline { - agent { label 'rpmbuild' } - - options { - timestamps() - timeout(time: 4, unit: 'HOURS') - ansiColor('xterm') - buildDiscarder(logRotator(daysToKeepStr: '7')) - } - - stages { - stage('Clone Packaging') { - steps { - - deleteDir() - ghprb_git_checkout() - setup_obal() - - } - } - - stage('Find Packages to Build') { - steps { - - script { - packages_to_build = find_changed_packages("origin/${ghprbTargetBranch}") - - update_build_description_from_packages(packages_to_build) - } - - } - } - - stage('Lint Spec') { - when { - expression { packages_to_build } - } - steps { - - script { - for(int i = 0; i < packages_to_build.size(); i++) { - def index = i - packages[packages_to_build[index]] = { - obal(action: "lint", packages: packages_to_build[index]) - } - } - - parallel packages - } - } - } - - stage("Verify version and release"){ - when { - expression { packages_to_build } - expression { ghprbTargetBranch == 'rpm/develop'} - } - steps { - script { - - for(int i = 0; i < packages_to_build.size(); i++) { - package_name = packages_to_build[i] - spec_pattern = "packages/**/${package_name}.spec" - - old_spec_path = find_deleted_files("origin/${env.ghprbTargetBranch}", spec_pattern) - if (! old_spec_path) { - old_spec_path = find_changed_files("origin/${env.ghprbTargetBranch}", spec_pattern) - } - - - if (old_spec_path) { - new_spec_path = find_added_or_changed_files("origin/${env.ghprbTargetBranch}", spec_pattern) - if (old_spec_path != new_spec_path) { - continue - } - - sh(script: "git checkout origin/${env.ghprbTargetBranch}", label: "git checkout target_branch") - old_version = query_rpmspec(old_spec_path, '%{VERSION}') - old_release = query_rpmspec(old_spec_path, '%{RELEASE}') - - sh(script: "git checkout -", label: "git checkout source_branch") - new_version = query_rpmspec(new_spec_path, '%{VERSION}') - new_release = query_rpmspec(new_spec_path, '%{RELEASE}') - - compare_version = sh( - script: "rpmdev-vercmp ${old_version} ${new_version}", - returnStatus: true, - label: "rpmdev-vercmp" - ) - - compare_release = sh( - script: "rpmdev-vercmp ${old_release} ${new_release}", - returnStatus: true, - label: "rpmdev-vercmp" - ) - - compare_new_to_one = sh( - script: "rpmdev-vercmp 1 ${new_release}", - returnStatus: true, - label: "rpmdev-vercmp" - ) - - if (compare_version != VERCMP_EQUAL && (compare_new_to_one == VERCMP_OLDER || compare_new_to_one == VERCMP_EQUAL)) { - echo "New version and release is reset to 1 for ${package_name}" - } else if (compare_version != VERCMP_EQUAL && compare_new_to_one == VERCMP_NEWER) { - // new version, but release was not reset - sh """ - echo 'Version updated but release was not reset back to 1 for ${package_name}"' - exit 1 - """ - } else if (compare_version == VERCMP_EQUAL && compare_release == VERCMP_NEWER) { - echo "Version remained the same and release is reset to 1 for ${package_name}" - } else { - sh """ - echo 'Version or release needs updating for ${package_name}"' - exit 1 - """ - } - } - } - } - } - } - - stage('Scratch Build Packages') { - when { - expression { packages_to_build } - } - steps { - - obal(action: "scratch", extraVars: ['build_package_download_logs': 'True', 'build_package_download_rpms': 'True'], packages: packages_to_build) - - } - } - - stage('Repoclosure') { - when { - expression { packages_to_build } - } - steps { - - obal(action: "repoclosure", packages: packages_to_build) - - } - } - } -}