mirror of https://github.com/docker/compose.git
Get docker versions using a plain command line
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
644c55c4f7
commit
2955f48468
|
@ -1,5 +1,9 @@
|
||||||
#!groovy
|
#!groovy
|
||||||
|
|
||||||
|
def dockerVersions
|
||||||
|
def baseImages = ['alpine', 'debian']
|
||||||
|
def pythonVersions = ['py27', 'py37']
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent none
|
||||||
|
|
||||||
|
@ -17,6 +21,7 @@ pipeline {
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build test images') {
|
stage('Build test images') {
|
||||||
|
// TODO use declarative 1.5.0 `matrix` once available on CI
|
||||||
parallel {
|
parallel {
|
||||||
stage('alpine') {
|
stage('alpine') {
|
||||||
agent {
|
agent {
|
||||||
|
@ -36,6 +41,20 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Get Docker versions') {
|
||||||
|
agent {
|
||||||
|
label 'ubuntu'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
dockerVersions = sh(script:"""
|
||||||
|
curl https://api.github.com/repos/docker/docker-ce/releases \
|
||||||
|
| jq -r -c '.[] | select (.prerelease == false ) | .tag_name | ltrimstr("v")' > /tmp/versions.txt
|
||||||
|
for v in \$(cut -f1 -d"." /tmp/versions.txt | uniq | head -2); do grep -m 1 "\$v" /tmp/versions.txt ; done
|
||||||
|
""", returnStdout: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,33 +83,9 @@ def buildImage(baseImage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_versions(number) {
|
def runTests(dockerVersion, pythonVersion, baseImage) {
|
||||||
def docker_versions
|
|
||||||
wrappedNode(label: "ubuntu && amd64 && !zfs") {
|
|
||||||
docker_versions = sh(script:"""
|
|
||||||
curl https://api.github.com/repos/docker/docker-ce/releases \
|
|
||||||
| jq -r -c '.[] | select (.prerelease == false ) | .tag_name | ltrimstr("v")' > /tmp/versions.txt
|
|
||||||
for v in \$(cut -f1 -d"." /tmp/versions.txt | uniq | head -${number}); do grep -m 1 "\$v" /tmp/versions.txt ; done
|
|
||||||
""", returnStdout: true)
|
|
||||||
}
|
|
||||||
return docker_versions
|
|
||||||
}
|
|
||||||
|
|
||||||
def runTests = { Map settings ->
|
|
||||||
def dockerVersions = settings.get("dockerVersions", null)
|
|
||||||
def pythonVersions = settings.get("pythonVersions", null)
|
|
||||||
def baseImage = settings.get("baseImage", null)
|
|
||||||
|
|
||||||
if (!pythonVersions) {
|
|
||||||
throw new Exception("Need Python versions to test. e.g.: `runTests(pythonVersions: 'py37')`")
|
|
||||||
}
|
|
||||||
if (!dockerVersions) {
|
|
||||||
throw new Exception("Need Docker versions to test. e.g.: `runTests(dockerVersions: 'all')`")
|
|
||||||
}
|
|
||||||
|
|
||||||
{ ->
|
|
||||||
wrappedNode(label: "ubuntu && amd64 && !zfs", cleanWorkspace: true) {
|
wrappedNode(label: "ubuntu && amd64 && !zfs", cleanWorkspace: true) {
|
||||||
stage("test python=${pythonVersions} / docker=${dockerVersions} / baseImage=${baseImage}") {
|
stage("test python=${pythonVersion} / docker=${dockerVersion} / baseImage=${baseImage}") {
|
||||||
def scmvar = checkout(scm)
|
def scmvar = checkout(scm)
|
||||||
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
|
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
|
||||||
def storageDriver = sh(script: 'docker info | awk -F \': \' \'$1 == "Storage Driver" { print $2; exit }\'', returnStdout: true).trim()
|
def storageDriver = sh(script: 'docker info | awk -F \': \' \'$1 == "Storage Driver" { print $2; exit }\'', returnStdout: true).trim()
|
||||||
|
@ -103,25 +98,25 @@ def runTests = { Map settings ->
|
||||||
--volume="/var/run/docker.sock:/var/run/docker.sock" \\
|
--volume="/var/run/docker.sock:/var/run/docker.sock" \\
|
||||||
-e "TAG=${imageName}" \\
|
-e "TAG=${imageName}" \\
|
||||||
-e "STORAGE_DRIVER=${storageDriver}" \\
|
-e "STORAGE_DRIVER=${storageDriver}" \\
|
||||||
-e "DOCKER_VERSIONS=${dockerVersions}" \\
|
-e "DOCKER_VERSIONS=${dockerVersion}" \\
|
||||||
-e "BUILD_NUMBER=\$BUILD_TAG" \\
|
-e "BUILD_NUMBER=\$BUILD_TAG" \\
|
||||||
-e "PY_TEST_VERSIONS=${pythonVersions}" \\
|
-e "PY_TEST_VERSIONS=${pythonVersion}" \\
|
||||||
--entrypoint="script/test/ci" \\
|
--entrypoint="script/test/ci" \\
|
||||||
${imageName} \\
|
${imageName} \\
|
||||||
--verbose
|
--verbose
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def testMatrix = [failFast: true]
|
||||||
|
|
||||||
|
baseImages.each { baseImage ->
|
||||||
|
dockerVersions.eachLine { dockerVersion ->
|
||||||
|
pythonVersions.each { pythonVersion ->
|
||||||
|
testMatrix["${baseImage}_${dockerVersion}_${pythonVersion}"] = runTests(dockerVersion, pythonVersion, baseImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def testMatrix = [failFast: true]
|
parallel testMatrix
|
||||||
def baseImages = ['alpine', 'debian']
|
|
||||||
baseImages.each { baseImage ->
|
|
||||||
def imageName = buildImage(baseImage)
|
|
||||||
get_versions(imageName, 2).eachLine { dockerVersion ->
|
|
||||||
testMatrix["${baseImage}_${dockerVersion}"] = runTests([baseImage: baseImage, image: imageName, dockerVersions: dockerVersion, pythonVersions: 'py37'])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parallel(testMatrix)
|
|
||||||
|
|
Loading…
Reference in New Issue