-
Notifications
You must be signed in to change notification settings - Fork 275
WIP: Prow testing #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
cc564f9
verify-subtree.sh: relax check and ignore old content
pohly 849db0a
Merge pull request #8 from pohly/subtree-check-relax
k8s-ci-robot 94fc1e3
build.make: avoid unit-testing E2E test suite
pohly fb13c51
verify-shellcheck.sh: import from Kubernetes
pohly e6db50d
check vendor directory
pohly 34010e7
Merge pull request #10 from pohly/vendor-check
k8s-ci-robot 104a1ac
build.make: avoid unit-testing E2E test suite
pohly 3b6af7b
Merge pull request #12 from pohly/local-e2e-suite
k8s-ci-robot b2d25d4
verify-shellcheck.sh: make it usable in csi-release-tools
pohly 6c7ba1b
build.make: integrate shellcheck into "make test"
pohly 55212ff
initial Prow test job
pohly 2069a0a
Merge pull request #11 from pohly/verify-shellcheck
k8s-ci-robot 0a0fd49
prow.sh: comment clarification
pohly 429581c
prow.sh: pull Go version from travis.yml
pohly 29545bb
prow.sh: take Go version from Kubernetes source
pohly 741319b
prow.sh: improve building Kubernetes from source
pohly 6602d38
prow.sh: different E2E suite depending on Kubernetes version
pohly d87eccb
prow.sh: switch back to upstream csi-driver-host-path
pohly 95ae9de
Merge pull request #9 from pohly/prow
k8s-ci-robot f501443
prow.sh: AllAlpha=true for unknown Kubernetes versions
pohly 31dfaf3
prow.sh: fix running of just "alpha" tests
pohly f3d1d2d
prow.sh: fix hostpath driver version check
pohly aa45a1c
prow.sh: more efficient execution of individual tests
pohly 9b0d9cd
build.make: skip shellcheck if Docker is not available
pohly 546d550
prow.sh: debug failing KinD cluster creation
pohly cda2fc5
prow.sh: avoid AllAlpha=true
pohly 6617773
Merge pull request #13 from pohly/prow
k8s-ci-robot 7aaac22
prow.sh: remove AllAlpha=all, part II
pohly c60f382
Merge pull request #14 from pohly/prow
k8s-ci-robot ff9bce4
Replace 'return' to 'exit' to fix shellcheck error
pengzhisun 0c2677e
Merge pull request #15 from pengzhisun/master
k8s-ci-robot 0b10f6a
prow.sh: update csi-driver-host-path
pohly bcac1c1
Merge pull request #16 from pohly/prow
k8s-ci-robot 0fafc66
prow.sh: skip sanity testing if component doesn't support it
pohly 88dc9a4
Merge pull request #17 from pohly/prow
k8s-ci-robot e157b6b
update to Go 1.12.4
pohly 0bee749
Merge pull request #18 from pohly/go-version
k8s-ci-robot 066143d
build.make: allow repos to use 'go mod' for vendoring
pohly 0399988
Merge pull request #19 from pohly/go-mod-vendor
k8s-ci-robot 4fa924a
release-tools: merge commit '03999882f676a65ab71e11686c3b26b830d7700f'
pohly 25dab4b
deploy: same deployment as for csi-driver-host-path
pohly f31e6a0
prow.sh: support other drivers
pohly b2dbce8
.prow.sh: enable Prow testing
pohly 269f81f
tests: simplify the test binary
pohly 66c6c3c
prow.sh: show KUBECONFIG when running e2e.test
pohly 339931b
.prow.sh: show KUBECONFIG when running e2e.test
pohly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,37 @@ | ||
#! /bin/bash | ||
|
||
# Only these tests work for csi-drivers-flex, E2E and sanity testing | ||
# will require further work. | ||
: ${CSI_PROW_TESTS:="unit serial parallel serial-alpha parallel-alpha"} | ||
|
||
# Customize deployment and E2E testing. | ||
: ${CSI_PROW_DEPLOY_SCRIPT:="deploy.sh"} | ||
: ${CSI_PROW_DEPLOYMENT:="kubernetes"} | ||
: ${CSI_PROW_E2E_TEST_PREFIX:="CSI Volumes"} | ||
|
||
. release-tools/prow.sh | ||
|
||
# Install custom E2E test suite as bin/tests. | ||
install_e2e () { | ||
if [ -e "${CSI_PROW_WORK}/e2e.test" ]; then | ||
return | ||
fi | ||
|
||
make build-tests && cp bin/tests "${CSI_PROW_WORK}/e2e.test" | ||
} | ||
|
||
# Invoke the custom E2E test suite for a certain subset of the tests (serial, parallel, ...) | ||
run_e2e () ( | ||
name="$1" | ||
shift | ||
|
||
install_e2e || die "building e2e.test failed" | ||
install_ginkgo || die "installing ginkgo failed" | ||
|
||
trap "move_junit '$name'" EXIT | ||
|
||
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" && | ||
run_with_loggers env KUBECONFIG="$KUBECONFIG" ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" | ||
) | ||
|
||
main |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -14,25 +14,16 @@ limitations under the License. | |
package main | ||
|
||
import ( | ||
"flag" | ||
_ "github.com/kubernetes-csi/csi-driver-nfs/test" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
"github.com/onsi/ginkgo" | ||
"github.com/onsi/gomega" | ||
"k8s.io/kubernetes/test/e2e/framework" | ||
"testing" | ||
) | ||
|
||
func init() { | ||
func main() { | ||
framework.HandleFlags() | ||
framework.AfterReadingAllFlags(&framework.TestContext) | ||
} | ||
|
||
func Test(t *testing.T) { | ||
flag.Parse() | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "CSI Suite") | ||
} | ||
|
||
func main() { | ||
Test(&testing.T{}) | ||
gomega.RegisterFailHandler(ginkgo.Fail) | ||
ginkgo.RunSpecs(&testing.T{}, "CSI Suite") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ya this makes more sense! |
||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,154 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script captures the steps required to successfully | ||
# deploy the hostpath plugin driver. This should be considered | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: hostpath -> NFS |
||
# authoritative and all updates for this process should be | ||
# done here and referenced elsewhere. | ||
|
||
# The script assumes that kubectl is available on the OS path | ||
# where it is executed. | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
BASE_DIR=$(dirname "$0") | ||
|
||
# If set, the following env variables override image registry and/or tag for each of the images. | ||
# They are named after the image name, with hyphen replaced by underscore and in upper case. | ||
# | ||
# - CSI_ATTACHER_REGISTRY | ||
# - CSI_ATTACHER_TAG | ||
# - CSI_NODE_DRIVER_REGISTRAR_REGISTRY | ||
# - CSI_NODE_DRIVER_REGISTRAR_TAG | ||
# - NFSPLUGIN_REGISTRY | ||
# - NFSPLUGIN_TAG | ||
# | ||
# Alternatively, it is possible to override all registries or tags with: | ||
# - IMAGE_REGISTRY | ||
# - IMAGE_TAG | ||
# These are used as fallback when the more specific variables are unset or empty. | ||
# | ||
# Beware that the .yaml files do not have "imagePullPolicy: Always". That means that | ||
# also the "canary" images will only be pulled once. This is good for testing | ||
# (starting a pod multiple times will always run with the same canary image), but | ||
# implies that refreshing that image has to be done manually. | ||
# | ||
# As a special case, 'none' as registry removes the registry name. | ||
|
||
# The default is to use the RBAC rules that match the image that is | ||
# being used, also in the case that the image gets overridden. This | ||
# way if there are breaking changes in the RBAC rules, the deployment | ||
# will continue to work. | ||
# | ||
# However, such breaking changes should be rare and only occur when updating | ||
# to a new major version of a sidecar. Nonetheless, to allow testing the scenario | ||
# where the image gets overridden but not the RBAC rules, updating the RBAC | ||
# rules can be disabled. | ||
: ${UPDATE_RBAC_RULES:=true} | ||
function rbac_version () { | ||
yaml="$1" | ||
image="$2" | ||
update_rbac="$3" | ||
|
||
# get version from `image: quay.io/k8scsi/csi-attacher:v1.0.1`, ignoring comments | ||
version="$(sed -e 's/ *#.*$//' "$yaml" | grep "image:.*$image" | sed -e 's/ *#.*//' -e 's/.*://')" | ||
|
||
if $update_rbac; then | ||
# apply overrides | ||
varname=$(echo $image | tr - _ | tr a-z A-Z) | ||
eval version=\${${varname}_TAG:-\${IMAGE_TAG:-\$version}} | ||
fi | ||
|
||
# When using canary images, we have to assume that the | ||
# canary images were built from the corresponding branch. | ||
case "$version" in canary) version=master;; | ||
*-canary) version="$(echo "$version" | sed -e 's/\(.*\)-canary/release-\1/')";; | ||
esac | ||
|
||
echo "$version" | ||
} | ||
|
||
# In addition, the RBAC rules can be overridden separately. | ||
CSI_ATTACHER_RBAC_YAML="https://raw.githubusercontent.com/kubernetes-csi/external-attacher/$(rbac_version "${BASE_DIR}/csi-attacher-nfsplugin.yaml" csi-attacher false)/deploy/kubernetes/rbac.yaml" | ||
: ${CSI_ATTACHER_RBAC:=https://raw.githubusercontent.com/kubernetes-csi/external-attacher/$(rbac_version "${BASE_DIR}/csi-attacher-nfsplugin.yaml" csi-attacher "${UPDATE_RBAC_RULES}")/deploy/kubernetes/rbac.yaml} | ||
|
||
INSTALL_CRD=${INSTALL_CRD:-"false"} | ||
|
||
# Some images are not affected by *_REGISTRY/*_TAG and IMAGE_* variables. | ||
# The default is to update unless explicitly excluded. | ||
update_image () { | ||
case "$1" in socat) return 1;; esac | ||
} | ||
|
||
run () { | ||
echo "$@" >&2 | ||
"$@" | ||
} | ||
|
||
# rbac rules | ||
echo "applying RBAC rules" | ||
for component in CSI_ATTACHER; do | ||
eval current="\${${component}_RBAC}" | ||
eval original="\${${component}_RBAC_YAML}" | ||
if [ "$current" != "$original" ]; then | ||
echo "Using non-default RBAC rules for $component. Changes from $original to $current are:" | ||
diff -c <(wget --quiet -O - "$original") <(if [[ "$current" =~ ^http ]]; then wget --quiet -O - "$current"; else cat "$current"; fi) || true | ||
fi | ||
run kubectl apply -f "${current}" | ||
done | ||
|
||
# deploy nfs plugin and registrar sidecar | ||
echo "deploying nfs plugin components" | ||
for i in $(ls ${BASE_DIR}/*.yaml | sort); do | ||
echo " $i" | ||
modified="$(cat "$i" | while IFS= read -r line; do | ||
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')" | ||
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then | ||
# Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1' | ||
# into image (quay.io/k8scsi/csi-attacher:v1.0.1), | ||
# registry (quay.io/k8scsi), | ||
# name (csi-attacher), | ||
# tag (v1.0.1). | ||
image=$(echo "$nocomments" | sed -e 's;.*image:[[:space:]]*;;') | ||
registry=$(echo "$image" | sed -e 's;\(.*\)/.*;\1;') | ||
name=$(echo "$image" | sed -e 's;.*/\([^:]*\).*;\1;') | ||
tag=$(echo "$image" | sed -e 's;.*:;;') | ||
|
||
# Variables are with underscores and upper case. | ||
varname=$(echo $name | tr - _ | tr a-z A-Z) | ||
|
||
# Now replace registry and/or tag, if set as env variables. | ||
# If not set, the replacement is the same as the original value. | ||
# Only do this for the images which are meant to be configurable. | ||
if update_image "$name"; then | ||
prefix=$(eval echo \${${varname}_REGISTRY:-${IMAGE_REGISTRY:-${registry}}}/ | sed -e 's;none/;;') | ||
suffix=$(eval echo :\${${varname}_TAG:-${IMAGE_TAG:-${tag}}}) | ||
line="$(echo "$nocomments" | sed -e "s;$image;${prefix}${name}${suffix};")" | ||
fi | ||
echo " using $line" >&2 | ||
fi | ||
echo "$line" | ||
done)" | ||
if ! echo "$modified" | kubectl apply -f -; then | ||
echo "modified version of $i:" | ||
echo "$modified" | ||
exit 1 | ||
fi | ||
done | ||
|
||
# Wait until all pods are running. We have to make some assumptions | ||
# about the deployment here, otherwise we wouldn't know what to wait | ||
# for: the expectation is that we run attacher and nfs plugin in the default namespace. | ||
cnt=0 | ||
while [ $(kubectl get pods 2>/dev/null | grep '^csi-.*nfsplugin.* Running ' | wc -l) -lt 2 ]; do | ||
if [ $cnt -gt 30 ]; then | ||
echo "Running pods:" | ||
kubectl describe pods | ||
|
||
echo >&2 "ERROR: nfs deployment not ready after over 5min" | ||
exit 1 | ||
fi | ||
echo $(date +%H:%M:%S) "waiting for nfs deployment to complete, attempt #$cnt" | ||
cnt=$(($cnt + 1)) | ||
sleep 10 | ||
done |
This file contains hidden or 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,7 @@ | ||
#! /bin/bash -e | ||
# | ||
# This is for testing csi-release-tools itself in Prow. All other | ||
# repos use prow.sh for that, but as csi-release-tools isn't a normal | ||
# repo with some Go code in it, it has a custom Prow test script. | ||
|
||
./verify-shellcheck.sh "$(pwd)" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know where the kubeconfig gets passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KUBECONFIG
gets set bystart_cluster
based on the output ofkind get kubeconfig-path --name=csi-prow
.It would be useful to make that more visible in the
prow.sh
output for those who try to reproduce what it does.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added two more commits which show KUBECONFIG (needs to be two separate commits because they'll go into different repos).