Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
test: use filebeat step to grab Docker logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kuisathaverat committed Jan 14, 2021
1 parent bd19bcf commit c523424
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .ci/integrationTestDownstream.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ class IntegrationTestingParallelTaskGenerator extends DefaultParallelTaskGenerat
"TMPDIR=${steps.env.WORKSPACE}"
]
def label = "${tag}-${x}-${y}"
def dockerLogs = label.replace(":","_").replace(";","_").replace(" ","").replace("--","-")
try{
steps.runScript(label: label, agentType: tag, env: env)
fielbeat(output: "${dockerLogs}.log", archiveOnlyOnFail: true){
steps.runScript(label: label, agentType: tag, env: env)
}
saveResult(x, y, 1)
} catch (e){
saveResult(x, y, 0)
Expand Down
10 changes: 4 additions & 6 deletions .ci/integrationTestEC.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ def runTest(test){
unstash 'source'
withConfigEnv(){
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
dir("${BASE_DIR}"){
sh ".ci/scripts/${test}.sh"
fielbeat(output: "${dockerLogs}.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh ".ci/scripts/${test}.sh"
}
}
}
}
Expand Down Expand Up @@ -262,10 +264,6 @@ def withConfigEnv(Closure body) {
def grabResultsAndLogs(label){
withConfigEnv(){
dir("${BASE_DIR}"){
if(currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE'){
dockerLogs(step: label, failNever: true)
sh('.ci/scripts/remove_env.sh docker-info')
}
sh('make stop-env || echo 0')
archiveArtifacts(
allowEmptyArchive: true,
Expand Down
6 changes: 4 additions & 2 deletions .ci/integrationTestECK.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ def runTest(test){
unstash 'source'
withConfigEnv(){
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
dir("${BASE_DIR}"){
sh ".ci/scripts/${test}.sh"
fielbeat(output: "${dockerLogs}.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh ".ci/scripts/${test}.sh"
}
}
}
}
Expand Down
33 changes: 20 additions & 13 deletions .ci/integrationTestSelector.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ pipeline {
steps {
deleteDir()
unstash "source"
dir("${BASE_DIR}"){
sh(label: "Testing ${NAME} ${APP}", script: ".ci/scripts/agent.sh ${NAME} ${APP}")
fielbeat(output: "${NAME}-${APP}-docker.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh(label: "Testing ${NAME} ${APP}", script: ".ci/scripts/agent.sh ${NAME} ${APP}")
}
}
}
post {
Expand All @@ -97,8 +99,10 @@ pipeline {
steps {
deleteDir()
unstash "source"
dir("${BASE_DIR}"){
sh(label: "Testing ${NAME} ${OPBEANS_APP}", script: ".ci/scripts/opbeans-app.sh ${NAME} ${APP} ${OPBEANS_APP}")
fielbeat(output: "${OPBEANS_APP}-docker.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh(label: "Testing ${NAME} ${OPBEANS_APP}", script: ".ci/scripts/opbeans-app.sh ${NAME} ${APP} ${OPBEANS_APP}")
}
}
}
post {
Expand All @@ -122,8 +126,10 @@ pipeline {
sh script: ".ci/bump-version.sh ${env.BUILD_OPTS.replaceAll('--rum-agent-branch ', '')} false", label: 'Bump version'
sh script: 'make build', label: 'Build docker image with the new rum agent'
}
dir("${BASE_DIR}"){
sh(label: 'Testing RUM', script: '.ci/scripts/opbeans-rum.sh')
fielbeat(output: "opbeans-rum-docker.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh(label: 'Testing RUM', script: '.ci/scripts/opbeans-rum.sh')
}
}
}
post {
Expand All @@ -147,8 +153,10 @@ pipeline {
steps {
deleteDir()
unstash "source"
dir("${BASE_DIR}"){
sh ".ci/scripts/all.sh"
fielbeat(output: "all-docker.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh ".ci/scripts/all.sh"
}
}
}
post {
Expand Down Expand Up @@ -196,8 +204,10 @@ pipeline {
steps {
deleteDir()
unstash "source"
dir("${BASE_DIR}"){
sh ".ci/scripts/opbeans.sh"
fielbeat(output: "opbeans-docker.log", archiveOnlyOnFail: true){
dir("${BASE_DIR}"){
sh ".ci/scripts/opbeans.sh"
}
}
}
post {
Expand All @@ -218,9 +228,6 @@ pipeline {
def wrappingup(Map params = [:]){
def isJunit = params.containsKey('isJunit') ? params.get('isJunit') : true
dir("${BASE_DIR}"){
if(currentBuild.result == 'FAILURE' || currentBuild.result == 'UNSTABLE'){
dockerLogs(step: "${env.NAME}", failNever: true)
}
sh('make stop-env || echo 0')
def testResultsPattern = 'tests/results/*-junit*.xml'
archiveArtifacts(
Expand Down

0 comments on commit c523424

Please sign in to comment.