diff --git a/scheduledworkflow/rockcraft.yaml b/scheduledworkflow/rockcraft.yaml index 9580437..f4ba8b9 100644 --- a/scheduledworkflow/rockcraft.yaml +++ b/scheduledworkflow/rockcraft.yaml @@ -1,10 +1,11 @@ +# Dockerfile: https://github.com/kubeflow/pipelines/blob/2.0.3/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.0-alpha.7_22.04_2 +version: 2.0.3 license: Apache-2.0 -base: ubuntu:22.04 +base: ubuntu@22.04 run-user: _daemon_ services: controller: @@ -28,9 +29,9 @@ parts: controller: plugin: go source: https://github.com/kubeflow/pipelines.git - source-tag: 2.0.0-alpha.7 # upstream branch + source-tag: 2.0.3 build-snaps: - - go/1.17/stable + - go/1.20/stable build-environment: - GO111MODULE: "on" override-build: | diff --git a/scheduledworkflow/tox.ini b/scheduledworkflow/tox.ini index 781da4c..71fe248 100644 --- a/scheduledworkflow/tox.ini +++ b/scheduledworkflow/tox.ini @@ -3,6 +3,7 @@ [tox] skipsdist = True skip_missing_interpreters = True +envlist = pack, export-to-docker, sanity, integration [testenv] setenv = @@ -12,32 +13,41 @@ setenv = CHARM_BRANCH=main LOCAL_CHARM_DIR=charm_repo -[testenv:unit] +[testenv:pack] passenv = * allowlist_externals = - bash - tox rockcraft -deps = - juju~=2.9.0 - pytest - pytest-operator - ops commands = - # build and pack rock rockcraft pack + +[testenv:export-to-docker] +passenv = * +allowlist_externals = + bash + skopeo + yq +commands = + # pack rock and export to docker bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \ VERSION=$(yq eval .version rockcraft.yaml) && \ - ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " '\''{ print $2 }'\'') && \ - ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \ - sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \ - docker save $ROCK > $ROCK.tar' - # run rock tests - pytest -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests + 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 = * +allowlist_externals = + echo +commands = + # TODO: Implement sanity tests + echo "WARNING: This is a placeholder test - no test is implemented here." [testenv:integration] passenv = * allowlist_externals = + echo bash git rm @@ -49,20 +59,19 @@ deps = pytest-operator ops commands = - # build and pack rock - rockcraft pack - # clone related charm - rm -rf {env:LOCAL_CHARM_DIR} - git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR} - # upload rock to docker and microk8s cache, replace charm's container with local rock reference - bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \ - VERSION=$(yq eval .version rockcraft.yaml) && \ - ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " '\''{ print $2 }'\'') && \ - ROCK="$\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \ - sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \ - docker save $ROCK > $ROCK.tar && \ - microk8s ctr image import $ROCK.tar && \ - yq e -i ".resources.oci-image.upstream-source=\"$ROCK:$VERSION\"" {env:LOCAL_CHARM_DIR}/charms/kfp-schedwf/metadata.yaml' - # run charm integration test with rock - tox -c {env:LOCAL_CHARM_DIR} -e integration + 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 + ; # clone related charm + ; rm -rf {env:LOCAL_CHARM_DIR} + ; git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR} + ; # upload rock to docker and microk8s cache, replace charm's container with local rock reference + ; bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \ + ; VERSION=$(yq eval .version rockcraft.yaml) && \ + ; DOCKER_IMAGE=$NAME:$VERSION && \ + ; docker save $DOCKER_IMAGE > $DOCKER_IMAGE.tar && \ + ; sudo microk8s ctr image import $DOCKER_IMAGE.tar --digests=true && \ + ; yq e -i ".resources.oci-image.upstream-source=\"$DOCKER_IMAGE\"" {env:LOCAL_CHARM_DIR}/charms/kfp-schedwf/metadata.yaml' + ; # run charm integration test with rock + ; tox -c {env:LOCAL_CHARM_DIR} -e bundle-integration-v2 -- --model kubeflow