mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Validate Docker version in CI. (#26496)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26496 It is a BAD BAD idea to deploy Docker versions which are not deployed (per ossci-job-dsl) because those versions will get GC'ed after two weeks. At the moment, there is no verification that your Docker version is deployed. This adds an Azure job to check this. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Differential Revision: D17575100 Pulled By: ezyang fbshipit-source-id: 8df2331c6e6899c585bc2917b55e8955908b0e4a
This commit is contained in:
parent
f7742d2b21
commit
ae2a8fea3d
44
.circleci/validate-docker-version.py
Executable file
44
.circleci/validate-docker-version.py
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import urllib.request
|
||||
import re
|
||||
|
||||
import cimodel.data.pytorch_build_definitions as pytorch_build_definitions
|
||||
import cimodel.data.caffe2_build_definitions as caffe2_build_definitions
|
||||
|
||||
RE_VERSION = re.compile(r'allDeployedVersions = "([0-9,]+)"')
|
||||
|
||||
URL_TEMPLATE = (
|
||||
"https://raw.githubusercontent.com/pytorch/ossci-job-dsl/"
|
||||
"master/src/main/groovy/ossci/{}/DockerVersion.groovy"
|
||||
)
|
||||
|
||||
def check_version(job, expected_version):
|
||||
url = URL_TEMPLATE.format(job)
|
||||
with urllib.request.urlopen(url) as f:
|
||||
contents = f.read().decode('utf-8')
|
||||
m = RE_VERSION.search(contents)
|
||||
if not m:
|
||||
raise RuntimeError(
|
||||
"Unbelievable! I could not find the variable allDeployedVersions in "
|
||||
"{}; did the organization of ossci-job-dsl change?\n\nFull contents:\n{}"
|
||||
.format(url, contents)
|
||||
)
|
||||
valid_versions = [int(v) for v in m.group(1).split(',')]
|
||||
if expected_version not in valid_versions:
|
||||
raise RuntimeError(
|
||||
"We configured {} to use Docker version {}; but this "
|
||||
"version is not deployed in {}. Non-deployed versions will be "
|
||||
"garbage collected two weeks after they are created. DO NOT LAND "
|
||||
"THIS TO MASTER without also updating ossci-job-dsl with this version."
|
||||
"\n\nDeployed versions: {}"
|
||||
.format(job, expected_version, url, m.group(1))
|
||||
)
|
||||
|
||||
def validate_docker_version():
|
||||
check_version('pytorch', pytorch_build_definitions.DOCKER_IMAGE_VERSION)
|
||||
check_version('caffe2', caffe2_build_definitions.DOCKER_IMAGE_VERSION)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
validate_docker_version()
|
||||
|
|
@ -13,6 +13,16 @@ jobs:
|
|||
- script: pip install -r requirements.txt
|
||||
- script: cd .circleci && ./ensure-consistency.py
|
||||
|
||||
- job: validate_docker_version
|
||||
displayName: "Ensure Docker version is correctly deployed"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.7"
|
||||
- script: .circleci/validate-docker-version.py
|
||||
|
||||
- job: shellcheck_jenkins
|
||||
displayName: "Shellcheck Jenkins scripts"
|
||||
pool:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user