Skip to content
Merged
Changes from 4 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
101 changes: 99 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,103 @@ for (int i = 0; i < platforms.size(); ++i) {
}
}
}

/* Execute our platforms in parallel */
parallel(branches)

// Integration testing, using a locally built Docker image
def itBranches = [:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is definitely some level of copy paste below. I think we'll want to factor this out at some point.

But I didn't want to spend too much making this generic yet (like having a way to simply provide the command the pass, the expected result, etc.). I'd rather first have this merged as-is, once green, and we iterate on growing the test coverage and will refactor in followups.


itBranches['buildtriggerbadge:2.10 tests success'] = {
node('docker') {
checkout scm

// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}

stage('Download Jenkins 2.164.1') {
sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}

stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=11 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"

sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}

itBranches['buildtriggerbadge:2.10 tests success on JDK11'] = {
node('docker') {
checkout scm

// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}

stage('Download Jenkins 2.164.1') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2.164.2?

sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}

stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=11 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"

sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}

itBranches['buildtriggerbadge:2.10 tests success on JDK8'] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to prevent copy-paste ?

node('docker') {
checkout scm

// should we build the image only once and somehow export and stash/unstash it then?
// not sure this would be that quicker
stage('Build Docker Image') {
sh 'make docker'
}

stage('Download Jenkins 2.164.1') {
sh '''
curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war
echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check
'''
}

stage("Run known successful case(s)") {
sh '''docker run --rm \
-v $(pwd)/jenkins.war:/pct/jenkins.war:ro \
-v $(pwd)/out:/pct/out -e JDK_VERSION=8 \
-e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \
jenkins/pct
'''
archiveArtifacts artifacts: "out/**"

sh 'cat out/pct-report.html | grep "Tests : Success"'
}
}
}

itBranches.failFast = false
parallel itBranches