[CI] Archive long app-logs to Google Storage
@@ -9,6 +9,8 @@ pipeline {
AGENT_BASE_DIR = "src/${REPO}"
ORCH_URL = 'https://obs-load-orch.app.elstc.co'
CREDENTIALS_ID = 'f6c7695a-671e-4f4f-a331-acdce44ff9ba'
+ JOB_GCS_BUCKET = credentials('gcs-bucket')
+ JOB_GCS_CREDENTIALS = 'apm-ci-gcs-plugin'
// Set below for local development
// ORCH_URL='10.0.2.2:8000'
DEBUG_MODE = '0' // set to '0' for production
@@ -176,6 +178,9 @@ pipeline {
}
stage('Run app') {
agent { label 'benchmarks' }
+ environment {
+ BUCKET_URI = """${isPR() ? "gs://${JOB_GCS_BUCKET}/${env.JOB_BASE_NAME}/pr-${env.CHANGE_ID}" : "gs://${JOB_GCS_BUCKET}/${env.JOB_BASE_NAME}/${env.BRANCH_NAME}"}"""
+ }
steps {
// create agent configuration
@@ -277,12 +282,19 @@ pipeline {
// always remove configuration so we don't leave user-input
sh(script: "rm -f ${WORKSPACE}/agent_config.properties")
- // always capture log files
- echo "Collect results and logs"
+ // always capture result files
+ echo "Collect results"
archiveArtifacts(
- artifacts: "*.log,*.jfr,metrics.out",
+ artifacts: "*.jfr,metrics.out",
allowEmptyArchive: true,
onlyIfSuccessful: false)
+
+ // Upload log files to the default location since they are massive
+ googleStorageUpload(bucket: "${env.BUCKET_URI}/${env.BUILD_ID}",
+ credentialsId: "${JOB_GCS_CREDENTIALS}",
+ pattern: "*.log",
+ sharedPublicly: true,
+ showInline: true)
}
}
}
