-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp how Tekton pipelines to run notebooks work. (#703)
* Revamp how Tekton pipelines to run notebooks work. Notebook tests should build a docker image to run the notebook in. * #613 currently the way we run notebook tests is by firing off a K8s job on the KF cluster which runs the notebook. * The K8s job uses init containers to pull in source code and install dependencies like papermill. * This is a bit brittle. * To fix this we will instead use Tekton to build a docker image that takes the notebook image and then adds the notebook code to it. * Dockerfile.notebook_runner dockerfile to build the test image. The pipeline to run the notebook consists of two tasks 1. A Tekton Task to build a docker image to run the notebook in 1. A tekton task that fires off a K8s job to run the notebook on the Kubeflow cluster. Here's a list of changes to make this work * tekton_client should provide methods to upload artifacts but not parse junits * Add a tekton_client method to construct the full image URL based on the digest returned from kaniko * Copy over the code for running the notebook tests from kubeflow/examples and start modifying it. * Create a simple CLI to wait for nomos to sync resources to the cluster * This is used in some syntactic sugar make rules to aid the dev-test loop The mnist test isn't completing successfully yet because GoogleCloudPlatform/kubeflow-distribution#61 means the KF deployments don't have proper GSA's to write to GCS. Related to: #613 * tekton_client.py can't use format strings yet because we are still running under python2. * Remove f-style strings. * Fix typo. * Address PR comments. * * copy-buckets should not abort on error as this prevents artifacts from being copied and thus the results from showing up in testgrid see #703
- Loading branch information
Showing
42 changed files
with
1,006 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...repos/kf-ci-v1/namespaces/auto-deploy/tekton.dev_v1alpha1_task_notebook-test-builder.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Task | ||
metadata: | ||
annotations: | ||
sidecar.istio.io/inject: "false" | ||
name: notebook-test-builder | ||
namespace: auto-deploy | ||
spec: | ||
inputs: | ||
params: | ||
- default: gcr.io/kubeflow-ci/test-worker-py3:3780b5d-dirty@sha256:4a766d6f5cc6cbcb00dbc96205f7a5b2816bc5f2b6d516fd67124d4a3e6508ea | ||
description: The docker image to run the tests in | ||
name: test-image | ||
type: string | ||
- description: GCS bucket and directory artifacts will be uploaded to. Should | ||
be in the form of 'gs://' | ||
name: artifacts-gcs | ||
type: string | ||
resources: | ||
- name: notebook-repo | ||
type: git | ||
- name: image | ||
type: image | ||
steps: | ||
- image: $(inputs.params.test-image) | ||
name: setup | ||
script: | | ||
#!/usr/bin/env bash | ||
set -x | ||
mkdir -p /workspace/build | ||
cd /workspace/build | ||
# Copy the source code | ||
cp -r /workspace/$(inputs.resources.notebook-repo.name) . | ||
cp -r /srcCache/kubeflow/testing/notebook_testing/Dockerfile.notebook_runner ./Dockerfile.notebook_runner | ||
mkdir -p kubeflow/ | ||
# Copy over the kubeflow/testing directory because we need it to run the | ||
# notebooks; note that the copy is coming from the worker test image. | ||
cp -r /srcCache/kubeflow/testing ./kubeflow/testing | ||
# Create the artifacts directory | ||
mkdir -p /workspace/artifacts | ||
- command: | ||
- /kaniko/executor | ||
- --dockerfile=/workspace/build/Dockerfile.notebook_runner | ||
- --destination=$(inputs.resources.image.url) | ||
- --context=/workspace/build | ||
- --digest-file=/workspace/artifacts/image-digest | ||
image: gcr.io/kaniko-project/executor:v0.23.0 | ||
name: build-push | ||
resources: | ||
requests: | ||
cpu: 7 | ||
memory: 16Gi | ||
- args: | ||
- -m | ||
- kubeflow.testing.tekton_client | ||
- create-image-file | ||
- --image-name=$(inputs.resources.image.url) | ||
- --digest-file=/workspace/artifacts/image-digest | ||
- --output=$(inputs.params.artifacts-gcs)/image.yaml | ||
command: | ||
- python | ||
env: | ||
- name: PYTHONPATH | ||
value: /srcCache/kubeflow/testing/py | ||
image: $(inputs.params.test-image) | ||
name: create-image-file |
Oops, something went wrong.