From f87869b8462be4bebe18b3eb9adf2c63392eaf1f Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Mon, 22 Jan 2024 12:38:05 +0100 Subject: [PATCH] CH-110 jupyterhub update OK; add tests --- .../deploy/resources/hub/jupyterhub_config.py | 6 ++-- .../jupyterhub/deploy/values-test.yaml | 7 +++++ applications/jupyterhub/deploy/values.yaml | 6 ++++ .../harness_jupyter/jupyterhub.py | 2 +- applications/samples/deploy/values-test.yaml | 8 +++++ deployment/codefresh-test.yaml | 30 +++++++++++++++++++ 6 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 applications/jupyterhub/deploy/values-test.yaml diff --git a/applications/jupyterhub/deploy/resources/hub/jupyterhub_config.py b/applications/jupyterhub/deploy/resources/hub/jupyterhub_config.py index 5ebe20b5..8fdfa8c1 100755 --- a/applications/jupyterhub/deploy/resources/hub/jupyterhub_config.py +++ b/applications/jupyterhub/deploy/resources/hub/jupyterhub_config.py @@ -12,8 +12,6 @@ #CLOUDHARNESS: EDIT START import logging -from kubernetes import client -from jupyterhub.utils import url_path_join try: from harness_jupyter.jupyterhub import harness_hub @@ -492,6 +490,7 @@ def camelCaseify(s): cfg.pop("keys", None) c[app].update(cfg) + # load /usr/local/etc/jupyterhub/jupyterhub_config.d config files config_dir = "/usr/local/etc/jupyterhub/jupyterhub_config.d" if os.path.isdir(config_dir): @@ -560,4 +559,5 @@ def camelCaseify(s): c.registry = get_config('registry') c.domain = get_config('root.domain') c.namespace = get_config('root.namespace') -# CLOUDHARNESS: EDIT END \ No newline at end of file +# CLOUDHARNESS: EDIT END + \ No newline at end of file diff --git a/applications/jupyterhub/deploy/values-test.yaml b/applications/jupyterhub/deploy/values-test.yaml new file mode 100644 index 00000000..3ca312d3 --- /dev/null +++ b/applications/jupyterhub/deploy/values-test.yaml @@ -0,0 +1,7 @@ +harness: + accounts: + users: + - username: samplehub@testuser.com + realmRoles: + - offline_access + diff --git a/applications/jupyterhub/deploy/values.yaml b/applications/jupyterhub/deploy/values.yaml index 41e108d6..b871b33b 100755 --- a/applications/jupyterhub/deploy/values.yaml +++ b/applications/jupyterhub/deploy/values.yaml @@ -25,6 +25,12 @@ harness: # EDIT: CLOUDHARNESS quota-ws-maxmem: 0.5 # sets the storage dedicated to the user data in Gb units (float) quota-storage-max: 1.25 + test: + e2e: + enabled: true + smoketest: true + ignoreRequestErrors: false + ignoreConsoleErrors: false # fullnameOverride and nameOverride distinguishes blank strings, null values, # and non-blank strings. For more details, see the configuration reference. diff --git a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py index 220883a8..fc4d0dd0 100644 --- a/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py +++ b/applications/jupyterhub/src/harness_jupyter/harness_jupyter/jupyterhub.py @@ -139,7 +139,7 @@ def change_pod_manifest(self: KubeSpawner): if 'subdomain' in harness and harness['subdomain'] == subdomain: ws_image = getattr(self, "ws_image", None) - logging.info("Subdomain is", subdomain) + logging.info("Subdomain is %s", subdomain) if ws_image: # try getting the image + tag from values.yaml ch_conf = conf.get_configuration() diff --git a/applications/samples/deploy/values-test.yaml b/applications/samples/deploy/values-test.yaml index 3555108f..14274fd6 100644 --- a/applications/samples/deploy/values-test.yaml +++ b/applications/samples/deploy/values-test.yaml @@ -1,4 +1,12 @@ harness: + dependencies: + soft: + - workflows + - events + - accounts + - common + - nfsserver + - jupyterhub accounts: roles: - role1 diff --git a/deployment/codefresh-test.yaml b/deployment/codefresh-test.yaml index ff7a88af..7280c8e6 100644 --- a/deployment/codefresh-test.yaml +++ b/deployment/codefresh-test.yaml @@ -165,6 +165,28 @@ steps: == true forceNoCache: includes('${{ACCOUNTS_TAG_FORCE_BUILD}}', '{{ACCOUNTS_TAG_FORCE_BUILD}}') == false + jupyterhub: + type: build + stage: build + dockerfile: Dockerfile + registry: '${{CODEFRESH_REGISTRY}}' + buildkit: true + build_arguments: + - DOMAIN=${{DOMAIN}} + - NOCACHE=${{CF_BUILD_ID}} + - REGISTRY=${{REGISTRY}}/cloudharness/ + - CLOUDHARNESS_BASE=${{REGISTRY}}/cloudharness/cloudharness-base:${{CLOUDHARNESS_BASE_TAG}} + image_name: cloudharness/jupyterhub + title: Jupyterhub + working_directory: ./applications/jupyterhub + tag: '${{JUPYTERHUB_TAG}}' + when: + condition: + any: + buildDoesNotExist: includes('${{JUPYTERHUB_TAG_EXISTS}}', '{{JUPYTERHUB_TAG_EXISTS}}') + == true + forceNoCache: includes('${{JUPYTERHUB_TAG_FORCE_BUILD}}', '{{JUPYTERHUB_TAG_FORCE_BUILD}}') + == false samples: type: build stage: build @@ -510,6 +532,14 @@ steps: commands: - yarn test scale: + jupyterhub_e2e_test: + title: jupyterhub e2e test + volumes: + - '${{CF_REPO_NAME}}/applications/jupyterhub/test/e2e:/home/test/__tests__/jupyterhub' + environment: + - APP_URL=https://hub.${{DOMAIN}} + - USERNAME=samplehub@testuser.com + - PASSWORD=test samples_e2e_test: title: samples e2e test volumes: