Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/groovy
- def call(mode) {
- def destDir = '/srv/bitstreams'
- def jobList = [:]
- def gbsList = []
- def remote = [:]
- remote.name = 'compute'
- remote.host = 'compute'
- remote.allowAnyHosts = true
- if (mode) {
- srchParm = "|fgrep -i ${mode}"
- }
- def tmpList = sh(script: "find hw -name 'filelist_PAR*.txt' -type f ${srchParm}", returnStdout: true).split()
- tmpList.each {
- def tmpFile = findFiles(glob: it)
- if (tmpFile.size()) {
- gbsList.addAll(tmpFile)
- }
- }
- def date = sh (script:'date +%Y%m%d', returnStdout: true).trim()
- def gitTag = sh (script: 'git describe --always --match "v[0-9].*"', returnStdout: true).trim()
- destDir += "/${date}-${gitTag}"
- stage('Stash') {
- stash excludes: 'sw/**', includes: 'hw/**, test/**', name: 'Sira'
- }
- for (int x = 0; x < gbsList.size(); x++) {
- int idx = x
- String gbsName = gbsList[idx].name.minus('filelist_PAR_').minus('.txt')
- String gbsPath = gbsList[idx].path
- jobList[gbsName] = {
- node('RTL') {
- stage("Build ${gbsName} - test") {
- unstash 'Sira'
- try {
- sh label: "Build ${gbsName}",
- script: """#!/usr/bin/env bash
- export DCP_VERSION="a10_gx_pac_ias_1_2_pv"
- export DCP_LOC="/opt/inteldevstack/\$DCP_VERSION"
- export OPAE_PLATFORM_ROOT="\$DCP_LOC"
- export QUARTUS_HOME="/opt/inteldevstack/intelFPGA_pro/quartus"
- export MTI_HOME="/opt/modelsim-ase"
- export PATH="\$MTI_HOME/linux:\$MTI_HOME/bin:\$QUARTUS_HOME/bin:\$DCP_LOC/bin:\$PATH"
- rm -Rf build_*
- afu_synth_setup -s ${gbsPath} build_${gbsName}
- cd build_${gbsName}
- \$OPAE_PLATFORM_ROOT/bin/run.sh -o ${gbsName}.gbs > build_${gbsName}.out
- """
- } catch(e) {
- build_ok = false
- error "Failed to build ${gbsName}"
- }
- }
- stage("Publish Bitstream"){
- if (fileExists("build_${gbsName}/${gbsName}.gbs")) {
- withCredentials([sshUserPrivateKey(credentialsId: '<myKey>', keyFileVariable: 'userKey', passphraseVariable: 'userPass', usernameVariable: 'userName')]) {
- remote.user = userName
- remote.identityFile = userKey
- sshCommand remote: remote, command: "mkdir -p ${destDir}"
- sshPut remote: remote, from:"build_${gbsName}/${gbsName}.gbs", into: destDir
- }
- }
- zip zipfile: "build_${gbsname}-logs.zip", archive: true, glob: "build_${gbs_name}/build/output_files/**"
- }
- }
- }
- }
- parallel jobList
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement