updated storing intdir from nightly for reuse
This commit is contained in:
+42
-4
@@ -4,8 +4,15 @@ pipeline {
|
|||||||
environment {
|
environment {
|
||||||
COVERITY_URL = 'https://coverity.etechtips.com'
|
COVERITY_URL = 'https://coverity.etechtips.com'
|
||||||
COVERITY_STREAM = 'agone-full'
|
COVERITY_STREAM = 'agone-full'
|
||||||
|
COVERITY_PR_STREAM = 'agone-pr'
|
||||||
// Add Coverity binaries to PATH if not globally set on the Jenkins agent
|
// Add Coverity binaries to PATH if not globally set on the Jenkins agent
|
||||||
PATH = "/opt/coverity/analysis/bin:${env.PATH}"
|
PATH = "/opt/coverity/analysis/bin:${env.PATH}"
|
||||||
|
|
||||||
|
// Full-build baseline artifact
|
||||||
|
COVERITY_BASELINE_ARCHIVE = 'agone-full-cov-int.tar.gz'
|
||||||
|
|
||||||
|
//For a Multibranch Pipeline
|
||||||
|
AGONE_FULL_JOB = 'agone/main'
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@@ -57,6 +64,21 @@ bazel build --spawn_strategy=standalone //:run
|
|||||||
--password ${COV_PASSWORD}
|
--password ${COV_PASSWORD}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
// 5. Package the completed full-build intermediate directory
|
||||||
|
sh '''
|
||||||
|
rm -f "${COVERITY_BASELINE_ARCHIVE}"
|
||||||
|
tar -czvf "{COVERITY_BASELINE_ARCHIVE}" cov-int
|
||||||
|
test -s "${COVERITY_BASELINE_ARCHIVE}"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
// 6. Store Baseline as a jenkins artifact
|
||||||
|
archiveArtifacts (
|
||||||
|
artifacts: "${COVERITY_BASELINE_ARCHIVE}",
|
||||||
|
fingerprint: true,
|
||||||
|
onlyIfSuccessful: true
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,12 +131,28 @@ bazel build --spawn_strategy=standalone //:run
|
|||||||
|
|
||||||
echo "Affected Bazel targets:\n${affectedTargets}"
|
echo "Affected Bazel targets:\n${affectedTargets}"
|
||||||
|
|
||||||
// 4. Clean PR-specific Coverity directory
|
copyArtifacts (
|
||||||
sh 'rm -rf cov-int-pr'
|
projectName: "${AGONE_FULL_JOB}",
|
||||||
|
selector: last_successful(),
|
||||||
|
filter: "${COVERITY_BASELINE_ARCHIVE}",
|
||||||
|
fingerprintArtifacts: true
|
||||||
|
)
|
||||||
|
|
||||||
|
// 4a. recover nightly pr
|
||||||
|
sh '''
|
||||||
|
rm -rf cov-int-pr baseline-cov-int
|
||||||
|
mkdir baseline-cov-int
|
||||||
|
tar -xzf "${COVERITY_BASELINE_ARCHIVE}' \
|
||||||
|
-C baseline-cov-int
|
||||||
|
test -d baseline-cov-int/cov-int
|
||||||
|
|
||||||
|
mv baseline-cov-int/cov-int cov-int-pr
|
||||||
|
rmdir baseline-cov-int
|
||||||
|
'''
|
||||||
|
|
||||||
// 5. Build only the affected targets wrapped in cov-build
|
// 5. Build only the affected targets wrapped in cov-build
|
||||||
sh """
|
sh """
|
||||||
cov-build --dir cov-int-pr \
|
cov-build --dir cov-int-pr --bazel \
|
||||||
bazel build --spawn_strategy=standalone ${affectedTargets.replaceAll('\n', ' ')}
|
bazel build --spawn_strategy=standalone ${affectedTargets.replaceAll('\n', ' ')}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -122,7 +160,7 @@ bazel build --spawn_strategy=standalone //:run
|
|||||||
sh """
|
sh """
|
||||||
cov-run-desktop --dir cov-int-pr \
|
cov-run-desktop --dir cov-int-pr \
|
||||||
--target-url ${COVERITY_URL} \
|
--target-url ${COVERITY_URL} \
|
||||||
--stream ${COVERITY_STREAM} \
|
--stream ${COVERITY_PR_STREAM} \
|
||||||
${changedFiles.replaceAll('\n', ' ')}
|
${changedFiles.replaceAll('\n', ' ')}
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user