Kaydet (Commit) 73a90037 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) Joffrey F

Generate test engines list dynamically

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst e9f31e1e
...@@ -5,13 +5,6 @@ def imageNamePy2 ...@@ -5,13 +5,6 @@ def imageNamePy2
def imageNamePy3 def imageNamePy3
def images = [:] def images = [:]
def dockerVersions = [
"17.06.2-ce", // Latest EE
"17.12.1-ce", // Latest CE stable
"18.02.0-ce", // Latest CE edge
"18.03.0-ce-rc4" // Latest CE RC
]
def buildImage = { name, buildargs, pyTag -> def buildImage = { name, buildargs, pyTag ->
img = docker.image(name) img = docker.image(name)
try { try {
...@@ -37,9 +30,27 @@ def buildImages = { -> ...@@ -37,9 +30,27 @@ def buildImages = { ->
} }
} }
def getDockerVersions = { ->
def dockerVersions = ["17.06.2-ce"]
wrappedNode(label: "ubuntu && !zfs") {
def result = sh(script: """docker run --rm \\
--entrypoint=python \\
${imageNamePy3} \\
/src/scripts/versions.py
""", returnStdout: true
)
dockerVersions = dockerVersions + result.trim().tokenize(' ')
}
return dockerVersions
}
def getAPIVersion = { engineVersion -> def getAPIVersion = { engineVersion ->
def versionMap = ['17.06': '1.30', '17.12': '1.35', '18.02': '1.36', '18.03': '1.37'] def versionMap = ['17.06': '1.30', '17.12': '1.35', '18.02': '1.36', '18.03': '1.37']
return versionMap[engineVersion.substring(0, 5)] def result = versionMap[engineVersion.substring(0, 5)]
if (!result) {
return '1.37'
}
return result
} }
def runTests = { Map settings -> def runTests = { Map settings ->
...@@ -94,6 +105,8 @@ def runTests = { Map settings -> ...@@ -94,6 +105,8 @@ def runTests = { Map settings ->
buildImages() buildImages()
def dockerVersions = getDockerVersions()
def testMatrix = [failFast: false] def testMatrix = [failFast: false]
for (imgKey in new ArrayList(images.keySet())) { for (imgKey in new ArrayList(images.keySet())) {
......
import operator
import re
from collections import namedtuple
import requests
base_url = 'https://download.docker.com/linux/static/{0}/x86_64/'
categories = [
'edge',
'stable',
'test'
]
class Version(namedtuple('_Version', 'major minor patch rc edition')):
@classmethod
def parse(cls, version):
edition = None
version = version.lstrip('v')
version, _, rc = version.partition('-')
if rc:
if 'rc' not in rc:
edition = rc
rc = None
elif '-' in rc:
edition, rc = rc.split('-')
major, minor, patch = version.split('.', 3)
return cls(major, minor, patch, rc, edition)
@property
def major_minor(self):
return self.major, self.minor
@property
def order(self):
"""Return a representation that allows this object to be sorted
correctly with the default comparator.
"""
# rc releases should appear before official releases
rc = (0, self.rc) if self.rc else (1, )
return (int(self.major), int(self.minor), int(self.patch)) + rc
def __str__(self):
rc = '-{}'.format(self.rc) if self.rc else ''
edition = '-{}'.format(self.edition) if self.edition else ''
return '.'.join(map(str, self[:3])) + edition + rc
def main():
results = set()
for url in [base_url.format(cat) for cat in categories]:
res = requests.get(url)
content = res.text
versions = [
Version.parse(
v.strip('"').lstrip('docker-').rstrip('.tgz').rstrip('-x86_64')
) for v in re.findall(
r'"docker-[0-9]+\.[0-9]+\.[0-9]+-.*tgz"', content
)
]
sorted_versions = sorted(
versions, reverse=True, key=operator.attrgetter('order')
)
latest = sorted_versions[0]
results.add(str(latest))
print(' '.join(results))
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment