Skip to content

Commit

Permalink
Update CI for 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
knkski committed Oct 27, 2021
1 parent 7bb4518 commit 0e8cafe
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 257 deletions.
217 changes: 95 additions & 122 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,138 +5,111 @@ on:
- pull_request

jobs:
unit-test:
unit:
name: Unit Test
runs-on: ubuntu-latest
strategy:
matrix:
charm: [controller, ui]

steps:
- uses: actions/checkout@v2
- run: sudo apt update
- run: sudo apt install tox
- run: tox -e ${{ matrix.charm }}
- run: tox -e ${{ matrix.charm }}-unit

deploy:
name: Test
lint:
name: Lint Code
runs-on: ubuntu-latest
strategy:
matrix:
charm: [controller, ui]
steps:
- uses: actions/checkout@v2
- run: sudo apt update
- run: sudo apt install tox
- run: tox -e ${{ matrix.charm }}-lint

integration:
name: Integration
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2

- uses: balchua/[email protected]
with:
channel: '1.20/stable'
addons: '["dns", "storage", "rbac", "metallb:10.64.140.43-10.64.140.49"]'

- name: Install dependencies
run: |
set -eux
sudo pip3 install charmcraft==1.0.0
sudo snap install charm --classic
sudo snap install juju --classic
sudo snap install juju-helpers --classic
sudo snap install juju-wait --classic
sudo apt update
sudo apt install -y firefox-geckodriver
sudo pip3 install -r test-requirements.txt
- name: Bootstrap
run: |
set -eux
sg microk8s -c 'juju bootstrap microk8s uk8s'
juju add-model kubeflow
- name: Deploy charm dependencies
timeout-minutes: 15
run: |
set -eux
juju model-config update-status-hook-interval=15s
juju deploy cs:istio
juju config istio-pilot default-gateway=kubeflow-gateway
sleep 10
kubectl patch role -n kubeflow istio-ingressgateway-operator -p '{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"name":"istio-ingressgateway-operator"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}'
juju wait -wvt 300
juju model-config update-status-hook-interval=5m
# Manually create PodDefaults CRD due to
# https://github.com/canonical/admission-webhook-operator/issues/5
kubectl apply -f https://raw.githubusercontent.com/canonical/admission-webhook-operator/master/src/crds.yaml
# juju deploy cs:admission-webhook
juju deploy cs:kubeflow-dashboard --config profile=kubeflow-user
juju deploy cs:kubeflow-profiles
juju relate kubeflow-dashboard kubeflow-profiles
# https://bugs.launchpad.net/juju/+bug/1921739
(i=600; while ! juju wait -wvt 30 ; do ((--i)) || exit; sleep 1; done)
- name: Deploy Jupyter
run: |
set -eux
juju bundle deploy --build
juju relate istio-pilot jupyter-ui
juju wait -wvt 300
- name: Test Jupyter
run: pytest -vvs tests/

- run: kubectl get all -A
if: failure()

- run: kubectl get notebooks -A
if: failure()

- run: kubectl get pods -A -oyaml
if: failure()

- run: juju status
if: failure()

- name: Get jupyter-controller workload logs
run: kubectl logs --tail 100 -nkubeflow -ljuju-app=jupyter-controller
if: failure()

- name: Get jupyter-controller operator logs
run: kubectl logs --tail 100 -nkubeflow -ljuju-operator=jupyter-controller
if: failure()

- name: Get jupyter-ui workload logs
run: kubectl logs --tail 100 -nkubeflow -ljuju-app=jupyter-ui
if: failure()

- name: Get jupyter-ui operator logs
run: kubectl logs --tail 100 -nkubeflow -ljuju-operator=jupyter-ui
if: failure()

- name: Generate inspect tarball
run: >
sg microk8s <<EOF
microk8s inspect | \
grep -Po "Report tarball is at \K.+" | \
xargs -I {} cp {} inspection-report-${{ strategy.job-index }}.tar.gz
EOF
if: failure()

- name: Upload inspect tarball
uses: actions/upload-artifact@v2
with:
name: inspection-reports
path: ./inspection-report-${{ strategy.job-index }}.tar.gz
if: failure()

