Skip to content
Snippets Groups Projects

chore: add the 3.9 and 3.11 versions for python-logilab image

Merged Aurélien Lubert requested to merge topic/default/python-logilab-versions into branch/default
1 file
+ 15
5
Compare changes
  • Side-by-side
  • Inline
+ 15
5
import glob
import glob
TEMPLATE = '''
TEMPLATE = '''
build_{project}:
build_{project}{tag}:
image:
image:
name: gcr.io/kaniko-project/executor:debug
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
entrypoint: [""]
@@ -11,5 +11,6 @@
@@ -11,5 +11,6 @@
- echo "{{\\"auths\\":{{\\"$CI_REGISTRY\\":{{\\"username\\":\\"$CI_REGISTRY_USER\\",\\"password\\":\\"$CI_REGISTRY_PASSWORD\\"}}}}}}" > /kaniko/.docker/config.json
- echo "{{\\"auths\\":{{\\"$CI_REGISTRY\\":{{\\"username\\":\\"$CI_REGISTRY_USER\\",\\"password\\":\\"$CI_REGISTRY_PASSWORD\\"}}}}}}" > /kaniko/.docker/config.json
script:
script:
- /kaniko/executor
- /kaniko/executor
 
--build-arg version={version}
--context $CI_PROJECT_DIR/{context}
--context $CI_PROJECT_DIR/{context}
--dockerfile $CI_PROJECT_DIR/{filepath}
--dockerfile $CI_PROJECT_DIR/{filepath}
@@ -14,8 +15,8 @@
@@ -14,8 +15,8 @@
--context $CI_PROJECT_DIR/{context}
--context $CI_PROJECT_DIR/{context}
--dockerfile $CI_PROJECT_DIR/{filepath}
--dockerfile $CI_PROJECT_DIR/{filepath}
--destination $CI_REGISTRY_IMAGE/{project}
--destination $CI_REGISTRY_IMAGE/{project}:{version}
--cache=true
--cache=true
--cache-repo $CI_REGISTRY_IMAGE/cache
--cache-repo $CI_REGISTRY_IMAGE/cache
--cache-ttl 120h
--cache-ttl 120h
'''
'''
@@ -17,9 +18,13 @@
@@ -17,9 +18,13 @@
--cache=true
--cache=true
--cache-repo $CI_REGISTRY_IMAGE/cache
--cache-repo $CI_REGISTRY_IMAGE/cache
--cache-ttl 120h
--cache-ttl 120h
'''
'''
 
VERSIONS = {
 
"python-logilab": ["3.9", "3.11", "latest"],
 
}
 
with open('gitlab-ci-generated.yml', 'w') as f:
with open('gitlab-ci-generated.yml', 'w') as f:
for filepath in sorted(glob.glob('library/**/Dockerfile', recursive=True)):
for filepath in sorted(glob.glob('library/**/Dockerfile', recursive=True)):
project = '-'.join(filepath.split('/')[1:-1])
project = '-'.join(filepath.split('/')[1:-1])
context = filepath.replace('/Dockerfile', '')
context = filepath.replace('/Dockerfile', '')
@@ -22,7 +27,12 @@
@@ -22,7 +27,12 @@
with open('gitlab-ci-generated.yml', 'w') as f:
with open('gitlab-ci-generated.yml', 'w') as f:
for filepath in sorted(glob.glob('library/**/Dockerfile', recursive=True)):
for filepath in sorted(glob.glob('library/**/Dockerfile', recursive=True)):
project = '-'.join(filepath.split('/')[1:-1])
project = '-'.join(filepath.split('/')[1:-1])
context = filepath.replace('/Dockerfile', '')
context = filepath.replace('/Dockerfile', '')
f.write(TEMPLATE.format(project=project,
for version in VERSIONS.get(project, ["latest"]):
context=context,
f.write(TEMPLATE.format(
filepath=filepath))
project=project,
 
context=context,
 
filepath=filepath,
 
version=version,
 
tag="" if version == "latest" else f"_{version}"
 
))
Loading