Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore(pipeline) Limit Docker API rate limit when testing #1640

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ stage('Record builds and sessions') {
}
axes['jenkinsVersions'].each { jenkinsVersion ->
infra.withArtifactCachingProxy {
// Need to authenticate on DockerHub with a read-only account to avoid rate limit
infra.withDockerCredentials {
sh "rm -rf target && DISPLAY=:0 ./run.sh firefox ${jenkinsVersion} -Dmaven.repo.local=${WORKSPACE_TMP}/m2repo -B clean process-test-resources"
}
}
def coreCommit = sh(script: './core-commit.sh', returnStdout: true).trim()
/*
Expand Down Expand Up @@ -125,31 +122,34 @@ for (int i = 0; i < splits.size(); i++) {
retryCounts = retryCounts + 1 // increment the retry count before allocating a node in case it fails
node(nodeLabel) {
checkout scm
def image = buildImage ? docker.build('jenkins/ath', '--build-arg uid="$(id -u)" --build-arg gid="$(id -g)" ./src/main/resources/ath-container/') : docker.image('jenkins/ath')
sh 'mkdir -p target/ath-reports && chmod a+rwx target/ath-reports'
def cwd = pwd()
image.inside("-v /var/run/docker.sock:/var/run/docker.sock -v '${cwd}/target/ath-reports:/reports:rw' --shm-size 2g") {
def exclusions = splits.get(index).join('\n')
writeFile file: 'excludes.txt', text: exclusions
infra.withArtifactCachingProxy {
realtimeJUnit(
testResults: 'target/surefire-reports/TEST-*.xml',
testDataPublishers: [[$class: 'AttachmentPublisher']],
// Slow test(s) removal can causes a split to get empty which otherwise fails the build.
// The build failure prevents parallel tests executor to realize the tests are gone so same
// split is run to execute and report zero tests - which fails the build. Permit the test
// results to be empty to break the circle: build after removal executes one empty split
// but not letting the build to fail will cause next build not to try those tests again.
allowEmptyResults: true
) {
sh """
set-java.sh ${jdk}
eval \$(vnc.sh)
java -version
run.sh ${browser} ${jenkinsVersion} -Dmaven.repo.local=${WORKSPACE_TMP}/m2repo -Dmaven.test.failure.ignore=true -DforkCount=1 -B
cp --verbose target/surefire-reports/TEST-*.xml /reports
"""
}
// Need to authenticate on DockerHub with a read-only account to avoid rate limit
infra.withDockerCredentials {
def image = buildImage ? docker.build('jenkins/ath', '--build-arg uid="$(id -u)" --build-arg gid="$(id -g)" ./src/main/resources/ath-container/') : docker.image('jenkins/ath')
sh 'mkdir -p target/ath-reports && chmod a+rwx target/ath-reports'
def cwd = pwd()
image.inside("-v /var/run/docker.sock:/var/run/docker.sock -v '${cwd}/target/ath-reports:/reports:rw' --shm-size 2g") {
def exclusions = splits.get(index).join('\n')
writeFile file: 'excludes.txt', text: exclusions
infra.withArtifactCachingProxy {
realtimeJUnit(
testResults: 'target/surefire-reports/TEST-*.xml',
testDataPublishers: [[$class: 'AttachmentPublisher']],
// Slow test(s) removal can causes a split to get empty which otherwise fails the build.
// The build failure prevents parallel tests executor to realize the tests are gone so same
// split is run to execute and report zero tests - which fails the build. Permit the test
// results to be empty to break the circle: build after removal executes one empty split
// but not letting the build to fail will cause next build not to try those tests again.
allowEmptyResults: true
) {
sh """
set-java.sh ${jdk}
eval \$(vnc.sh)
java -version
run.sh ${browser} ${jenkinsVersion} -Dmaven.repo.local=${WORKSPACE_TMP}/m2repo -Dmaven.test.failure.ignore=true -DforkCount=1 -B
cp --verbose target/surefire-reports/TEST-*.xml /reports
"""
}
}
}
}
withCredentials([string(credentialsId: 'launchable-jenkins-acceptance-test-harness', variable: 'LAUNCHABLE_TOKEN')]) {
Expand Down
Loading