Skip to content

Commit 806e6e4

Browse files
committed
initial Prow test job
This enables testing of other repos and of this repo itself inside Prow. Currently supported is unit testing ("make test") and E2E testing (either via a local test suite or the Kubernetes E2E test suite applied to the hostpath driver example deployment). The script passes shellcheck and uses Prow to verify that for future PRs.
1 parent b5c4382 commit 806e6e4

File tree

3 files changed

+719
-0
lines changed

3 files changed

+719
-0
lines changed

.prow.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash -e
2+
#
3+
# This is for testing csi-release-tools itself in Prow. All other
4+
# repos use prow.sh for that, but as csi-release-tools isn't a normal
5+
# repo with some Go code in it, it has a custom Prow test script.
6+
7+
./verify-shellcheck.sh "$(pwd)"

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,48 @@ Cheat sheet:
4949
- `git subtree add --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - add release tools to a repo which does not have them yet (only once)
5050
- `git subtree pull --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master` - update local copy to latest upstream (whenever upstream changes)
5151
- edit, `git commit`, `git subtree push --prefix=release-tools [email protected]:<user>/csi-release-tools.git <my-new-or-existing-branch>` - push to a new branch before submitting a PR
52+
53+
End-to-end testing
54+
------------------
55+
56+
A repo that wants to opt into testing via Prow must set up a top-level
57+
`.prow.sh`. Typically that will source `prow.sh` and then transfer
58+
control to it:
59+
60+
``` bash
61+
#! /bin/bash -e
62+
63+
. release-tools/prow.sh
64+
main
65+
```
66+
67+
All Kubernetes-CSI repos are expected to switch to Prow. For details
68+
on what is enabled in Prow, see
69+
https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-csi
70+
71+
Test results for periodic jobs are visible in
72+
https://testgrid.k8s.io/sig-storage-csi
73+
74+
It is possible to reproduce the Prow testing locally on a suitable machine:
75+
- Linux host
76+
- Docker installed
77+
- code to be tested checkout out in `$GOPATH/src/<import path>`
78+
- `cd $GOPATH/src/<import path> && ./.prow.sh`
79+
80+
Beware that the script intentionally doesn't clean up after itself and
81+
modifies the content of `$GOPATH`, in particular the `kubernetes` and
82+
`kind` repositories there. Better run it in an empty, disposable
83+
`$GOPATH`.
84+
85+
When it terminates, the following command can be used to get access to
86+
the Kubernetes cluster that was brought up for testing (assuming that
87+
this step succeeded):
88+
89+
export KUBECONFIG="$(kind get kubeconfig-path --name="csi-prow")"
90+
91+
It is possible to control the execution via environment variables. See
92+
`prow.sh` for details. Particularly useful is testing against different
93+
Kubernetes releases:
94+
95+
CSI_PROW_KUBERNETES_VERSION=1.13.3 ./.prow.sh
96+
CSI_PROW_KUBERNETES_VERSION=latest ./.prow.sh

0 commit comments

Comments
 (0)