Improve execution of prow jobs

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-06-24 21:46:47 -04:00
parent dcbe3824de
commit e977c8e056
4 changed files with 6 additions and 134 deletions

View file

@ -15,7 +15,6 @@ Directory | Purpose
------------ | -------------
custom-error-pages | Example of Custom error pages for the NGINX Ingress controller
e2e | Image to run e2e tests
e2e-prow | Image to launch Prow jobs
fastcgi-helloserver | FastCGI application for e2e tests
grpc-fortune-teller | grpc server application for the nginx-ingress grpc example
httpbin | A simple HTTP Request & Response Service for e2e tests

View file

@ -1,26 +0,0 @@
# Copyright 2018 The Kubernetes Authors. All rights reserved.
#
# 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.
TAG ?=v$(shell date +%m%d%Y)-$(shell git rev-parse --short HEAD)
REGISTRY ?= quay.io/kubernetes-ingress-controller
IMAGE = $(REGISTRY)/e2e-prow
.PHONY: image
image:
docker build \
--build-arg K8S_RELEASE=v1.17.0 \
--build-arg KIND_VERSION=v0.8.0 \
--build-arg GO_VERSION=1.14.2 \
-t $(IMAGE):$(TAG) rootfs

View file

@ -1,71 +0,0 @@
# Copyright 2016 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 file creates a build environment for building and running kubernetes
# unit and integration tests
FROM gcr.io/k8s-testimages/bootstrap
FROM k8s.gcr.io/etcd:3.4.3-0 as etcd
COPY --from=etcd /usr/local/bin/etcd /usr/local/bin/etcd
# hint to kubetest that it is in CI
ENV KUBETEST_IN_DOCKER="true"
# Go standard envs
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$PATH
RUN mkdir -p /go/bin
ENV PATH $GOPATH/bin:$PATH
# setup k8s repo symlink
RUN mkdir -p /go/src/k8s.io/kubernetes \
&& ln -s /go/src/k8s.io/kubernetes /workspace/kubernetes
# preinstall:
# - graphviz package for graphing profiles
# - bc for shell to junit
# - rpm for building RPMs with Bazel
RUN apt-get update \
&& apt-get install -y \
bc \
rpm \
parallel \
&& rm -rf /var/lib/apt/lists/*
ARG K8S_RELEASE
ARG KIND_VERSION
ARG GO_VERSION
RUN curl -sSL https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
RUN curl -sSL https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/amd64/kube-apiserver -o /usr/local/bin/kube-apiserver \
&& chmod +x /usr/local/bin/kube-apiserver
RUN curl -sSL https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64 -o /usr/local/bin/kind \
&& chmod +x /usr/local/bin/kind
# install go
ENV GO_TARBALL "go${GO_VERSION}.linux-amd64.tar.gz"
RUN wget -q "https://storage.googleapis.com/golang/${GO_TARBALL}" \
&& tar xzf "${GO_TARBALL}" -C /usr/local \
&& rm "${GO_TARBALL}"
RUN go get github.com/onsi/ginkgo/ginkgo \
&& go get golang.org/x/lint/golint \
&& rm -rf /go/src/github.com
ENV KUBEBUILDER_ASSETS /usr/local/bin

View file

@ -37,21 +37,15 @@ cleanup() {
trap cleanup EXIT
if ! command -v parallel &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Parallel is not installed. Use the package manager to install it"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "Parallel is not installed. Install it running brew install parallel"
fi
exit 1
fi
if ! command -v kind --version &> /dev/null; then
echo "kind is not installed. Use the package manager or visit the official site https://kind.sigs.k8s.io/"
exit 1
fi
if ! command -v ginkgo &> /dev/null; then
go get github.com/onsi/ginkgo/ginkgo
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Use 1.0.0-dev to make sure we use the latest configuration in the helm template
@ -79,25 +73,13 @@ echo "Kubernetes cluster:"
kubectl get nodes -o wide
echo "[dev-env] building image"
export EXIT_CODE=-1
echo "
make -C ${DIR}/../../ clean-image build image
make -C ${DIR}/../e2e-image image
make -C ${DIR}/../../images/fastcgi-helloserver/ build image
make -C ${DIR}/../../images/httpbin/ image
make -C ${DIR}/../../images/echo/ image
make -C ${DIR}/../../images/cfssl/ image
" | parallel --joblog /tmp/log {} || EXIT_CODE=$?
if [ ${EXIT_CODE} -eq 0 ] || [ ${EXIT_CODE} -eq -1 ];
then
echo "Image builds were ok! Log:"
cat /tmp/log
unset EXIT_CODE
else
echo "Image builds were not ok! Log:"
cat /tmp/log
exit 1
fi
# Preload images used in e2e tests
docker pull moul/grpcbin
@ -106,8 +88,7 @@ docker pull quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f
KIND_WORKERS=$(kind get nodes --name="${KIND_CLUSTER_NAME}" | grep worker | awk '{printf (NR>1?",":"") $1}')
echo "[dev-env] copying docker images to cluster..."
export EXIT_CODE=-1
echo "
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} nginx-ingress-controller:e2e
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/nginx-ingress-controller:${TAG}
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/fastcgi-helloserver:${TAG}
@ -116,17 +97,6 @@ kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${R
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} moul/grpcbin
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/cfssl:${TAG}
" | parallel --joblog /tmp/log {} || EXIT_CODE=$?
if [ ${EXIT_CODE} -eq 0 ] || [ ${EXIT_CODE} -eq -1 ];
then
echo "Image loads were ok! Log:"
cat /tmp/log
unset EXIT_CODE
else
echo "Image loads were not ok! Log:"
cat /tmp/log
exit
fi
echo "[dev-env] running e2e tests..."
make -C ${DIR}/../../ e2e-test