From abd506aa4cfd4089ccd88e30978a1195cdffdb8b Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 7 Feb 2020 11:42:20 +0200 Subject: [PATCH 01/20] Test production workflow --- MANIFEST.in | 1 - integration-tests/Dockerfile | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 4b590a36f..1f147fabb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,2 @@ include tljh/systemd-units/* include tljh/*.tpl -include tljh/requirements-base.txt diff --git a/integration-tests/Dockerfile b/integration-tests/Dockerfile index 7fc244ee9..00c6ac101 100644 --- a/integration-tests/Dockerfile +++ b/integration-tests/Dockerfile @@ -21,8 +21,8 @@ RUN systemctl set-default multi-user.target STOPSIGNAL SIGRTMIN+3 # Set up image to be useful out of the box for development & CI -ENV TLJH_BOOTSTRAP_DEV=yes -ENV TLJH_BOOTSTRAP_PIP_SPEC=/srv/src +#ENV TLJH_BOOTSTRAP_DEV=yes +#ENV TLJH_BOOTSTRAP_PIP_SPEC=/srv/src ENV PATH=/opt/tljh/hub/bin:${PATH} CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] From 74831c29bc22f8c3bb64af7db69d73b03a88175e Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 7 Feb 2020 13:08:08 +0200 Subject: [PATCH 02/20] no checkout --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff1f28390..5fc3973bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: command: | apk add --no-cache python3 pytest - - checkout + # - checkout - setup_remote_docker - run: From 52d635d07c477998dda8c1c1c245b776242b589b Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 10:38:53 +0200 Subject: [PATCH 03/20] Reuse command --- .circleci/config.yml | 46 +++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5fc3973bf..d2f48ce9a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,22 @@ -version: 2 +version: 2.1 +commands: + setup_venv: + description: Setup hub venv + steps: + - run: + name: Setup venv + command: | + python3 -m venv /srv/venv + echo 'export PATH=/srv/venv/bin:$PATH' >> $BASH_ENV + + install_python: + description: Install python3, venv, git and make + steps: + - run: + name: install python + command: | + apt-get update --yes && apt-get install --yes python3 python3-venv git make + jobs: unit-test: docker: @@ -11,10 +29,7 @@ jobs: - checkout # Setup Python - - run: - name: install python - command: | - apt-get update --yes && apt-get install --yes python3 python3-venv git + - install_python # Download and cache dependencies - restore_cache: @@ -22,12 +37,7 @@ jobs: - v1-dependencies-py3.6-{{ checksum "setup.py" }}-{{ checksum "dev-requirements.txt" }} - v1-dependencies-py3.6- - - run: - name: Setup venv - command: | - python3 -m venv /srv/venv - echo 'export PATH=/srv/venv/bin:$PATH' >> $BASH_ENV - + - setup_venv - run: name: install dependencies command: | @@ -59,7 +69,7 @@ jobs: command: | apk add --no-cache python3 pytest - # - checkout + - checkout - setup_remote_docker - run: @@ -103,21 +113,13 @@ jobs: - checkout # Setup Python - - run: - name: install python - command: | - apt-get update --yes && apt-get install --yes python3 python3-venv git make + - install_python # Download and cache dependencies - restore_cache: key: v1-dependencies-py3.6-sphinx - - run: - name: Setup venv - command: | - python3 -m venv /srv/venv - echo 'export PATH=/srv/venv/bin:$PATH' >> $BASH_ENV - + - setup_venv - run: name: install dependencies command: | From 7dccf4bcfe3faaf895f51dd78fcb5db913542831 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 10:58:53 +0200 Subject: [PATCH 04/20] Reuse executor --- .circleci/config.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2f48ce9a..1eba2a502 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,12 @@ version: 2.1 +executors: + ubuntu_docker: + docker: + # Match target OS of TLJH + - image: ubuntu:18.04 + working_directory: ~/repo + + commands: setup_venv: description: Setup hub venv @@ -19,12 +27,7 @@ commands: jobs: unit-test: - docker: - # Match target OS of TLJH - - image: ubuntu:18.04 - - working_directory: ~/repo - + executor: ubuntu_docker steps: - checkout @@ -103,12 +106,7 @@ jobs: documentation: - docker: - # Match target OS of TLJH - - image: ubuntu:18.04 - - working_directory: ~/repo - + executor: ubuntu_docker steps: - checkout From b5ad4417a80088c1a734429c4c25ffab41fee2da Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 13:09:16 +0200 Subject: [PATCH 05/20] Don't copy everyhting --- .circleci/config.yml | 2 +- .circleci/integration-test.py | 9 +++++---- integration-tests/Dockerfile | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1eba2a502..03f77bfd8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: name: Run plugin tests command: | .circleci/integration-test.py run-test \ - --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ + --installer-args "--plugin /srv/src/plugins/simplest" \ plugins test_simplest_plugin.py - run: diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index 85d66ecd4..1039d4550 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -85,19 +85,20 @@ def run_test(image_name, test_name, test_files, installer_args): os.path.join(os.path.dirname(__file__), os.pardir) ) - copy_to_container(test_name, source_path, '/srv/src') + copy_to_container(test_name, os.path.join(source_path, 'bootstrap/'), '/srv/src') run_container_command( test_name, - f'python3 /srv/src/bootstrap/bootstrap.py {installer_args}' + f'python3 /srv/src/bootstrap.py {installer_args}' ) + copy_to_container(test_name, os.path.join(source_path, 'integration-tests/'), '/srv/src') run_container_command( test_name, - 'python3 -m pip install -r /srv/src/integration-tests/requirements.txt' + 'python3 -m pip install -r /srv/src/requirements.txt' ) run_container_command( test_name, 'python3 -m pytest -v {}'.format( - ' '.join([os.path.join('/srv/src/integration-tests/', f) for f in test_files]) + ' '.join([os.path.join('/srv/src/', f) for f in test_files]) ) ) diff --git a/integration-tests/Dockerfile b/integration-tests/Dockerfile index 00c6ac101..5eda6c875 100644 --- a/integration-tests/Dockerfile +++ b/integration-tests/Dockerfile @@ -23,6 +23,6 @@ STOPSIGNAL SIGRTMIN+3 # Set up image to be useful out of the box for development & CI #ENV TLJH_BOOTSTRAP_DEV=yes #ENV TLJH_BOOTSTRAP_PIP_SPEC=/srv/src -ENV PATH=/opt/tljh/hub/bin:${PATH} +#ENV PATH=/opt/tljh/hub/bin:${PATH} CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] From 2af177b753a73a5a3c0133a3eaa77bd04e4a141e Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 16:35:48 +0200 Subject: [PATCH 06/20] Use pip from hub env to run tests --- .circleci/integration-test.py | 10 ++++++---- integration-tests/requirements.txt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index 1039d4550..3a3dcbdf8 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -86,19 +86,21 @@ def run_test(image_name, test_name, test_files, installer_args): ) copy_to_container(test_name, os.path.join(source_path, 'bootstrap/'), '/srv/src') + copy_to_container(test_name, os.path.join(source_path, 'integration-tests/'), '/srv/src') run_container_command( test_name, f'python3 /srv/src/bootstrap.py {installer_args}' ) - copy_to_container(test_name, os.path.join(source_path, 'integration-tests/'), '/srv/src') + # Install pkgs from requirements in hub's pip, where + # the bootstrap script installed the others run_container_command( test_name, - 'python3 -m pip install -r /srv/src/requirements.txt' + '/opt/tljh/hub/bin/python3 -m pip install -r /srv/src/integration-tests/requirements.txt' ) run_container_command( test_name, - 'python3 -m pytest -v {}'.format( - ' '.join([os.path.join('/srv/src/', f) for f in test_files]) + '/opt/tljh/hub/bin/python3 -m pytest -v {}'.format( + ' '.join([os.path.join('/srv/src/integration-tests/', f) for f in test_files]) ) ) diff --git a/integration-tests/requirements.txt b/integration-tests/requirements.txt index 271c563cc..a6f3d1704 100644 --- a/integration-tests/requirements.txt +++ b/integration-tests/requirements.txt @@ -1,3 +1,3 @@ pytest pytest-asyncio -git+https://github.com/yuvipanda/hubtraf.git \ No newline at end of file +git+https://github.com/yuvipanda/hubtraf.git From a130b939d2f9b5759d77b9ce9dac399df4ed3cb1 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 16:50:27 +0200 Subject: [PATCH 07/20] Instruct setting env vars for dev setup --- integration-tests/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/Dockerfile b/integration-tests/Dockerfile index 5eda6c875..897218901 100644 --- a/integration-tests/Dockerfile +++ b/integration-tests/Dockerfile @@ -20,7 +20,7 @@ RUN systemctl set-default multi-user.target STOPSIGNAL SIGRTMIN+3 -# Set up image to be useful out of the box for development & CI +# Uncomment these lines for a development install #ENV TLJH_BOOTSTRAP_DEV=yes #ENV TLJH_BOOTSTRAP_PIP_SPEC=/srv/src #ENV PATH=/opt/tljh/hub/bin:${PATH} From 99442eaaab80820469f411fec71680859d210d4f Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 17:08:27 +0200 Subject: [PATCH 08/20] Correct manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 1f147fabb..4b590a36f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include tljh/systemd-units/* include tljh/*.tpl +include tljh/requirements-base.txt From 4af48907b095e36b9da6b38fbfbe2f312adec630 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 17 Feb 2020 17:45:26 +0200 Subject: [PATCH 09/20] Get paths right --- .circleci/config.yml | 2 +- .circleci/integration-test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 03f77bfd8..1eba2a502 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: name: Run plugin tests command: | .circleci/integration-test.py run-test \ - --installer-args "--plugin /srv/src/plugins/simplest" \ + --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ plugins test_simplest_plugin.py - run: diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index 3a3dcbdf8..796853340 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -85,7 +85,7 @@ def run_test(image_name, test_name, test_files, installer_args): os.path.join(os.path.dirname(__file__), os.pardir) ) - copy_to_container(test_name, os.path.join(source_path, 'bootstrap/'), '/srv/src') + copy_to_container(test_name, os.path.join(source_path, 'bootstrap/.'), '/srv/src') copy_to_container(test_name, os.path.join(source_path, 'integration-tests/'), '/srv/src') run_container_command( test_name, From d8ecebab140aa936bb296e019241538b82734ef2 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 18 Feb 2020 15:50:38 +0200 Subject: [PATCH 10/20] Fix installer --- tljh/installer.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tljh/installer.py b/tljh/installer.py index d8b8b6301..35277250d 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -254,18 +254,22 @@ def ensure_user_environment(user_requirements_txt_file): miniconda_old_version = '4.5.4' miniconda_new_version = '4.7.10' - conda_version = '4.5.8' + miniconda_installer_md5 = "1c945f2b3335c7b2b15130b1b2dc5cf4" - # If no prior miniconda installation is found, we can install a newer version - if not conda.check_miniconda_version( - USER_ENV_PREFIX, miniconda_old_version - ) and not conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version): - miniconda_installer_md5 = "1c945f2b3335c7b2b15130b1b2dc5cf4" + if conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version): conda_version = '4.8.1' + else: + if conda.check_miniconda_version( + USER_ENV_PREFIX, miniconda_old_version + ) + conda_version = '4.5.8' + # If no prior miniconda installation is found, we can install a newer version + else: + logger.info('Downloading & setting up user environment...') + with conda.download_miniconda_installer(miniconda_new_version, miniconda_installer_md5) as installer_path: + conda.install_miniconda(installer_path, USER_ENV_PREFIX) + conda_version = '4.8.1' - logger.info('Downloading & setting up user environment...') - with conda.download_miniconda_installer(miniconda_new_version, miniconda_installer_md5) as installer_path: - conda.install_miniconda(installer_path, USER_ENV_PREFIX) conda.ensure_conda_packages(USER_ENV_PREFIX, [ # Conda's latest version is on conda much more so than on PyPI. From 15d849c275ff730af45c847395fea1a74610e905 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 18 Feb 2020 15:51:33 +0200 Subject: [PATCH 11/20] Add upgrade test --- .circleci/config.yml | 103 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 83 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1eba2a502..5fef4d696 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,6 +25,61 @@ commands: command: | apt-get update --yes && apt-get install --yes python3 python3-venv git make + build_systemd_image: + steps: + - run: + name: build systemd image + command: | + .circleci/integration-test.py build-image + + basic_tests: + parameters: + upgrade: + type: string + default: "" + steps: + - run: + name: Run basic tests + command: | + .circleci/integration-test.py run-test basic-tests \ + test_hub.py test_install.py test_extensions.py \ + << parameters.upgrade >> + + admin_tests: + parameters: + upgrade: + type: string + default: "" + steps: + - run: + name: Run admin tests + command: | + .circleci/integration-test.py run-test \ + --installer-args "--admin admin:admin" \ + basic-tests test_admin_installer.py \ + << parameters.upgrade >> + + plugin_tests: + parameters: + upgrade: + type: string + default: "" + steps: + - run: + name: Run plugin tests + command: | + .circleci/integration-test.py run-test \ + --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ + plugins test_simplest_plugin.py \ + << parameters.upgrade >> + + bootstrap_checks: + steps: + - run: + name: Run bootstrap checks + command: | + py.test integration-tests/test_bootstrap.py + jobs: unit-test: executor: ubuntu_docker @@ -73,36 +128,44 @@ jobs: apk add --no-cache python3 pytest - checkout + - setup_remote_docker - - run: - name: build systemd image - command: | - .circleci/integration-test.py build-image + - build_systemd_image - - run: - name: Run basic tests - command: | - .circleci/integration-test.py run-test basic-tests test_hub.py test_install.py test_extensions.py + - basic-tests - - run: - name: Run admin tests - command: | - .circleci/integration-test.py run-test --installer-args "--admin admin:admin" basic-tests test_admin_installer.py + - admin_tests + - plugin_tests + + - bootstrap_checks - - run: - name: Run plugin tests - command: | - .circleci/integration-test.py run-test \ - --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ - plugins test_simplest_plugin.py + upgrade-test: + docker: + - image: docker:18.05.0-ce-git + + steps: - run: - name: Run bootstrap checks + name: setup python3 command: | - py.test integration-tests/test_bootstrap.py + apk add --no-cache python3 pytest + + - checkout + + - setup_remote_docker + + - build_systemd_image + + - basic-tests: + upgrade: "--upgrade" + + - admin_tests: + upgrade: "--upgrade" + - plugin_tests: + upgrade: "--upgrade" documentation: From 764806b9990c37f7a880aa54011c2dde14df4982 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 18 Feb 2020 16:32:45 +0200 Subject: [PATCH 12/20] Install current pr branch --- .circleci/config.yml | 44 ++++++++++++++++++++++++++++++----- .circleci/integration-test.py | 31 ++++++++++++++++++------ 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5fef4d696..cf3006274 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,19 +37,27 @@ commands: upgrade: type: string default: "" + branch_path: + type: string + default: "" + steps: - run: name: Run basic tests command: | .circleci/integration-test.py run-test basic-tests \ test_hub.py test_install.py test_extensions.py \ - << parameters.upgrade >> + << parameters.upgrade >> << parameters.branch_path >> admin_tests: parameters: upgrade: type: string default: "" + branch_path: + type: string + default: "" + steps: - run: name: Run admin tests @@ -57,13 +65,17 @@ commands: .circleci/integration-test.py run-test \ --installer-args "--admin admin:admin" \ basic-tests test_admin_installer.py \ - << parameters.upgrade >> + << parameters.upgrade >> << parameters.branch_path >> plugin_tests: parameters: upgrade: type: string default: "" + branch_path: + type: string + default: "" + steps: - run: name: Run plugin tests @@ -80,6 +92,15 @@ commands: command: | py.test integration-tests/test_bootstrap.py + get_pr_branch: + steps: + - run: + name: Get PR branch + command: | + CIRCLE_PR_BRANCH=`curl -s https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PR_NUMBER} \ + | grep '"ref":' | grep -v "master" | cut -d '"' -f4' + + jobs: unit-test: executor: ubuntu_docker @@ -127,19 +148,25 @@ jobs: command: | apk add --no-cache python3 pytest + - get_pr_branch + - checkout - setup_remote_docker - build_systemd_image - - basic-tests + - basic-tests: + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" - - admin_tests + - admin_tests: + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" - - plugin_tests + - plugin_tests: + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" - - bootstrap_checks + - bootstrap_checks: + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" upgrade-test: @@ -152,6 +179,8 @@ jobs: command: | apk add --no-cache python3 pytest + - get_pr_branch + - checkout - setup_remote_docker @@ -160,12 +189,15 @@ jobs: - basic-tests: upgrade: "--upgrade" + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" - admin_tests: upgrade: "--upgrade" + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" - plugin_tests: upgrade: "--upgrade" + branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" documentation: diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index 796853340..fee82974b 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -15,7 +15,7 @@ def build_systemd_image(image_name, source_path): ]) -def run_systemd_image(image_name, container_name): +def run_systemd_image(image_name, container_name, branch_path): """ Run docker image with systemd @@ -23,7 +23,7 @@ def run_systemd_image(image_name, container_name): Container named container_name will be started. """ - subprocess.check_call([ + cmd = [ 'docker', 'run', '--privileged', '--mount', 'type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup', @@ -34,7 +34,12 @@ def run_systemd_image(image_name, container_name): # If we change this, need to change all other references to this number. '--memory', '1G', image_name - ]) + ] + + if branch_path: + cmd.append('-e', f'TLJH_BOOTSTRAP_PIP_SPEC="{branch_path}"') + + subprocess.check_call(cmd) def stop_container(container_name): @@ -74,12 +79,12 @@ def copy_to_container(container_name, src_path, dest_path): ]) -def run_test(image_name, test_name, test_files, installer_args): +def run_test(image_name, test_name, branch_path, test_files, upgrade, installer_args): """ Wrapper that sets up tljh with installer_args & runs test_name """ stop_container(test_name) - run_systemd_image(image_name, test_name) + run_systemd_image(image_name, test_name, branch_path) source_path = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir) @@ -87,10 +92,20 @@ def run_test(image_name, test_name, test_files, installer_args): copy_to_container(test_name, os.path.join(source_path, 'bootstrap/.'), '/srv/src') copy_to_container(test_name, os.path.join(source_path, 'integration-tests/'), '/srv/src') + + + # Install TLJH master first to test upgrades + if upgrade: + run_container_command( + test_name, + f'curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | python3 -' + ) + run_container_command( test_name, f'python3 /srv/src/bootstrap.py {installer_args}' ) + # Install pkgs from requirements in hub's pip, where # the bootstrap script installed the others run_container_command( @@ -140,7 +155,9 @@ def main(): run_test_parser = subparsers.add_parser('run-test') run_test_parser.add_argument('--installer-args', default='') + run_test_parser.add_argument('--upgrade', action='store_true') run_test_parser.add_argument('test_name') + run_test_parser.add_argument('branch_path') run_test_parser.add_argument('test_files', nargs='+') show_logs_parser = subparsers.add_parser('show-logs') @@ -151,7 +168,7 @@ def main(): image_name = 'tljh-systemd' if args.action == 'run-test': - run_test(image_name, args.test_name, args.test_files, args.installer_args) + run_test(image_name, args.test_name, args.branch_path, args.test_files, args.upgrade, args.installer_args) elif args.action == 'show-logs': show_logs(args.container_name) elif args.action == 'run': @@ -159,7 +176,7 @@ def main(): elif args.action == 'copy': copy_to_container(args.container_name, args.src, args.dest) elif args.action == 'start-container': - run_systemd_image(image_name, args.container_name) + run_systemd_image(image_name, args.container_name, args.branch_path) elif args.action == 'stop-container': stop_container(args.container_name) elif args.action == 'build-image': From f64d762d23a8aa32eeec6f9a7727de58fefe0ccc Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 18 Feb 2020 16:47:18 +0200 Subject: [PATCH 13/20] Get env var right --- .circleci/config.yml | 46 ++++++++++++++++++++------------------------ tljh/installer.py | 2 +- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf3006274..924d4723b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,14 +40,14 @@ commands: branch_path: type: string default: "" - steps: - run: name: Run basic tests command: | + CIRCLE_PR_BRANCH=`curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | grep '"ref":' | grep -v "master" | cut -d '"' -f4` .circleci/integration-test.py run-test basic-tests \ test_hub.py test_install.py test_extensions.py \ - << parameters.upgrade >> << parameters.branch_path >> + << parameters.upgrade >> $CIRCLE_PR_BRANCH admin_tests: parameters: @@ -57,7 +57,6 @@ commands: branch_path: type: string default: "" - steps: - run: name: Run admin tests @@ -75,7 +74,6 @@ commands: branch_path: type: string default: "" - steps: - run: name: Run plugin tests @@ -86,20 +84,16 @@ commands: << parameters.upgrade >> bootstrap_checks: + parameters: + branch_path: + type: string + default: "" steps: - run: name: Run bootstrap checks command: | py.test integration-tests/test_bootstrap.py - get_pr_branch: - steps: - - run: - name: Get PR branch - command: | - CIRCLE_PR_BRANCH=`curl -s https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PR_NUMBER} \ - | grep '"ref":' | grep -v "master" | cut -d '"' -f4' - jobs: unit-test: @@ -148,56 +142,57 @@ jobs: command: | apk add --no-cache python3 pytest - - get_pr_branch - - checkout - setup_remote_docker - build_systemd_image - - basic-tests: - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + - basic_tests: + branch_path: $CIRCLE_PR_BRANCH - admin_tests: - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - plugin_tests: - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - bootstrap_checks: - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' upgrade-test: docker: - image: docker:18.05.0-ce-git + environment: + CIRCLE_PR_BRANCH: | + $(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER \ + | grep '"ref":' | grep -v "master" | cut -d '"' -f4) + steps: - run: name: setup python3 command: | apk add --no-cache python3 pytest - - get_pr_branch - - checkout - setup_remote_docker - build_systemd_image - - basic-tests: + - basic_tests: upgrade: "--upgrade" - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - admin_tests: upgrade: "--upgrade" - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: "git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH" - plugin_tests: upgrade: "--upgrade" - branch_path: "git+https://github.com/{CIRCLE_PROJECT_USERNAME}/the-littlest-jupyterhub.git@${CIRCLE_PR_BRANCH}" + branch_path: "git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH" documentation: @@ -240,4 +235,5 @@ workflows: jobs: - unit-test - integration-test + - upgrade-test - documentation diff --git a/tljh/installer.py b/tljh/installer.py index 35277250d..092cec99b 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -261,7 +261,7 @@ def ensure_user_environment(user_requirements_txt_file): else: if conda.check_miniconda_version( USER_ENV_PREFIX, miniconda_old_version - ) + ): conda_version = '4.5.8' # If no prior miniconda installation is found, we can install a newer version else: From c71fae19c00aa56e1aa11e13c80942f64e89731d Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 18 Feb 2020 17:53:43 +0200 Subject: [PATCH 14/20] Get PR branch path --- .circleci/config.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 924d4723b..f0d810e06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,9 +45,10 @@ commands: name: Run basic tests command: | CIRCLE_PR_BRANCH=`curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | grep '"ref":' | grep -v "master" | cut -d '"' -f4` + BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH .circleci/integration-test.py run-test basic-tests \ test_hub.py test_install.py test_extensions.py \ - << parameters.upgrade >> $CIRCLE_PR_BRANCH + << parameters.upgrade >> $BRANCH admin_tests: parameters: @@ -141,6 +142,10 @@ jobs: name: setup python3 command: | apk add --no-cache python3 pytest + - run: + name: install curl + command: | + apk add curl curl-dev - checkout @@ -149,27 +154,18 @@ jobs: - build_systemd_image - basic_tests: - branch_path: $CIRCLE_PR_BRANCH - admin_tests: - branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - plugin_tests: - branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - bootstrap_checks: - branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' upgrade-test: docker: - image: docker:18.05.0-ce-git - environment: - CIRCLE_PR_BRANCH: | - $(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER \ - | grep '"ref":' | grep -v "master" | cut -d '"' -f4) - steps: - run: name: setup python3 @@ -184,15 +180,12 @@ jobs: - basic_tests: upgrade: "--upgrade" - branch_path: 'git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH' - admin_tests: upgrade: "--upgrade" - branch_path: "git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH" - plugin_tests: upgrade: "--upgrade" - branch_path: "git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH" documentation: From 6fd2e44b7c2deb79a73bbb680e1e27f3f0528482 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Wed, 19 Feb 2020 11:57:11 +0200 Subject: [PATCH 15/20] Fix --- .circleci/config.yml | 54 +++++++++++++++++++---------------- .circleci/integration-test.py | 6 ++-- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0d810e06..7debd3fc3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,58 +37,61 @@ commands: upgrade: type: string default: "" - branch_path: - type: string - default: "" steps: - run: name: Run basic tests command: | - CIRCLE_PR_BRANCH=`curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | grep '"ref":' | grep -v "master" | cut -d '"' -f4` - BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_PR_BRANCH - .circleci/integration-test.py run-test basic-tests \ - test_hub.py test_install.py test_extensions.py \ - << parameters.upgrade >> $BRANCH + PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + if [ "$PR_BRANCH" == "null" ];then + PR_BRANCH=$CIRCLE_BRANCH + fi + BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + .circleci/integration-test.py run-test basic-tests \ + "$BRANCH" test_hub.py test_install.py test_extensions.py \ + << parameters.upgrade >> admin_tests: parameters: upgrade: type: string default: "" - branch_path: - type: string - default: "" steps: - run: name: Run admin tests command: | + PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + if [ "$PR_BRANCH" == "null" ];then + PR_BRANCH=$CIRCLE_BRANCH + fi + BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + .circleci/integration-test.py run-test \ --installer-args "--admin admin:admin" \ - basic-tests test_admin_installer.py \ - << parameters.upgrade >> << parameters.branch_path >> + basic-tests $BRANCH test_admin_installer.py \ + << parameters.upgrade >> plugin_tests: parameters: upgrade: type: string default: "" - branch_path: - type: string - default: "" steps: - run: name: Run plugin tests command: | + PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + if [ "$PR_BRANCH" == "null" ];then + PR_BRANCH=$CIRCLE_BRANCH + fi + BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + .circleci/integration-test.py run-test \ --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ - plugins test_simplest_plugin.py \ + plugins $BRANCH test_simplest_plugin.py \ << parameters.upgrade >> bootstrap_checks: parameters: - branch_path: - type: string - default: "" steps: - run: name: Run bootstrap checks @@ -143,9 +146,10 @@ jobs: command: | apk add --no-cache python3 pytest - run: - name: install curl + name: install curl and jq command: | apk add curl curl-dev + apk add jq - checkout @@ -153,13 +157,13 @@ jobs: - build_systemd_image - - basic_tests: + - basic_tests - - admin_tests: + - admin_tests - - plugin_tests: + - plugin_tests - - bootstrap_checks: + - bootstrap_checks upgrade-test: diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index fee82974b..b82bcd6cb 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -33,11 +33,13 @@ def run_systemd_image(image_name, container_name, branch_path): # to need at least this much RAM to build. Boo? # If we change this, need to change all other references to this number. '--memory', '1G', - image_name ] if branch_path: - cmd.append('-e', f'TLJH_BOOTSTRAP_PIP_SPEC="{branch_path}"') + cmd.append('-e') + cmd.append(f'TLJH_BOOTSTRAP_PIP_SPEC={branch_path}') + + cmd.append(image_name) subprocess.check_call(cmd) From 36f79340eca77e31288e39f08d53149a677e8846 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Wed, 19 Feb 2020 12:05:59 +0200 Subject: [PATCH 16/20] Reuse install cmd --- .circleci/config.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7debd3fc3..c04cb3c7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,6 +25,20 @@ commands: command: | apt-get update --yes && apt-get install --yes python3 python3-venv git make + setup_pkgs: + description: Setup pkgs for integration and upgrade tests + steps: + - run: + name: setup python3 + command: | + apk add --no-cache python3 pytest + - run: + name: install curl and jq + command: | + apk add curl curl-dev + apk add jq + + build_systemd_image: steps: - run: @@ -141,15 +155,7 @@ jobs: - image: docker:18.05.0-ce-git steps: - - run: - name: setup python3 - command: | - apk add --no-cache python3 pytest - - run: - name: install curl and jq - command: | - apk add curl curl-dev - apk add jq + - setup_pkgs - checkout @@ -171,10 +177,7 @@ jobs: - image: docker:18.05.0-ce-git steps: - - run: - name: setup python3 - command: | - apk add --no-cache python3 pytest + - setup_pkgs - checkout From b51467dcd32fd2f7749a4330f3df080a63b4b857 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Thu, 20 Feb 2020 13:31:17 +0200 Subject: [PATCH 17/20] Some refactoring --- .circleci/config.yml | 23 ++++++++++++++--------- .circleci/integration-test.py | 16 ++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c04cb3c7b..998c70bc5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,6 +33,7 @@ commands: command: | apk add --no-cache python3 pytest - run: + # Need this to indentify the circle pr branch name: install curl and jq command: | apk add curl curl-dev @@ -48,6 +49,7 @@ commands: basic_tests: parameters: + # Whether or not we should run update tests upgrade: type: string default: "" @@ -55,14 +57,15 @@ commands: - run: name: Run basic tests command: | - PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER + PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` if [ "$PR_BRANCH" == "null" ];then PR_BRANCH=$CIRCLE_BRANCH fi - BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH .circleci/integration-test.py run-test basic-tests \ - "$BRANCH" test_hub.py test_install.py test_extensions.py \ + "$BOOTSTRAP_PIP_SPEC" test_hub.py test_install.py test_extensions.py \ << parameters.upgrade >> admin_tests: parameters: @@ -73,15 +76,16 @@ commands: - run: name: Run admin tests command: | - PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER + PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` if [ "$PR_BRANCH" == "null" ];then PR_BRANCH=$CIRCLE_BRANCH fi - BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH .circleci/integration-test.py run-test \ --installer-args "--admin admin:admin" \ - basic-tests $BRANCH test_admin_installer.py \ + basic-tests $BOOTSTRAP_PIP_SPEC test_admin_installer.py \ << parameters.upgrade >> plugin_tests: @@ -93,15 +97,16 @@ commands: - run: name: Run plugin tests command: | - PR_BRANCH=`(curl -s https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER | jq -r ".head.ref")` + PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER + PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` if [ "$PR_BRANCH" == "null" ];then PR_BRANCH=$CIRCLE_BRANCH fi - BRANCH=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH .circleci/integration-test.py run-test \ --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ - plugins $BRANCH test_simplest_plugin.py \ + plugins $BOOTSTRAP_PIP_SPEC test_simplest_plugin.py \ << parameters.upgrade >> bootstrap_checks: diff --git a/.circleci/integration-test.py b/.circleci/integration-test.py index b82bcd6cb..00f15e8e6 100755 --- a/.circleci/integration-test.py +++ b/.circleci/integration-test.py @@ -15,7 +15,7 @@ def build_systemd_image(image_name, source_path): ]) -def run_systemd_image(image_name, container_name, branch_path): +def run_systemd_image(image_name, container_name, bootstrap_pip_spec): """ Run docker image with systemd @@ -35,9 +35,9 @@ def run_systemd_image(image_name, container_name, branch_path): '--memory', '1G', ] - if branch_path: + if bootstrap_pip_spec: cmd.append('-e') - cmd.append(f'TLJH_BOOTSTRAP_PIP_SPEC={branch_path}') + cmd.append(f'TLJH_BOOTSTRAP_PIP_SPEC={bootstrap_pip_spec}') cmd.append(image_name) @@ -81,12 +81,12 @@ def copy_to_container(container_name, src_path, dest_path): ]) -def run_test(image_name, test_name, branch_path, test_files, upgrade, installer_args): +def run_test(image_name, test_name, bootstrap_pip_spec, test_files, upgrade, installer_args): """ Wrapper that sets up tljh with installer_args & runs test_name """ stop_container(test_name) - run_systemd_image(image_name, test_name, branch_path) + run_systemd_image(image_name, test_name, bootstrap_pip_spec) source_path = os.path.abspath( os.path.join(os.path.dirname(__file__), os.pardir) @@ -159,7 +159,7 @@ def main(): run_test_parser.add_argument('--installer-args', default='') run_test_parser.add_argument('--upgrade', action='store_true') run_test_parser.add_argument('test_name') - run_test_parser.add_argument('branch_path') + run_test_parser.add_argument('bootstrap_pip_spec') run_test_parser.add_argument('test_files', nargs='+') show_logs_parser = subparsers.add_parser('show-logs') @@ -170,7 +170,7 @@ def main(): image_name = 'tljh-systemd' if args.action == 'run-test': - run_test(image_name, args.test_name, args.branch_path, args.test_files, args.upgrade, args.installer_args) + run_test(image_name, args.test_name, args.bootstrap_pip_spec, args.test_files, args.upgrade, args.installer_args) elif args.action == 'show-logs': show_logs(args.container_name) elif args.action == 'run': @@ -178,7 +178,7 @@ def main(): elif args.action == 'copy': copy_to_container(args.container_name, args.src, args.dest) elif args.action == 'start-container': - run_systemd_image(image_name, args.container_name, args.branch_path) + run_systemd_image(image_name, args.container_name, args.bootstrap_pip_spec) elif args.action == 'stop-container': stop_container(args.container_name) elif args.action == 'build-image': From 904d18e2d628c13551b98fd5e13f0ab4d5335e81 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Fri, 21 Feb 2020 11:05:14 +0200 Subject: [PATCH 18/20] Halt upgrade test when on master --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 998c70bc5..66cad1840 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -182,6 +182,16 @@ jobs: - image: docker:18.05.0-ce-git steps: + - run: + name: Check upgrade testing + command: | + if [ "$CIRCLE_BRANCH" == "master" ]; then + echo "On master, no upgrade to test..." + circleci-agent step halt + else + echo "PR detected, testing upgrade..." + fi + - setup_pkgs - checkout From 5320b43c05917754a64d581a3432f1263e0783fa Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 24 Feb 2020 14:12:42 +0200 Subject: [PATCH 19/20] Use commit to install --- .circleci/config.yml | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 66cad1840..c6eef7071 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -57,12 +57,7 @@ commands: - run: name: Run basic tests command: | - PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER - PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` - if [ "$PR_BRANCH" == "null" ];then - PR_BRANCH=$CIRCLE_BRANCH - fi - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 .circleci/integration-test.py run-test basic-tests \ "$BOOTSTRAP_PIP_SPEC" test_hub.py test_install.py test_extensions.py \ @@ -76,12 +71,7 @@ commands: - run: name: Run admin tests command: | - PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER - PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` - if [ "$PR_BRANCH" == "null" ];then - PR_BRANCH=$CIRCLE_BRANCH - fi - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 .circleci/integration-test.py run-test \ --installer-args "--admin admin:admin" \ @@ -97,12 +87,7 @@ commands: - run: name: Run plugin tests command: | - PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER - PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")` - if [ "$PR_BRANCH" == "null" ];then - PR_BRANCH=$CIRCLE_BRANCH - fi - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH + BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 .circleci/integration-test.py run-test \ --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ From 957739831b365b73f38aaa34e52ccf7ecd576a01 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Mon, 24 Feb 2020 14:20:37 +0200 Subject: [PATCH 20/20] Remove curl and jq --- .circleci/config.yml | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c6eef7071..2c2a0557c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,21 +25,6 @@ commands: command: | apt-get update --yes && apt-get install --yes python3 python3-venv git make - setup_pkgs: - description: Setup pkgs for integration and upgrade tests - steps: - - run: - name: setup python3 - command: | - apk add --no-cache python3 pytest - - run: - # Need this to indentify the circle pr branch - name: install curl and jq - command: | - apk add curl curl-dev - apk add jq - - build_systemd_image: steps: - run: @@ -145,7 +130,10 @@ jobs: - image: docker:18.05.0-ce-git steps: - - setup_pkgs + - run: + name: setup python3 + command: | + apk add --no-cache python3 pytest - checkout @@ -177,7 +165,10 @@ jobs: echo "PR detected, testing upgrade..." fi - - setup_pkgs + - run: + name: setup python3 + command: | + apk add --no-cache python3 pytest - checkout