From 39e590452ba7c0141ba2ed07b92a2fca70389182 Mon Sep 17 00:00:00 2001 From: Artem Yevsiukov Date: Sun, 20 Oct 2024 22:47:55 +0300 Subject: [PATCH] Updated --- pvcviewer-controller/rockcraft.yaml | 19 ++++++++++++++----- pvcviewer-controller/tests/test_rock.py | 2 +- pvcviewer-controller/tox.ini | 18 +++++++++--------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/pvcviewer-controller/rockcraft.yaml b/pvcviewer-controller/rockcraft.yaml index e3b649c..6c199f2 100644 --- a/pvcviewer-controller/rockcraft.yaml +++ b/pvcviewer-controller/rockcraft.yaml @@ -13,8 +13,8 @@ platforms: services: pvcviewer-controller: - override: merge - command: "pvc-viewer" + command: /manager + override: replace startup: enabled user: ubuntu @@ -23,16 +23,25 @@ parts: plugin: nil override-build: | mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks - (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query + (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && \ + dpkg-query --root=${CRAFT_PROJECT_DIR}/../bundles/ubuntu-22.04/rootfs/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) \ + > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query pvcviewer-controller: plugin: go build-snaps: - - go/1.21/stable + - go/1.22/stable source: https://github.com/kubeflow/kubeflow.git - source-tag: v1.9.0 source-depth: 1 + source-tag: v1.9.0 + build-environment: + - CGO_ENABLED: "0" + - GOOS: "linux" source-subdir: components/pvcviewer-controller + override-build: | + cd $CRAFT_PART_SRC_WORK + go mod download + go build -a -o $CRAFT_PART_INSTALL/manager main.go non-root-user: plugin: nil diff --git a/pvcviewer-controller/tests/test_rock.py b/pvcviewer-controller/tests/test_rock.py index f5c0bd0..2eccf98 100644 --- a/pvcviewer-controller/tests/test_rock.py +++ b/pvcviewer-controller/tests/test_rock.py @@ -49,7 +49,7 @@ def test_rock(rock_test_env): "exec", "ls", "-la", - "/bin/pvc-viewer", + "/manager", ], check=True, ) diff --git a/pvcviewer-controller/tox.ini b/pvcviewer-controller/tox.ini index 1055ca6..5866c2b 100644 --- a/pvcviewer-controller/tox.ini +++ b/pvcviewer-controller/tox.ini @@ -24,14 +24,14 @@ allowlist_externals = skopeo yq commands = - # export rock to docker +# export rock to docker bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \ - VERSION=$(yq eval .version rockcraft.yaml) && \ - ARCH=$(yq eval ".platforms | keys | .[0]" rockcraft.yaml) && \ - ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}.rock" && \ - DOCKER_IMAGE=$NAME:$VERSION && \ - echo "Exporting $ROCK to docker as $DOCKER_IMAGE" && \ - skopeo --insecure-policy copy oci-archive:$ROCK docker-daemon:$DOCKER_IMAGE' + VERSION=$(yq eval .version rockcraft.yaml) && \ + ARCH=$(yq eval ".platforms | keys | .[0]" rockcraft.yaml) && \ + ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}.rock" && \ + DOCKER_IMAGE=$NAME:$VERSION && \ + echo "Exporting $ROCK to docker as $DOCKER_IMAGE" && \ + skopeo --insecure-policy copy oci-archive:$ROCK docker-daemon:$DOCKER_IMAGE' [testenv:sanity] passenv = * @@ -39,7 +39,7 @@ deps = pytest charmed-kubeflow-chisme commands = - # run rock tests +# run rock tests pytest -s -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests [testenv:integration] @@ -47,5 +47,5 @@ passenv = * allowlist_externals = echo commands = - # TODO: Implement integration tests here +# TODO: Implement integration tests here echo "WARNING: This is a placeholder test - no test is implemented here."