From a85fd3678fd5c016347cc2a774901c813dda31ba Mon Sep 17 00:00:00 2001 From: Xuewei Zhang Date: Fri, 9 Aug 2019 17:47:53 -0700 Subject: [PATCH] Add container used to run e2e test in Prow --- test/e2e/containers/prow-npd-e2e/Dockerfile | 25 ++++++++++++ test/e2e/containers/prow-npd-e2e/Makefile | 30 ++++++++++++++ test/e2e/containers/prow-npd-e2e/script.sh | 43 +++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 test/e2e/containers/prow-npd-e2e/Dockerfile create mode 100644 test/e2e/containers/prow-npd-e2e/Makefile create mode 100644 test/e2e/containers/prow-npd-e2e/script.sh diff --git a/test/e2e/containers/prow-npd-e2e/Dockerfile b/test/e2e/containers/prow-npd-e2e/Dockerfile new file mode 100644 index 000000000..8f5f675aa --- /dev/null +++ b/test/e2e/containers/prow-npd-e2e/Dockerfile @@ -0,0 +1,25 @@ +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM gcr.io/k8s-testimages/kubekins-e2e:v20190607-c90971a-master + +RUN go get github.com/onsi/ginkgo/ginkgo + +RUN apt-get update +RUN apt-get install -y libsystemd-dev + +ADD script.sh /script.sh +RUN chmod a+x /script.sh + +CMD ["/script.sh"] diff --git a/test/e2e/containers/prow-npd-e2e/Makefile b/test/e2e/containers/prow-npd-e2e/Makefile new file mode 100644 index 000000000..ccf1c5950 --- /dev/null +++ b/test/e2e/containers/prow-npd-e2e/Makefile @@ -0,0 +1,30 @@ +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Build the container which Prow uses to run NPD e2e tests. + +IMAGE=gcr.io/gke-prow/prow-npd-e2e:live + +all: push + +container: + docker build --pull -t ${IMAGE} . + +push: container + gcloud docker -- push ${IMAGE} + +test: container + docker run --rm --entrypoint=/script.sh ${IMAGE} + +.PHONY: all container push diff --git a/test/e2e/containers/prow-npd-e2e/script.sh b/test/e2e/containers/prow-npd-e2e/script.sh new file mode 100644 index 000000000..4032a96d3 --- /dev/null +++ b/test/e2e/containers/prow-npd-e2e/script.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright 2019 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This scripts clones a NPD repository, and then runs NPD e2e test from it. + +set -o errexit +set -o pipefail +set -u +set -x + +test() { + git clone https://github.com/kubernetes/node-problem-detector.git + + pushd node-problem-detector + + ZONE=us-central1-a PROJECT=xueweiz-experimental \ + VM_IMAGE=cos-73-11647-217-0 IMAGE_PROJECT=cos-cloud \ + SSH_USER=${USER} SSH_KEY=${JENKINS_GCE_SSH_PRIVATE_KEY_FILE} \ + make e2e-test + + popd + rm -rf node-problem-detector +} + +main() { + runner.sh echo "Running NPD e2e test." + test "$@" +} + +main "$@"