From 829dcf696c103d4eb63b71b626e9df0e1f5954a3 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 7 Sep 2023 20:16:42 +0200 Subject: [PATCH] Support for adding downstream: releasepy + repo_uploader Signed-off-by: Jose Luis Rivero --- .../dsl/_configs_/OSRFSourceCreation.groovy | 50 +++++++++++++++++-- jenkins-scripts/dsl/test.dsl | 5 +- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/jenkins-scripts/dsl/_configs_/OSRFSourceCreation.groovy b/jenkins-scripts/dsl/_configs_/OSRFSourceCreation.groovy index 3e5df8e21..a7eed1933 100644 --- a/jenkins-scripts/dsl/_configs_/OSRFSourceCreation.groovy +++ b/jenkins-scripts/dsl/_configs_/OSRFSourceCreation.groovy @@ -37,16 +37,16 @@ class OSRFSourceCreation } } - static void create(Job job, Map default_params = [:]) + static void create(Job job, Map default_params = [:], Map default_hidden_params = [:]) { OSRFLinuxBuildPkgBase.create(job) GenericRemoteToken.create(job) OSRFSourceCreation.addParameters(job, default_params) + def pkg_sources_dir="pkgs" + job.with { - label Globals.nontest_label("docker") - wrappers { preBuildCleanup() } @@ -55,6 +55,9 @@ class OSRFSourceCreation priority 100 } + def canonical_package_name = Globals.get_canonical_package_name( + default_params.find{ it.key == "PACKAGE"}.value) + steps { systemGroovyCommand("""\ build.setDescription( @@ -98,6 +101,47 @@ class OSRFSourceCreation } } + // Useful to inject testing jobs + static void call_uploader_and_releasepy(Job job, + String repository_uploader_jobname, + String releasepy_jobname) + { + job.with + { + publishers { + postBuildScripts { + steps { + conditionalSteps { + condition { + not { + expression('none|None|^$','${ENV,var="UPLOAD_TO_REPO"}') + } + } + steps { + // Invoke repository_uploader + downstreamParameterized { + trigger(repository_uploader_jobname) { + parameters { + currentBuild() + predefinedProps([PROJECT_NAME_TO_COPY_ARTIFACTS: '${JOB_NAME}', + S3_UPLOAD_PATH: Globals.s3_upload_tarball_path(package_name)]) + propertiesFile(properties_file) // TARBALL_NAME + } + } + } + downstreamParameterized { + trigger(releasepy_jobname) { + parameters { + currentBuild() + predefinedProps([PROJECT_NAME_TO_COPY_ARTIFACTS: "\${JOB_NAME}"]) + propertiesFile(properties_file) // TARBALL_NAME + } + } + } + } + } + } + } } } } diff --git a/jenkins-scripts/dsl/test.dsl b/jenkins-scripts/dsl/test.dsl index c8f542e8d..7427601ec 100644 --- a/jenkins-scripts/dsl/test.dsl +++ b/jenkins-scripts/dsl/test.dsl @@ -23,8 +23,11 @@ OSRFReleasepy.create(releasepy_job, [DRY_RUN: true]) // gz source testing job def gz_source_job = job("_test_gz_source") OSRFSourceCreation.create(gz_source_job, [ - PACKAGE_NAME: "gz-cmake3", + PACKAGE: "gz-cmake3" , SOURCE_REPO_URI: "https://github.com/gazebosim/gz-cmake.git"]) +OSRFSourceCreation.call_uploader_and_releasepy(gz_source_job, + '_test_repository_uploader', + '_test_releasepy') // ------------------------------------------------------------------- def outdated_job_runner = job("_test_outdated_job_runner")