mirror of https://github.com/docker/compose.git
Use declarative syntax when possible
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
912d90832c
commit
644c55c4f7
|
@ -1,32 +1,70 @@
|
||||||
#!groovy
|
#!groovy
|
||||||
|
|
||||||
def buildImage(baseImage) {
|
pipeline {
|
||||||
def image
|
agent none
|
||||||
wrappedNode(label: "ubuntu && amd64 && !zfs", cleanWorkspace: true) {
|
|
||||||
stage("build image for \"${baseImage}\"") {
|
options {
|
||||||
def scmvar = checkout(scm)
|
skipDefaultCheckout(true)
|
||||||
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
|
buildDiscarder(logRotator(daysToKeepStr: '30'))
|
||||||
image = docker.image(imageName)
|
timeout(time: 2, unit: 'HOURS')
|
||||||
try {
|
timestamps()
|
||||||
image.pull()
|
}
|
||||||
} catch (Exception exc) {
|
|
||||||
sh """docker build -t ${imageName} \\
|
environment {
|
||||||
--target build \\
|
TAG = tag()
|
||||||
--build-arg BUILD_PLATFORM="${baseImage}" \\
|
BUILD_TAG = tag()
|
||||||
--build-arg GIT_COMMIT="${scmvar.GIT_COMMIT}" \\
|
}
|
||||||
.\\
|
|
||||||
"""
|
stages {
|
||||||
sh "docker push ${imageName}"
|
stage('Build test images') {
|
||||||
echo "${imageName}"
|
parallel {
|
||||||
return imageName
|
stage('alpine') {
|
||||||
}
|
agent {
|
||||||
|
label 'ubuntu && amd64 && !zfs'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
buildImage('alpine')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('debian') {
|
||||||
|
agent {
|
||||||
|
label 'ubuntu && amd64 && !zfs'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
buildImage('debian')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
echo "image.id: ${image.id}"
|
|
||||||
return image.id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_versions(imageId, number) {
|
|
||||||
|
def buildImage(baseImage) {
|
||||||
|
def scmvar = checkout(scm)
|
||||||
|
def imageName = "dockerbuildbot/compose:${baseImage}-${scmvar.GIT_COMMIT}"
|
||||||
|
image = docker.image(imageName)
|
||||||
|
|
||||||
|
withDockerRegistry(credentialsId:'dockerbuildbot-index.docker.io') {
|
||||||
|
try {
|
||||||
|
image.pull()
|
||||||
|
} catch (Exception exc) {
|
||||||
|
ansiColor('xterm') {
|
||||||
|
sh """docker build -t ${imageName} \\
|
||||||
|
--target build \\
|
||||||
|
--build-arg BUILD_PLATFORM="${baseImage}" \\
|
||||||
|
--build-arg GIT_COMMIT="${scmvar.GIT_COMMIT}" \\
|
||||||
|
.\\
|
||||||
|
"""
|
||||||
|
sh "docker push ${imageName}"
|
||||||
|
}
|
||||||
|
echo "${imageName}"
|
||||||
|
return imageName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_versions(number) {
|
||||||
def docker_versions
|
def docker_versions
|
||||||
wrappedNode(label: "ubuntu && amd64 && !zfs") {
|
wrappedNode(label: "ubuntu && amd64 && !zfs") {
|
||||||
docker_versions = sh(script:"""
|
docker_versions = sh(script:"""
|
||||||
|
@ -42,7 +80,6 @@ def runTests = { Map settings ->
|
||||||
def dockerVersions = settings.get("dockerVersions", null)
|
def dockerVersions = settings.get("dockerVersions", null)
|
||||||
def pythonVersions = settings.get("pythonVersions", null)
|
def pythonVersions = settings.get("pythonVersions", null)
|
||||||
def baseImage = settings.get("baseImage", null)
|
def baseImage = settings.get("baseImage", null)
|
||||||
def imageName = settings.get("image", null)
|
|
||||||
|
|
||||||
if (!pythonVersions) {
|
if (!pythonVersions) {
|
||||||
throw new Exception("Need Python versions to test. e.g.: `runTests(pythonVersions: 'py37')`")
|
throw new Exception("Need Python versions to test. e.g.: `runTests(pythonVersions: 'py37')`")
|
||||||
|
@ -54,7 +91,8 @@ def runTests = { Map settings ->
|
||||||
{ ->
|
{ ->
|
||||||
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=${pythonVersions} / docker=${dockerVersions} / baseImage=${baseImage}") {
|
||||||
checkout(scm)
|
def scmvar = checkout(scm)
|
||||||
|
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()
|
||||||
echo "Using local system's storage driver: ${storageDriver}"
|
echo "Using local system's storage driver: ${storageDriver}"
|
||||||
sh """docker run \\
|
sh """docker run \\
|
||||||
|
|
Loading…
Reference in New Issue