- name: Upload selenium screenshots
uses: actions/upload-artifact@v2
with:
name: selenium-screenshots
path: /tmp/selenium-*.png
if: failure()

- name: Upload HAR logs
uses: actions/upload-artifact@v2
with:
name: selenium-har
path: /tmp/selenium-*.har
if: failure()
- name: Check out code
uses: actions/checkout@v2
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.21/stable

# TODO: Remove once the actions-operator does this automatically
- name: Configure kubectl
run: |
sg microk8s -c "microk8s config > ~/.kube/config"
- name: Run test
run: |
sg microk8s -c "microk8s enable ingress metallb:10.64.140.43-10.64.140.49"
sudo apt install -y firefox-geckodriver
sudo snap install juju-bundle --classic
sudo snap install juju-wait --classic
sudo snap refresh charmcraft --channel=latest/candidate
juju add-model kubeflow
sg microk8s -c "tox -e integration -- --model kubeflow"
- run: kubectl get all -A
if: failure()

- run: kubectl get notebooks -A
if: failure()

- run: kubectl get pods -A -oyaml
if: failure()

- run: juju status
if: failure()

- name: Get jupyter-controller workload logs
run: kubectl logs --tail 100 -nkubeflow -lapp.kubernetes.io/name=jupyter-controller
if: failure()

- name: Get jupyter-controller operator logs
run: kubectl logs --tail 100 -nkubeflow -loperator.juju.is/name=jupyter-controller
if: failure()

- name: Get jupyter-ui workload logs
run: kubectl logs --tail 100 -nkubeflow -lapp.kubernetes.io/name=jupyter-ui
if: failure()

- name: Get jupyter-ui operator logs
run: kubectl logs --tail 100 -nkubeflow -loperator.juju.is/name=jupyter-ui
if: failure()

- name: Generate inspect tarball
run: >
sg microk8s <<EOF
microk8s inspect | \
grep -Po "Report tarball is at \K.+" | \
xargs -I {} cp {} inspection-report-${{ strategy.job-index }}.tar.gz
EOF
if: failure()

- name: Upload inspect tarball
uses: actions/upload-artifact@v2
with:
name: inspection-reports
path: ./inspection-report-${{ strategy.job-index }}.tar.gz
if: failure()

- name: Upload selenium screenshots
uses: actions/upload-artifact@v2
with:
name: selenium-screenshots
path: /tmp/selenium-*.png
if: failure()

- name: Upload HAR logs
uses: actions/upload-artifact@v2
with:
name: selenium-har
path: /tmp/selenium-*.har
if: failure()
36 changes: 34 additions & 2 deletions bundle.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
bundle: kubernetes
applications:
jupyter-controller: { charm: cs:jupyter-controller, scale: 1 }
jupyter-ui: { charm: cs:jupyter-ui, scale: 1 }
jupyter-controller:
charm: cs:jupyter-controller
scale: 1
jupyter-ui:
charm: cs:jupyter-ui
scale: 1
kubeflow-profiles:
charm: cs:kubeflow-profiles-52
scale: 1
kubeflow-dashboard:
charm: cs:kubeflow-dashboard-56
scale: 1
istio-pilot:
charm: ch:istio-pilot
channel: latest/stable
scale: 1
trust: true
options:
default-gateways: kubeflow-gateway
istio-ingressgateway-operator:
charm: ch:istio-gateway
channel: latest/stable
scale: 1
trust: true
options:
kind: ingress
admission-webhook:
charm: ch:admission-webhook
channel: latest/stable
scale: 1
relations:
- [istio-pilot:istio-pilot, istio-ingressgateway-operator:istio-pilot]
- [istio-pilot, jupyter-ui]
- [kubeflow-profiles, kubeflow-dashboard]
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
line-length = 100
target-version = ['py37']
skip-string-normalization = true

[tool.isort]
profile = "black"
13 changes: 7 additions & 6 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
charmcraft==0.8.0
pytest==6.2.2
pyyaml==5.3.1
selenium==3.141.0
flake8
black==20.8b1
selenium-wire==4.3.1
flake8<4.1
juju<2.10
pytest-operator<0.10
pytest<6.3
pyyaml<6.1
selenium-wire<4.6
selenium==3.141.0
Loading

0 comments on commit 0e8cafe

Please sign in to comment.