Skip to content

Commit

Permalink
Nebari Typer CLI (#1443)
Browse files Browse the repository at this point in the history
* Initial typer CLI implmentation

* edit logic

* Nebari cli: Add files _init.py and main.py (#1423)

* Nebari cli: Add files _init.py and main.py

* run pre-commit

Co-authored-by: iameskild <eskild@doublee.io>

* Order CLI commands

* Nebari typer cli commands (#1432)

* Nebari typer cli commands

* add validate command

* Change validate command

* add precommit

* Nebari Render Command (#1433)

* Nebari Render Command

* add render_template

* Add dry-run

* Updates to init

* More work on init

* Nebari deploy and destroy commands (#1436)

* Nebari deploy and destroy commands

* Add typer confirm to destroy command

* Run pre-commit

Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>
Co-authored-by: iameskild <eskild@doublee.io>

* Add guided-init

* Add deploy flags and change repository default value (#1441)

* Nebari deploy and destroy commands

* Add typer confirm to destroy command

* Add deploy arguments and change repository default value

* Add rendre design

* Run pre-commit

Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>
Co-authored-by: iameskild <eskild@doublee.io>

* Nebari Typer CLI

* Add pre-commit

* Add disable_checks in deploy command

* Combine guided-init and init, part 1

* Remove `dotenv` work. (#1472)

* Remove Usage: dotenv [OPTIONS] COMMAND [ARGS]
* Remove pathlib

* guided-init clean up

* Added `support`, `cost`, `upgrade` and `keycloak` commands. (#1468)

* Add , ,  and  commands.

* Add pre-commit

* Add pre-commit

* Add pre-commit

* Add rich print

* Change do_keycloak function

* Create two keycloak subcommands

Co-authored-by: iameskild <eskild@doublee.io>
Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>

* clean up

* update help messages

* Update qhub/cli/_init.py

Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>

* Update qhub/cli/_init.py

Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>

* Changes from review, part 1

* Update qhub/cli/_init.py

Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>

* Update qhub/cli/_init.py

Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>

* Update qhub/cli/_init.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/_init.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/_init.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/_init.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/_init.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/main.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Changes from review, part 2

* Update env, clean up

* Changes from review, part 3

* Minor update

* Changes based review, part 4

* more clean up

* Add `version` options to Nebari CLI (#1476)

* Add version Options to Nebari

* Add pre-commit

Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>

* Change colour from blue1 to green and spring_green to blue

* Add suggested changes, Remove extra spaces

* Add pre-commit

* change kubernetes msg

* Update CI to use new nebari cli entrypoint (#1480)

* Update CI to use new nebari cli entrypoint

* Add --disable-prompt to nebari init

* Update name of keycloak subcommands

* Reorder command

* Update command

* Minor update to test_e2e

* Update hostname used for test_deployment

* Another minor update to the tests_e2e

* Add --disable-prompt to nebari destroy

* use --disable-prompt in ci test

* Update .github/workflows/kubernetes_test.yaml

Co-authored-by: Vinicius D. Cerutti <51954708+viniciusdc@users.noreply.github.com>

* Update kubernetes_test.yaml

* Update .github/workflows/kubernetes_test.yaml

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Update qhub/cli/main.py

Co-authored-by: Tania Allard <taniar.allard@gmail.com>

* Fix yaml

* Fix yaml again

Co-authored-by: Vinicius D. Cerutti <51954708+viniciusdc@users.noreply.github.com>
Co-authored-by: Tania Allard <taniar.allard@gmail.com>

Co-authored-by: iameskild <eskild@doublee.io>
Co-authored-by: eskild <42120229+iameskild@users.noreply.github.com>
Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>
Co-authored-by: Tania Allard <taniar.allard@gmail.com>
Co-authored-by: Vinicius D. Cerutti <51954708+viniciusdc@users.noreply.github.com>
  • Loading branch information
6 people authored Oct 7, 2022
1 parent 9606f04 commit 440a75d
Show file tree
Hide file tree
Showing 18 changed files with 1,253 additions and 104 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/kubernetes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ jobs:
with:
python-version: 3.8
miniconda-version: "latest"
- name: Install QHub
- name: Install Nebari
run: |
conda install -c anaconda pip
pip install .[dev]
- name: Download and Install Kind and Kubectl
- name: Download and Install Kubectl
run: |
mkdir -p bin
pushd bin
Expand All @@ -73,32 +73,32 @@ jobs:
ip route
- name: Add DNS entry to hosts
run: |
sudo echo "172.18.1.100 github-actions.qhub.dev" | sudo tee -a /etc/hosts
- name: Initialize QHub Cloud
sudo echo "172.18.1.100 github-actions.nebari.dev" | sudo tee -a /etc/hosts
- name: Initialize Nebari Cloud
run: |
mkdir -p local-deployment
cd local-deployment
qhub init local --project=thisisatest --domain github-actions.qhub.dev --auth-provider=password
nebari init local --project=thisisatest --domain github-actions.nebari.dev --auth-provider=password
# Need smaller profiles on Local Kind
sed -i -E 's/(cpu_guarantee):\s+[0-9\.]+/\1: 0.25/g' "qhub-config.yaml"
sed -i -E 's/(mem_guarantee):\s+[A-Za-z0-9\.]+/\1: 0.25G/g' "qhub-config.yaml"
sed -i -E 's/(cpu_guarantee):\s+[0-9\.]+/\1: 0.25/g' "nebari-config.yaml"
sed -i -E 's/(mem_guarantee):\s+[A-Za-z0-9\.]+/\1: 0.25G/g' "nebari-config.yaml"
cat qhub-config.yaml
- name: Deploy QHub Cloud
cat nebari-config.yaml
- name: Deploy Nebari
run: |
cd local-deployment
qhub deploy --config qhub-config.yaml --disable-prompt
nebari deploy --config nebari-config.yaml --disable-prompt
- name: Basic kubectl checks after deployment
if: always()
run: |
kubectl get all,cm,secret,ing -A
- name: Check github-actions.qhub.dev resolves
- name: Check github-actions.nebari.dev resolves
run: |
nslookup github-actions.qhub.dev
nslookup github-actions.nebari.dev
- name: Curl jupyterhub login page
run: |
curl -k https://github-actions.qhub.dev/hub/home -i
curl -k https://github-actions.nebari.dev/hub/home -i
### CYPRESS TESTS
- name: Setup Node
Expand All @@ -113,8 +113,8 @@ jobs:
sudo apt-get -y update
sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: Get qhub-config.yaml full path
run: echo "QHUB_CONFIG_PATH=`realpath ./local-deployment/qhub-config.yaml`" >> "$GITHUB_ENV"
- name: Get nebari-config.yaml full path
run: echo "NEBARI_CONFIG_PATH=`realpath ./local-deployment/nebari-config.yaml`" >> "$GITHUB_ENV"

- name: Create example-user
run: |
Expand All @@ -124,13 +124,13 @@ jobs:
echo "CYPRESS_EXAMPLE_USER_NAME=${CYPRESS_EXAMPLE_USER_NAME}" >> $GITHUB_ENV
echo "CYPRESS_EXAMPLE_USER_PASSWORD=${CYPRESS_EXAMPLE_USER_PASSWORD}" >> $GITHUB_ENV
qhub keycloak --config "${QHUB_CONFIG_PATH}" adduser "${CYPRESS_EXAMPLE_USER_NAME}" "${CYPRESS_EXAMPLE_USER_PASSWORD}"
qhub keycloak --config "${QHUB_CONFIG_PATH}" listusers
nebari keycloak adduser --user "${CYPRESS_EXAMPLE_USER_NAME}" "${CYPRESS_EXAMPLE_USER_PASSWORD}" --config "${NEBARI_CONFIG_PATH}"
nebari keycloak listusers --config "${NEBARI_CONFIG_PATH}"
- name: Cypress run
uses: cypress-io/github-action@v2
env:
CYPRESS_BASE_URL: https://github-actions.qhub.dev/
CYPRESS_BASE_URL: https://github-actions.nebari.dev/
with:
working-directory: tests_e2e

Expand All @@ -155,15 +155,15 @@ jobs:
run: |
export JUPYTERHUB_USERNAME=${CYPRESS_EXAMPLE_USER_NAME}
export JUPYTERHUB_PASSWORD=${CYPRESS_EXAMPLE_USER_PASSWORD}
jhubctl --verbose run --hub=https://github-actions.qhub.dev \
jhubctl --verbose run --hub=https://github-actions.nebari.dev \
--auth-type=keycloak \
--validate --no-verify-ssl \
--kernel python3 \
--stop-server \
--notebook tests_deployment/assets/notebook/simple.ipynb \
### CLEANUP AFTER TESTS
- name: Cleanup qhub deployment
- name: Cleanup nebari deployment
run: |
cd local-deployment
qhub destroy --config qhub-config.yaml
nebari destroy --config nebari-config.yaml --disable-prompt
24 changes: 12 additions & 12 deletions .github/workflows/test-provider.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test QHub Provider"
name: "Test Nebari Provider"

on:
pull_request:
Expand Down Expand Up @@ -36,7 +36,7 @@ env:

jobs:
test-render-providers:
name: 'Test QHub Provider'
name: 'Test Nebari Provider'
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -75,19 +75,19 @@ jobs:
- name: Use az CLI
if: ${{ matrix.provider == 'azure' }}
run: az version
- name: Install QHub
- name: Install Nebari
run: |
pip install .[dev]
- name: QHub Initialize
- name: Nebari Initialize
run: |
qhub init "${{ matrix.provider }}" --project "TestProvider" --domain "${{ matrix.provider }}.qhub.dev" --auth-provider github --disable-prompt --ci-provider ${{ matrix.cicd }}
cat "qhub-config.yaml"
- name: QHub Render
nebari init "${{ matrix.provider }}" --project "TestProvider" --domain "${{ matrix.provider }}.nebari.dev" --auth-provider github --disable-prompt --ci-provider ${{ matrix.cicd }}
cat "nebari-config.yaml"
- name: Nebari Render
run: |
qhub render -c "qhub-config.yaml" -o "qhub-${{ matrix.provider }}-${{ matrix.cicd }}-deployment"
cp "qhub-config.yaml" "qhub-${{ matrix.provider }}-${{ matrix.cicd }}-deployment/qhub-config.yaml"
- name: QHub Render Artifact
nebari render -c "nebari-config.yaml" -o "nebari-${{ matrix.provider }}-${{ matrix.cicd }}-deployment"
cp "nebari-config.yaml" "nebari-${{ matrix.provider }}-${{ matrix.cicd }}-deployment/nebari-config.yaml"
- name: Nebari Render Artifact
uses: actions/upload-artifact@master
with:
name: "qhub-${{ matrix.provider }}-${{ matrix.cicd }}-artifact"
path: "qhub-${{ matrix.provider }}-${{ matrix.cicd }}-deployment"
name: "nebari-${{ matrix.provider }}-${{ matrix.cicd }}-artifact"
path: "nebari-${{ matrix.provider }}-${{ matrix.cicd }}-deployment"
4 changes: 4 additions & 0 deletions environment-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ dependencies:
- bcrypt
- python-kubernetes
- rich
- typer
- pip
- pip:
- questionary
# dev dependencies
- flake8 ==3.8.4
- black ==22.3.0
Expand Down
Loading

0 comments on commit 440a75d

Please sign in to comment.