Skip to content

Instantly share code, notes, and snippets.

@apua
Last active March 18, 2023 02:09
Show Gist options
  • Save apua/cccd7917a6cf13513e169f00560e736f to your computer and use it in GitHub Desktop.
Save apua/cccd7917a6cf13513e169f00560e736f to your computer and use it in GitHub Desktop.
/*
* The main purpose of code structure is
* (1) to handle different upstream with different strategies, and
* (2) to dispatch groups to build and test
* (3) with common essential information delivered from upstream.
*/
def build_only(kwargs) {
build(job: params.DOWNSTREAM_JOB, propagate: false, wait: false, parameters: [
/* Common parameters */
[$class: "StringParameterValue", name: "LABEL", value: "${upstream_job_name}/${upstream_build_id}"],
[$class: "StringParameterValue", name: "GIT_HASH", value: params.GIT_COMMIT],
/* Configure it to build only */
[$class: "BooleanParameterValue", name: "SKIP_RUN_FPGA", value: true],
/* Build&Test parameters */
[$class: "StringParameterValue", name: "BUILD_TARGET", value: kwargs.build_target],
])
}
def build_n_test(kwargs) {
build(job: params.DOWNSTREAM_JOB, propagate: false, wait: false, parameters: [
/* Common parameters */
[$class: "StringParameterValue", name: "LABEL", value: "${upstream_job_name}/${upstream_build_id}"],
[$class: "StringParameterValue", name: "GIT_HASH", value: params.GIT_COMMIT],
/* Build&Test parameters */
[$class: "StringParameterValue", name: "BUILD_TARGET", value: kwargs.build_target],
[$class: "BooleanParameterValue", name: "USE_INPUT_SOFTWARE", value: true], // <- Do we always use input software?
[$class: "StringParameterValue", name: "FUSDK_PATH", value: kwargs.fusdk_path],
[$class: "StringParameterValue", name: "ROOTFS_PATH", value: kwargs.rootfs_path],
])
}
def upstreamCause = currentBuild.getBuildCauses('org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause')[0]
def upstream_job_name = upstreamCause?.upstreamProject
def upstream_build_id = upstreamCause?.upstreamBuild
pipeline {
agent { label "verif-sys-validation-build-agent" }
stages { stage('Dispatch') { steps {
echo "upstream: $upstream_job_name (#$upstream_build_id)"
echo "downstream: $params.DOWNSTREAM_JOB"
script {
if (upstream_job_name in ['release_panda', 'fpga_regression/kat/test_nightly_call_sv']) {
build_only(
build_target: "p470-plic_vcu118_ivp;p650-plic_vcu118_ivp",
)
build_n_test(
build_target: "p670-saint_haps_ivp",
fusdk_path: "/nfs/teams/verif/share/sys_validation/software/daily_test/twig0218_100HZ_ASID_OFF",
rootfs_path: "/nfs/teams/verif/static/sys_validation/jenkins/fpga_regression/software/rootfs/panda_develop_tcexternal/rootfs-panda-2022-12-23_27-d4b4cd9.ext4",
)
} else if (upstream_job_name in ['release_panda', 'fpga_regression/kat/test_nightly_call_sv']) {
/* to be listed */
} else {
/* to be listed */
}
} }
} }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment