Skip to content

Commit

Permalink
Tekton init (kubeflow#621)
Browse files Browse the repository at this point in the history
* virtual service for dashboard

* ordering

* notebook test task

* add pytest

* adding env

* add step to get credential

* mount gcp-credential

* add retry

* add gcp credentials to run-notebook

* add mnist run

* remove demo

* set up params for prow env

* add more prow env

* add todo
  • Loading branch information
k8s-ci-robot authored Mar 4, 2020
1 parent 6c64e6c commit cf35120
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 2 deletions.
9 changes: 7 additions & 2 deletions py/kubeflow/testing/get_kf_testing_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from googleapiclient import discovery
from kubeflow.testing import util
from oauth2client.client import GoogleCredentials
from retrying import retry

# Default pattern to match auto deployed clusters from master
DEFAULT_PATTERN = r"kf-master-(?!n\d\d)"
Expand Down Expand Up @@ -205,8 +206,12 @@ def get_latest_credential(project="kubeflow-ci-deployment",
dm = get_latest(project=project, testing_label=testing_label,
base_name=base_name, field="all")

util.run(["gcloud", "container", "clusters", "get-credentials", dm["name"],
"--project="+project, "--zone="+dm["zone"]])
# This call may be flaky due to timeout.
@retry(stop_max_attempt_number=10, wait_fixed=5000)
def run_get_credentials():
util.run(["gcloud", "container", "clusters", "get-credentials", dm["name"],
"--project="+project, "--zone="+dm["zone"]])
run_get_credentials()

def list_dms(args):
logging.info("Calling list deployments.")
Expand Down
21 changes: 21 additions & 0 deletions tekton/configs/virtual-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: tekton-dashboard
namespace: tekton-pipelines
spec:
gateways:
- kubeflow/kubeflow-gateway
hosts:
- '*'
http:
- match:
- uri:
prefix: /tekton/
rewrite:
uri: /
route:
- destination:
host: tekton-dashboard.tekton-pipelines.svc.cluster.local
port:
number: 9097
135 changes: 135 additions & 0 deletions tekton/templates/notebook-test-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# TODO(gabrielwen): Define subsequent steps to collect artifacts.
# TODO(gabrielwen): Move prow ENVs to configmaps.
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: notebook-test
namespace: tektoncd
annotations:
sidecar.istio.io/inject: "false"
spec:
inputs:
params:
- name: notebook-path
type: string
description:
Testing notebook location. Should be in the form of
{REPO_OWNER}/{REPO}/path/to/notebook.ipynb
- name: testing-cluster-pattern
type: string
description:
Cluster pattern to run the notebook test.
Default to be from master branch.
default: 'kf-master-(?!n\d\d)'
# params below are for prow jobs.
- name: test-target-name
type: string
description:
Test target name from Prow ENV. Should be provided at runtime.
- name: repo-owner
type: string
description:
Testing repo owner from Prow ENV.
- name: prow-job-id
type: string
description:
Prow job ID from Prow ENV.
- name: job-type
type: string
description:
Job type from Prow ENV.
- name: job-name
type: string
description:
Job name from Prow ENV.
- name: repo-name
type: string
description:
Testing repo name from Prow ENV.
- name: pull-number
type: string
description:
Pull number from Prow ENV.
- name: build-id
type: string
description:
BUILD_ID from Prow ENV.
resources:
- name: examples-repo
type: git
targetPath: src/kubeflow/examples
- name: kf-testing-repo
type: git
targetPath: src/kubeflow/testing
steps:
- name: get-credential
image: gcr.io/kubeflow-ci/test-worker:latest
command:
- python3
args:
- -m
- kubeflow.testing.get_kf_testing_cluster
- --base=$(inputs.params.testing-cluster-pattern)
- get-credentials
env:
- name: PYTHONPATH
value: /workspace/src/kubeflow/examples/py:/workspace/src/kubeflow/testing/py
- name: TEST_TARGET_NAME
value: $(inputs.params.test-target-name)
- name: REPO_OWNER
value: $(inputs.params.repo-owner)
- name: PROW_JOB_ID
value: $(inputs.params.prow-job-id)
- name: JOB_TYPE
value: $(inputs.params.job-type)
- name: JOB_NAME
value: $(inputs.params.job-name)
- name: REPO_NAME
value: $(inputs.params.repo-name)
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /secret/gcp-credentials/key.json
volumeMounts:
- name: gcp-credentials
readOnly: true
mountPath: /secret/gcp-credentials
- name: run-notebook
image: gcr.io/kubeflow-ci/test-worker:latest
command:
- pytest
args:
- run_notebook_test.py
- --log-cli-level=info
- --log-cli-format='%(levelname)s|%(asctime)s|%(pathname)s|%(lineno)d| %(message)s'
- --timeout=1800
- --junitxml=/workspace/outputs/junit_xgboost-synthetic-test.xml
- --notebook_path=$(inputs.params.notebook-path)
workingDir: /workspace/src/kubeflow/examples/py/kubeflow/examples/notebook_tests
env:
- name: PYTHONPATH
value: /workspace/src/kubeflow/examples/py:/workspace/src/kubeflow/testing/py
- name: TEST_TARGET_NAME
value: $(inputs.params.test-target-name)
- name: REPO_OWNER
value: $(inputs.params.repo-owner)
- name: PROW_JOB_ID
value: $(inputs.params.prow-job-id)
- name: JOB_TYPE
value: $(inputs.params.job-type)
- name: JOB_NAME
value: $(inputs.params.job-name)
- name: REPO_NAME
value: $(inputs.params.repo-name)
- name: PULL_NUMBER
value: $(inputs.params.pull-number)
- name: BUILD_ID
value: $(inputs.params.build-id)
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /secret/gcp-credentials/key.json
volumeMounts:
- name: gcp-credentials
readOnly: true
mountPath: /secret/gcp-credentials
volumes:
- name: gcp-credentials
secret:
secretName: gcp-credentials

0 comments on commit cf35120

Please sign in to comment.