Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update viewer-crd-controller to 2.2.0 #91

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions viewer-crd-controller/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
# Dockerfile: https://github.com/kubeflow/pipelines/blob/2.0.5/backend/Dockerfile.viewercontroller
# Based on: https://github.com/kubeflow/pipelines/blob/2.0.5/backend/Dockerfile.viewercontroller
name: viewer-crd-controller
misohu marked this conversation as resolved.
Show resolved Hide resolved
summary: An image for the Viewer CRD Controller
description: |
This image is used as part of the Charmed Kubeflow product.
version: 2.0.5
version: "2.2.0"
license: Apache-2.0
base: [email protected]
build-base: [email protected]
platforms:
amd64:
run-user: _daemon_
services:
controller:
override: replace
summary: "viewer CRD controller"
startup: enabled
command: controller
platforms:
amd64:
environment:
MAX_NUM_VIEWERS: "50"
NAMESPACE: "kubeflow"
command: bash -c '/bin/controller --logtostderr=true --max_num_viewers=${MAX_NUM_VIEWERS} --namespace=${NAMESPACE}'

parts:
viewer-crd-controller:
plugin: go
source: https://github.com/kubeflow/pipelines
build-snaps:
- go/1.20/stable
- go/1.21/stable
source-type: git
source-tag: 2.0.5
source-tag: 2.2.0
build-packages:
- git
- gcc
Expand All @@ -36,8 +38,7 @@ parts:
mkdir -p $CRAFT_PART_INSTALL/bin
mkdir -p $CRAFT_PART_INSTALL/third_party

go build -o $CRAFT_PART_INSTALL/bin/controller backend/src/crd/controller/viewer/*.go

GO111MODULE=on go build -o $CRAFT_PART_INSTALL/bin/controller backend/src/crd/controller/viewer/*.go
./hack/install-go-licenses.sh
misohu marked this conversation as resolved.
Show resolved Hide resolved
$GOBIN/go-licenses check ./backend/src/crd/controller/viewer
$GOBIN/go-licenses csv ./backend/src/crd/controller/viewer > $CRAFT_PART_INSTALL/third_party/licenses.csv
Expand Down
56 changes: 56 additions & 0 deletions viewer-crd-controller/tests/test_rock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
import random
import pytest
import string
import subprocess

from charmed_kubeflow_chisme.rock import CheckRock


@pytest.fixture()
def rock_test_env(tmpdir):
"""Yields a temporary directory and random docker container name, then cleans them up after."""
container_name = "".join(
[str(i) for i in random.choices(string.ascii_lowercase, k=8)]
)
yield tmpdir, container_name

subprocess.run(["docker", "rm", container_name], shell=True, check=False)
# tmpdir fixture we use here should clean up the other files for us


@pytest.mark.abort_on_fail
def test_rock(rock_test_env):
"""Test rock."""
temp_dir, container_name = rock_test_env
check_rock = CheckRock("rockcraft.yaml")
rock_image = check_rock.get_name()
rock_version = check_rock.get_version()
LOCAL_ROCK_IMAGE = f"{rock_image}:{rock_version}"

# assert we have the expected files
subprocess.run(
[
"docker",
"run",
"--entrypoint",
"/bin/bash",
LOCAL_ROCK_IMAGE,
"-c",
"ls -la /bin/controller",
],
check=True,
)
subprocess.run(
[
"docker",
"run",
"--entrypoint",
"/bin/bash",
LOCAL_ROCK_IMAGE,
"-c",
"ls -la /third_party",
],
check=True,
)
11 changes: 6 additions & 5 deletions viewer-crd-controller/tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
[tox]
skipsdist = True
Expand Down Expand Up @@ -38,11 +38,12 @@ commands =

[testenv:sanity]
passenv = *
allowlist_externals =
echo
deps =
pytest
charmed-kubeflow-chisme
commands =
# TODO: Implement sanity tests
echo "WARNING: This is a placeholder test - no test is implemented here."
# run rock tests
pytest -s -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests

[testenv:integration]
passenv = *
Expand Down
Loading