Skip to content

Commit

Permalink
arm64 support for mambaforge and traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
cdibble committed Oct 28, 2021
1 parent 5239527 commit ce02f25
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 7 deletions.
149 changes: 149 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
version: 2.1

commands:
build_systemd_image:
steps:
- run:
name: build systemd image
command: |
.circleci/integration-test.py build-image
basic_tests:
parameters:
# Whether or not we should run update tests
upgrade:
type: string
default: ""
steps:
- run:
name: Run basic tests
command: |
if [ $CIRCLE_PR_USERNAME ]; then
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
else
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
fi
.circleci/integration-test.py run-test \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
basic-tests test_hub.py test_proxy.py \
test_install.py test_extensions.py \
<< parameters.upgrade >>
admin_tests:
parameters:
upgrade:
type: string
default: ""
steps:
- run:
name: Run admin tests
command: |
if [ $CIRCLE_PR_USERNAME ]; then
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
else
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
fi
.circleci/integration-test.py run-test \
--installer-args "--admin admin:admin" \
--bootstrap-pip-spec $BOOTSTRAP_PIP_SPEC \
basic-tests test_admin_installer.py \
<< parameters.upgrade >>
plugin_tests:
parameters:
upgrade:
type: string
default: ""
steps:
- run:
name: Run plugin tests
command: |
if [ $CIRCLE_PR_USERNAME ]; then
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
else
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1
fi
.circleci/integration-test.py run-test \
--bootstrap-pip-spec $BOOTSTRAP_PIP_SPEC \
--installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \
plugins test_simplest_plugin.py \
<< parameters.upgrade >>
bootstrap_checks:
parameters:
steps:
- run:
name: Run bootstrap checks
command: |
py.test integration-tests/test_bootstrap.py -s
jobs:
integration-test:
docker:
- image: docker:18.05.0-ce-git

steps:
- run:
name: setup python3
command: |
apk add --no-cache python3 pytest
- checkout

- setup_remote_docker

- build_systemd_image

- bootstrap_checks

- basic_tests

- admin_tests

- plugin_tests

upgrade-test:
docker:
- 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
- run:
name: setup python3
command: |
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"

workflows:
version: 2
all-tests:
jobs:
- integration-test
- upgrade-test
38 changes: 38 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
Expand Down Expand Up @@ -56,10 +57,22 @@ jobs:
# ubuntu_version: "21.10"
# python_version: "3.9"

=======
on:
pull_request:
push:
workflow_dispatch:

jobs:
unit-test:
runs-on: ubuntu-18.04
container: ubuntu:18.04
>>>>>>> 4773bac... updated tljh/conda.py, tljh/installer.py, and tljh/traefik.py to automatically select arm64 or amd64 binaries for traefik and to use miniforge instead of miniconda for cond
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
<<<<<<< HEAD
python-version: ${{ matrix.python_version }}

- name: Install venv, git and setup venv
Expand Down Expand Up @@ -106,3 +119,28 @@ jobs:

- name: Upload code coverage stats
run: codecov
=======
python-version: 3.6
- name: Install and setup venv
run: |
apt-get update --yes && apt-get install --yes python3-venv
python3 -m venv /srv/venv
echo '/srv/venv/bin' >> $GITHUB_PATH
- name: Cache pip deps
uses: actions/cache@v2
with:
path: /srv/venv/
key: ${{ runner.os }}-pip-dependencies-${{ hashFiles('*setup.py', '*dev-requirements.txt') }}
- name: Install Python dependencies
run: |
python3 -m pip install -U pip==20.0.*
python3 -m pip install -r dev-requirements.txt
python3 -m pip install -e .
pip freeze
- name: Run unit tests
run: |
pytest --cov=tljh tests/
- name: Upload code coverage stats
run: |
codecov
>>>>>>> 4773bac... updated tljh/conda.py, tljh/installer.py, and tljh/traefik.py to automatically select arm64 or amd64 binaries for traefik and to use miniforge instead of miniconda for cond
9 changes: 8 additions & 1 deletion bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def serve_forever(server):
tljh_install_cmd.append(
os.environ.get(
'TLJH_BOOTSTRAP_PIP_SPEC',
'git+https://github.com/jupyterhub/the-littlest-jupyterhub.git'
'git+ssh://git@github.com/cdibble/the-littlest-jupyterhub.git@mambaforge_arm'
)
)
if initial_setup:
Expand All @@ -357,6 +357,13 @@ def serve_forever(server):
logger.info('Upgrading TLJH installer...')
run_subprocess(tljh_install_cmd)

pip_flags = ['--upgrade']
if os.environ.get('TLJH_BOOTSTRAP_DEV', 'no') == 'yes':
pip_flags.append('--editable')
tljh_repo_path = os.environ.get(
'TLJH_BOOTSTRAP_PIP_SPEC',
'git+https://github.com/jupyterhub/the-littlest-jupyterhub.git'
)

# Run TLJH installer
logger.info('Running TLJH installer...')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name='the-littlest-jupyterhub',
version='0.1',
description='A small JupyterHub distribution',
url='https://github.com/jupyterhub/the-littlest-jupyterhub',
url='https://github.com/cdibble/the-littlest-jupyterhub',
author='Jupyter Development Team',
author_email='jupyter@googlegroups.com',
license='3 Clause BSD',
Expand Down
7 changes: 5 additions & 2 deletions tests/test_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def prefix():
Provide a temporary directory with a miniforge conda environment
"""
mambaforge_version = '4.10.3-7'
installer_sha256 = "fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-x86_64.sh".format(v=mambaforge_version)
if os.uname().machine == 'aarch64':
installer_sha256 = "ac95f137b287b3408e4f67f07a284357b1119ee157373b788b34e770ef2392b2"
elif os.uname().machine == 'x86_64':
installer_sha256 = "fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-{arch}.sh".format(v=mambaforge_new_version, arch=os.uname().machine)
with tempfile.TemporaryDirectory() as tmpdir:
with conda.download_miniconda_installer(installer_url, installer_sha256) as installer_path:
conda.install_miniconda(installer_path, tmpdir)
Expand Down
5 changes: 3 additions & 2 deletions tljh/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def ensure_user_environment(user_requirements_txt_file):
# Keep these in sync with tests/test_conda.py::prefix
mambaforge_conda_new_version = '4.10.3'
mambaforge_mamba_version = '0.16.0'

if conda.check_miniconda_version(USER_ENV_PREFIX, mambaforge_conda_new_version):
conda_version = '4.10.3'
elif conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version):
Expand All @@ -199,6 +199,7 @@ def ensure_user_environment(user_requirements_txt_file):
logger.info('Downloading & setting up user environment...')
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-{arch}.sh".format(v=mambaforge_new_version, arch=os.uname().machine)
with conda.download_miniconda_installer(installer_url, installer_sha256) as installer_path:
logging.info(installer_path)
conda.install_miniconda(installer_path, USER_ENV_PREFIX)
conda_version = '4.10.3'

Expand Down Expand Up @@ -256,7 +257,7 @@ def ensure_admins(admin_password_list):
yaml.dump(config, f)


def ensure_jupyterhub_running(times=20):
def ensure_jupyterhub_running(times=50):
"""
Ensure that JupyterHub is up and running
Expand Down
2 changes: 1 addition & 1 deletion tljh/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ def get_plugin_manager():
pm = pluggy.PluginManager('tljh')
pm.add_hookspecs(hooks)
pm.load_setuptools_entrypoints('tljh')

return pm

0 comments on commit ce02f25

Please sign in to comment.