Skip to content

Commit

Permalink
Update scheduledworkflow to 2.2.0 (#90)
Browse files Browse the repository at this point in the history
* Update scheduledworkflow to 2.2.0
  • Loading branch information
misohu authored May 29, 2024
1 parent 8af6d3c commit 517f00c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 14 deletions.
15 changes: 8 additions & 7 deletions scheduledworkflow/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# Dockerfile: https://github.com/kubeflow/pipelines/blob/2.0.5/backend/Dockerfile.scheduledworkflow
# Based on: https://github.com/kubeflow/pipelines/blob/2.2.0/backend/Dockerfile.scheduledworkflow
name: scheduledworkflow
summary: Reusable end-to-end ML workflows built using the Kubeflow Pipelines SDK
description: |
This component serves as the backend scheduled workflow of Kubeflow pipelines.
version: 2.0.5
version: "2.2.0"
license: Apache-2.0
base: ubuntu@22.04
platforms:
amd64:
run-user: _daemon_
services:
controller:
override: replace
summary: "scheduled workflow controller service"
command: bash -c '/bin/controller --logtostderr=true --namespace=${NAMESPACE}'
command: bash -c '/bin/controller --logtostderr=true --namespace=${NAMESPACE} --logLevel=${LOG_LEVEL}'
startup: enabled
environment:
NAMESPACE: ""
CRON_SCHEDULE_TIMEZONE: UTC
platforms:
amd64:
LOG_LEVEL: "info"

parts:
security-team-requirement:
Expand All @@ -29,9 +30,9 @@ parts:
controller:
plugin: go
source: https://github.com/kubeflow/pipelines.git
source-tag: 2.0.5
source-tag: 2.2.0
build-snaps:
- go/1.20/stable
- go/1.21/stable
build-environment:
- GO111MODULE: "on"
override-build: |
Expand Down
59 changes: 59 additions & 0 deletions scheduledworkflow/tests/test_rock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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

try:
subprocess.run(["docker", "rm", container_name])
except Exception:
pass
# 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,
)
14 changes: 7 additions & 7 deletions scheduledworkflow/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 All @@ -60,8 +61,7 @@ deps =
ops
commands =
echo "WARNING: This is a placeholder test - no test is implemented here."
; Remove warning and uncomment below once https://github.com/canonical/pipelines-rocks/issues/61
; is resolved
# Tests bellow are failing (charms are unable to build)
; # clone related charm
; rm -rf {env:LOCAL_CHARM_DIR}
; git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR}
Expand Down

0 comments on commit 517f00c

Please sign in to comment.