Skip to content

Commit 8169d0c

Browse files
authored
chore: update visualization-server version and tox.ini file (#57)
Follow up to #53 - update version according to canonical/bundle-kubeflow#747 - refactor tox.ini according to canonical/oidc-authservice-rock#14 and canonical/bundle-kubeflow#763 - placeholder sanity tests due to #59 and integration due to #61 Refs #44
1 parent e037d33 commit 8169d0c

File tree

2 files changed

+42
-35
lines changed

2 files changed

+42
-35
lines changed

visualisation-server/rockcraft.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Dockerfile: https://github.com/kubeflow/pipelines/blob/2.0.3/backend/Dockerfile.visualization
22
name: ml-pipeline-visualization-server
33
base: ubuntu@20.04
4-
version: '2.0.3-20.04-1'
4+
version: '2.0.3'
55
summary: ml-pipeline/visualization-server
66
description: |
77
ml-pipeline/visualization-server

visualisation-server/tox.ini

+41-34
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[tox]
44
skipsdist = True
55
skip_missing_interpreters = True
6+
envlist = unit, sanity, integration
67

78
[testenv]
89
setenv =
@@ -12,57 +13,63 @@ setenv =
1213
CHARM_BRANCH=main
1314
LOCAL_CHARM_DIR=charm_repo
1415

15-
[testenv:unit]
16+
[testenv:pack]
1617
passenv = *
1718
allowlist_externals =
18-
bash
19-
tox
2019
rockcraft
21-
deps =
22-
juju~=2.9.0
23-
pytest
24-
pytest-operator
25-
ops
2620
commands =
27-
# build and pack rock
2821
rockcraft pack
22+
23+
[testenv:export-to-docker]
24+
passenv = *
25+
allowlist_externals =
26+
bash
27+
skopeo
28+
yq
29+
commands =
30+
# pack rock and export to docker
2931
bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \
3032
VERSION=$(yq eval .version rockcraft.yaml) && \
31-
ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " '\''{ print $2 }'\'') && \
32-
ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \
33-
sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \
34-
docker save $ROCK > $ROCK.tar'
35-
# run rock tests
36-
pytest -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests
33+
ARCH=$(yq eval ".platforms | keys | .[0]" rockcraft.yaml) && \
34+
ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}.rock" && \
35+
DOCKER_IMAGE=$NAME:$VERSION && \\
36+
echo "Exporting $ROCK to docker as $DOCKER_IMAGE" && \
37+
skopeo --insecure-policy copy oci-archive:$ROCK docker-daemon:$DOCKER_IMAGE'
38+
39+
[testenv:sanity]
40+
passenv = *
41+
allowlist_externals =
42+
echo
43+
commands =
44+
# TODO: Implement sanity tests
45+
echo "WARNING: This is a placeholder test - no test is implemented here."
3746

3847
[testenv:integration]
3948
passenv = *
4049
allowlist_externals =
50+
echo
4151
bash
4252
git
4353
rm
4454
tox
45-
rockcraft
4655
deps =
47-
juju~=2.9.0
56+
juju<4.0
4857
pytest
4958
pytest-operator
5059
ops
5160
commands =
52-
# build and pack rock
53-
rockcraft pack
54-
# clone related charm
55-
rm -rf {env:LOCAL_CHARM_DIR}
56-
git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR}
57-
# upload rock to docker and microk8s cache, replace charm's container with local rock reference
58-
bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \
59-
VERSION=$(yq eval .version rockcraft.yaml) && \
60-
ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " '\''{ print $2 }'\'') && \
61-
ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \
62-
sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \
63-
docker save $ROCK > $ROCK.tar && \
64-
microk8s ctr image import $ROCK.tar && \
65-
yq e -i ".resources.oci-image.upstream-source=\"$ROCK:$VERSION\"" {env:LOCAL_CHARM_DIR}/charms/kfp-viz/metadata.yaml'
66-
# run charm integration test with rock
67-
tox -c {env:LOCAL_CHARM_DIR} -e integration
68-
61+
echo "WARNING: This is a placeholder test - no test is implemented here."
62+
# Below is commented out due to https://github.com/canonical/pipelines-rocks/issues/61
63+
# we should remove above line and uncomment the below, once this is fixed.
64+
; # clone related charm
65+
; rm -rf {env:LOCAL_CHARM_DIR}
66+
; git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR}
67+
; # upload rock to docker and microk8s cache, replace charm's container with local rock reference
68+
; bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \
69+
; VERSION=$(yq eval .version rockcraft.yaml) && \
70+
; DOCKER_IMAGE=$NAME:$VERSION && \
71+
; docker save $DOCKER_IMAGE > $DOCKER_IMAGE.tar && \
72+
; sudo microk8s ctr image import $DOCKER_IMAGE.tar --digests=true && \
73+
; yq e -i ".resources.oci-image.upstream-source=\"$DOCKER_IMAGE\"" {env:LOCAL_CHARM_DIR}/charms/kfp-viz/metadata.yaml'
74+
; # run bundle integration tests with rock
75+
; tox -c {env:LOCAL_CHARM_DIR} -e bundle-integration-v2 -- --model kubeflow

0 commit comments

Comments
 (0)