mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
ci: let ubuntu version be configurable
This commit is contained in:
21
.github/integration-test.py
vendored
21
.github/integration-test.py
vendored
@@ -4,15 +4,16 @@ import subprocess
|
||||
import os
|
||||
|
||||
|
||||
def build_systemd_image(image_name, source_path):
|
||||
def build_systemd_image(image_name, source_path, build_args=None):
|
||||
"""
|
||||
Build docker image with systemd at source_path.
|
||||
|
||||
Built image is tagged with image_name
|
||||
"""
|
||||
subprocess.check_call([
|
||||
'docker', 'build', '-t', image_name, source_path
|
||||
])
|
||||
cmd = ['docker', 'build', '-t', image_name, source_path]
|
||||
if build_args:
|
||||
cmd.extend([f"--build-arg={ba}" for ba in build_args])
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def run_systemd_image(image_name, container_name, bootstrap_pip_spec):
|
||||
@@ -138,13 +139,21 @@ def main():
|
||||
argparser = argparse.ArgumentParser()
|
||||
subparsers = argparser.add_subparsers(dest='action')
|
||||
|
||||
subparsers.add_parser('build-image')
|
||||
build_image_parser = subparsers.add_parser('build-image')
|
||||
build_image_parser.add_argument(
|
||||
"--build-arg",
|
||||
action="append",
|
||||
dest="build_args",
|
||||
)
|
||||
|
||||
subparsers.add_parser('stop-container').add_argument(
|
||||
'container_name'
|
||||
)
|
||||
|
||||
subparsers.add_parser('start-container').add_argument(
|
||||
'container_name'
|
||||
)
|
||||
|
||||
run_parser = subparsers.add_parser('run')
|
||||
run_parser.add_argument('container_name')
|
||||
run_parser.add_argument('command')
|
||||
@@ -181,7 +190,7 @@ def main():
|
||||
elif args.action == 'stop-container':
|
||||
stop_container(args.container_name)
|
||||
elif args.action == 'build-image':
|
||||
build_systemd_image(image_name, 'integration-tests')
|
||||
build_systemd_image(image_name, 'integration-tests', args.build_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user