foundationdb/tests/SnowflakeJenkins

147 lines
6.1 KiB
Plaintext

def buildScmInfo
stage("Build") {
node('test-dynamic-slave') {
cleanWs()
sfScmInfo = checkout([$class: 'GitSCM',
branches: [[name: '*']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'a0395839-84c7-4ceb-90e2-bcf66b2d6885', url: 'ssh://bitbucket-internal.int.snowflakecomputing.com:7999/opfdb/fdb_snowflake.git']]
])
println("$sfScmInfo")
buildScmInfo = checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake/jenkins/foundationdb']]
])
println("$buildScmInfo")
sh """
|export GIT_SPECIFIER=${buildScmInfo.GIT_COMMIT}
|virtualenv -p python3.4 venv
|source venv/bin/activate
|pip3 install docker-compose
|docker-compose --version
|git config --global user.name jenkins
|git config --global user.email fdb-devs@snowflake.net
|cd snowflake/jenkins
|./build.sh check_uploaded package sql sql_upload upload
""".stripMargin()
}
}
def makeTestStep(iteration) {
return {
node("test-dynamic-slave") {
cleanWs()
sfScmInfo = checkout([$class: 'GitSCM',
branches: [[name: '*']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'a0395839-84c7-4ceb-90e2-bcf66b2d6885', url: 'ssh://bitbucket-internal.int.snowflakecomputing.com:7999/opfdb/fdb_snowflake.git']]
])
println("$sfScmInfo")
scmInfo = checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake/jenkins/foundationdb']]
])
println("$scmInfo")
sh """
|# Clean up the jenkins output; gets messy with too many iterations
|set +x
|exec 3>&1
|exec 1> \$WORKSPACE/setup_${iteration}.log
|exec 2>&1
|
|export GIT_SPECIFIER=${scmInfo.GIT_COMMIT}
|virtualenv -p python3.4 venv
|source venv/bin/activate
|pip3 install docker-compose
|docker-compose --version
|git config --global user.name jenkins
|git config --global user.email fdb-devs@snowflake.net
|
|cd snowflake/jenkins
|echo Iteration ${iteration} building >&3
|./build.sh configure download test sql sql_upload > \$WORKSPACE/iteration_${iteration}.log 2>&1
|rc=\$?
|seed=\$(find . -name traces.json -exec grep -m 1 CMakeSEED {} \\; | awk '{print \$2}' | head -1 | tr -d '"}')
|echo Iteration ${iteration} completed with \$rc - seed \$seed >&3
|mv \$WORKSPACE/iteration_${iteration}.log \$WORKSPACE/iteration_${iteration}_\${seed}.log
|find . -name traces.json -exec gzip -c {} > \$WORKSPACE/traces_${iteration}_\${seed}.json.gz \\;
|#cat \$WORKSPACE/iteration_${iteration}.log
""".stripMargin()
archiveArtifacts artifacts: 'setup_*log,iteration_*log,traces_*.json.gz',
optional: true,
onlyIfSuccessful: false
}
}
}
stage("Test") {
def testSteps = [:]
for (int i = 0; i < 4; i++) {
testSteps["Iteration ${i}"] = makeTestStep(i)
}
println(testSteps)
parallel testSteps
build job: "NotifyGitHub",
parameters: [
string(name: 'pr_branch', value: buildScmInfo.GIT_BRANCH),
string(name: 'publish_url', value: "https://foo.bar/stuff")
],
propagate: false
}
stage("Report") {
node('test-dynamic-slave') {
cleanWs()
sfScmInfo = checkout([$class: 'GitSCM',
branches: [[name: '*']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'a0395839-84c7-4ceb-90e2-bcf66b2d6885', url: 'ssh://bitbucket-internal.int.snowflakecomputing.com:7999/opfdb/fdb_snowflake.git']]
])
println("$sfScmInfo")
buildScmInfo = checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'snowflake/jenkins/foundationdb']]
])
println("$buildScmInfo")
sh """
|export GIT_SPECIFIER=${buildScmInfo.GIT_COMMIT}
|virtualenv -p python3.4 venv
|source venv/bin/activate
|git config --global user.name jenkins
|git config --global user.email fdb-devs@snowflake.net
|cd snowflake/jenkins
|./build.sh sql_create_report
|GIT_TREE=(\$(cd foundationdb && git rev-parse HEAD^{tree}))
|cp -f fdb6-report.txt fdb6-report-\${GIT_TREE}.txt
""".stripMargin()
archiveArtifacts artifacts: '**/fdb6-report-*.txt',
optional: true,
onlyIfSuccessful: false
}
}