github.com/jenkins-x/test-infra@v0.0.7/testgrid/conformance/README.md (about) 1 # Display Conformance Tests with Testgrid 2 3 This directory contains tooling for uploading [Kubernetes Conformance test](https://github.com/cncf/k8s-conformance) results for display / monitoring on [TestGrid](../README.md), a tool used heavily by [the core kubernetes project](https://github.com/kubernetes/kubernetes) to monitor test results, particularly as part of the release process. 4 5 Federated conformance test results are hosted on the TestGrid [conformance dashboards](https://testgrid.k8s.io/conformance-all), including the "all" dashboard, and specific sub-dashboards, see [the TestGrid README](../README.md#dashboards) for details on dashboards. Generally we are aiming to have a dashboard here for each provider E.g. "[conformance-cloud-provider-openstack](https://testgrid.k8s.io/conformance-cloud-provider-openstack)" as well as [a cross-vendor dashboard](https://testgrid.k8s.io/conformance-all) to track project wide conformance. 6 7 All Kubernetes cluster providers are invited to post results from their conformance test jobs and results from reliable continuous integration against the release branches may even be used as a signal by the Kubernetes release team in the [release-blocking dashboards](https://testgrid.k8s.io/sig-release-master-blocking). 8 9 The release team has caught actual conformance test regressions using these dashboards just in the first month or so of setting up GCE / OpenStack conformance on TestGrid, and had them fixed before the Kubernetes 1.11 release. 10 11 For the original design doc and further details on the motivation please see [design.md](./design.md). 12 13 ## Usage Guide 14 15 1. First you will need to set up a publicly readable GCS bucket per [contributing test results](https://github.com/kubernetes/test-infra/blob/master/docs/contributing-test-results.md#contributing-test-results) to host your jobs' results. 16 If you cannot or do not want to set up a GCS bucket and only wish to post conformance test results, please contact [@BenTheElder](https://github.com/BenTheElder) or more generally [the gke-kubernetes-engprod team](mailto:gke-kubernetes-engprod@google.com) to arrange for a Google [GKE](https://cloud.google.com/kubernetes-engine/) EngProd provided / maintained bucket for hosting your results. A bucket will be provided following the [playbook](./creating-a-bucket.md) for this. 17 If you'd like to post other kinds of tests or unrelated content, please consider following the playbook yourself to create your own bucket. 18 19 2. Make a PR to test-infra adding your bucket to the TestGrid config (again see [contributing test results](https://github.com/kubernetes/test-infra/blob/master/docs/contributing-test-results.md#contributing-test-results)). 20 21 - See The following PR from setting up the initial OpenStack bucket: [#7670](https://github.com/kubernetes/test-infra/pull/7670) 22 23 3. Setup a job in your CI system to run the conformance tests. To use [`upload_e2e.py`](./upload_e2e.py) the job environment must have `python` (v2.X) and `gcloud` / `gsutil` commands. For the gcloud CLI see [Installing the Google Cloud SDK](https://cloud.google.com/sdk/downloads). 24 25 This job will need to: 26 - `a)` setup a cluster from the kubernetes release / branch you want to test 27 - `b)` run the conformance tests 28 - `c)` obtain the JUnit .xml results and ginkgo (e2e test runner) log output 29 - `d)` upload the results to the GCS bucket 30 31 Setting up the test cluster in `a)` is provider specific and not currently covered here. 32 33 For running the conformance tests and obtaining the result files (`b)` and `c)`) you have the following options: 34 35 - follow [the official conformance testing guide's instructions](https://github.com/cncf/k8s-conformance/blob/master/instructions.md#running) to run and obtain the result files 36 37 - or use [kubetest](https://github.com/kubernetes/test-infra/tree/master/kubetest): 38 - cd to a Kubernetes source tree (git clone) for the release you wish to test, using something like: 39 ```sh 40 git clone https://github.com/kubernetes/kubernetes.git && cd kubernetes && git checkout release-1.11 41 ``` 42 - run `make all WHAT="test/e2e/e2e.test vendor/github.com/onsi/ginkgo/ginkgo cmd/kubectl"` to build the test binaries 43 - make sure `kubectl` / `$KUBECONFIG` is authed to your cluster 44 - run [kubetest](https://github.com/kubernetes/test-infra/tree/master/kubetest) with: 45 ```sh 46 export KUBERNETES_CONFORMANCE_TEST=y 47 # NOTE: see https://github.com/kubernetes/test-infra/pull/9104 for why 48 # we have to supply `--ginkgo.skip`, in the longer term we should not do this. 49 # For < Kubernetes 1.12 use: 50 export SKIP="Alpha|Kubectl|\[(Disruptive|Feature:[^\]]+|Flaky)\]" 51 # otherwise use: 52 export SKIP="Alpha|\[(Disruptive|Feature:[^\]]+|Flaky)\]" 53 kubetest --provider=skeleton \ 54 --test \ 55 --test_args="--ginkgo.focus=\[Conformance\] --ginkgo.skip=${SKIP}" \ 56 --dump=./_artifacts | tee ./e2e.log 57 ``` 58 - You can then find the log file and JUnit at `./e2e.log` and `./_artifacts/junit_01.xml` respectively. 59 60 - or use the [Sonobuouy CLI](https://github.com/heptio/sonobuoy#using-the-cli) to run the tests and then obtain a "snapshot" with the official instructions [when run locally](https://github.com/heptio/sonobuoy#download-and-run). You can then get the e2e log and JUnit from the snapshot (see the [plugins section](https://github.com/heptio/sonobuoy/blob/master/docs/snapshot.md#plugins) of the snapshot documentation) 61 62 For uploading the results (`d)`) you can use the tooling provided here (or build your own mimicking it), to use `upload_e2e.py` provide the following required flags: 63 - `--junit` -- The path to the JUnit result file(s): `--junit=/path/to/junit/result/file/junit_01.xml` 64 - note that this flag accepts [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming)), E.g. `--junit=./artifacts/junit_*.xml` 65 66 - `--log` -- The path to the ginkgo log file / test output: 67 `--log=/path/to/e2e.log` 68 69 - `--bucket` -- The upload prefix, which should include the GCS bucket as well as the job name, E.g. `gs://k8s-conformance-openstack/periodic-logs/ci-cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.11/` like: `--bucket=gs://your-bucket/your-job` 70 71 You can optionally also provide: 72 - `--key-file` -- A Google Cloud [service account](https://cloud.google.com/iam/docs/service-accounts) keyfile, used to automatically authenticate to GCS. Otherwise you will need to authenticate with [`gcloud auth`](https://cloud.google.com/sdk/gcloud/reference/auth/) in some other part of your CI to use this tool. 73 Specify like: 74 `--key-file=/path/to-key-file.json` 75 - If you are using a GKE EngProd provided bucket, we've provided you with this file, otherwise see [Create and Manage Service Accounts](https://cloud.google.com/iam/docs/managing-service-accounts), [Create and manage Service Account Keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys), and [Cloud Storage IAM Roles](https://cloud.google.com/storage/docs/access-control/iam-roles) for docs on setting up your own service account with upload access to the bucket and creating a credentials file for it. 76 77 - `--year` -- The year in which the logfile was produced, otherwise the current year on the host machine is assumed when parsing timestamps for the job's start / finish time. E.g. `--year=2018` 78 79 - `--metadata` -- A JSON dict of metadata key-value pairs that can be displayed in custom TestGrid column headers. E.g. `--metadata='{"version": 52e0b2617ffec85d467f96de34d47e9bb407f880"}'`. 80 - For more details please see [metadata for finished.json](https://github.com/kubernetes/test-infra/tree/master/gubernator#job-artifact-gcs-layout) and custom [column headers in TestGrid](https://github.com/kubernetes/test-infra/blob/master/testgrid/README.md#column-headers). 81