diff --git a/ghaf-nightly-parallel.groovy b/ghaf-nightly-parallel.groovy new file mode 100644 index 0000000..0d0ff3e --- /dev/null +++ b/ghaf-nightly-parallel.groovy @@ -0,0 +1,805 @@ +#!/usr/bin/env groovy + +// SPDX-FileCopyrightText: 2024 Technology Innovation Institute (TII) +// +// SPDX-License-Identifier: Apache-2.0 + +// Default values for parameters +DEFAULT_URL = 'https://github.com/tiiuae/ghaf.git' +DEFAULT_REF = 'main' +DEFAULT_SBOMNIX = 'a1f0f88d719687acedd989899ecd7fafab42394c' + +pipeline { + agent any + parameters { + string description: 'Repository URL', + name: 'URL', + defaultValue: DEFAULT_URL + string description: 'Branch (or revision reference) Specifier', + name: 'BRANCH', + defaultValue: DEFAULT_REF + string description: 'sbomnix project revision', + name: 'SBOMNIX', + defaultValue: DEFAULT_SBOMNIX + } + triggers { + pollSCM 'H 21 * * *' + } + options { + disableConcurrentBuilds() + buildDiscarder logRotator( + artifactDaysToKeepStr: '7', + artifactNumToKeepStr: '10', + daysToKeepStr: '70', + numToKeepStr: '100' + ) + } + environment { + PROVENANCE_BUILD_TYPE = 'https://docs.cimon.build/provenance/buildtypes/jenkins/v1' + PROVENANCE_BUILDER_ID = "$JENKINS_URL" + PROVENANCE_INVOCATION_ID = "$BUILD_URL" + + // Use default values if parameter values are not yet defined + // like the case on the very first run + GHAF_URL = params.getOrDefault('URL', DEFAULT_URL) + GHAF_REF = params.getOrDefault('BRACH', DEFAULT_REF) + SBOMNIX_REF = params.getOrDefault('SBOMNIX', DEFAULT_SBOMNIX) + } + stages { + stage('Checkout') { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + checkout scmGit( + branches: [[name: params.BRANCH]], + extensions: [cleanBeforeCheckout()], + userRemoteConfigs: [[url: params.URL]] + ) + } + } + } + stage('Test targets') { + parallel { + + stage("AARCH64_AGX_DEBUG") { + environment { + GHAF_TARGET='aarch64-linux.nvidia-jetson-orin-agx-debug' + } + stages { + stage("Build AARCH64_AGX_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh 'date +%s > TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for AARCH64_AGX_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for AARCH64_NX_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for AARCH64_NX_RELEASE") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for RISCV64_ICICLE_KIT") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for X86_64_AGX_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for X86_64_NX_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for X86_64_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for X86_64_GEN11_DEBUG") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$( TS_BEGIN_${GHAF_TARGET}' + sh 'nix build -L .#packages.${GHAF_TARGET} -o result-${GHAF_TARGET}' + sh 'date +%s > TS_FINISHED_${GHAF_TARGET}' + archiveArtifacts allowEmptyArchive: true, + artifacts: "result-${GHAF_TARGET}/**" + } + } + } + stage("Generate provenance for X86_64_GEN11_RELEASE") { + agent any + steps { + ws('workspace/ghaf-pipeline/ghaf') { + sh ''' + PROVENANCE_TIMESTAMP_BEGIN=$(