From e9fdea05c6a7d4457274c5d29b4bd41bc4e702bd Mon Sep 17 00:00:00 2001 From: Sidhartha Mani Date: Fri, 1 Feb 2019 12:04:28 -0800 Subject: [PATCH] Enable CI control from repository: Add Dockerfile.simpleci (#7122) --- Dockerfile.simpleci | 49 ++++++++++++++++++++++++++++ buildscripts/gateway-tests.sh | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 Dockerfile.simpleci create mode 100755 buildscripts/gateway-tests.sh diff --git a/Dockerfile.simpleci b/Dockerfile.simpleci new file mode 100644 index 000000000..d1817a35b --- /dev/null +++ b/Dockerfile.simpleci @@ -0,0 +1,49 @@ +#------------------------------------------------------------- +# Stage 1: Build and Unit tests +#------------------------------------------------------------- +FROM golang:1.11.4 + +COPY . /go/src/github.com/minio/minio +WORKDIR /go/src/github.com/minio/minio + +RUN apt-get update && apt-get install -y jq +RUN make +RUN bash -c 'diff -au <(gofmt -s -d cmd) <(printf "")' +RUN bash -c 'diff -au <(gofmt -s -d pkg) <(printf "")' +RUN for d in $(go list ./... | grep -v browser); do go test -v -race --timeout 15m "$d"; done +RUN make verify +RUN make coverage || true + +#------------------------------------------------------------- +# Stage 2: Test Frontend +#------------------------------------------------------------- +FROM node:10.15-stretch-slim + +COPY browser /minio/browser +WORKDIR /minio/browser + +RUN yarn +RUN yarn test + +#------------------------------------------------------------- +# Stage 3: Run Gateway Tests +#------------------------------------------------------------- + +FROM ubuntu:16.04 + +COPY --from=0 /go/src/github.com/minio/minio/minio ./minio +COPY buildscripts/gateway-tests.sh ./gateway-tests.sh +RUN apt-get update && apt-get install -y git wget jq curl dnsmasq + +RUN wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.11.4.linux-amd64.tar.gz + +ENV DEBIAN_FRONTEND noninteractive +ENV LANG C.UTF-8 +ENV GOROOT /usr/local/go + +RUN mkdir -p /go +ENV GOPATH /go +ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH + +RUN ./gateway-tests.sh diff --git a/buildscripts/gateway-tests.sh b/buildscripts/gateway-tests.sh new file mode 100755 index 000000000..dabb6cf6e --- /dev/null +++ b/buildscripts/gateway-tests.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Minio Cloud Storage, (C) 2019 Minio, Inc. +# +# 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. +# + +set -e +set -E +set -o pipefail + +export SERVER_ENDPOINT=127.0.0.1:24240 +export ENABLE_HTTPS=0 +export ACCESS_KEY=minio +export SECRET_KEY=minio123 +export MINIO_ACCESS_KEY=minio +export MINIO_SECRET_KEY=minio123 +export AWS_ACCESS_KEY_ID=minio +export AWS_SECRET_ACCESS_KEY=minio123 + +trap "cat server.log;cat gateway.log" SIGHUP SIGINT SIGTERM + +./minio --quiet --json server data --address 127.0.0.1:24242 > server.log & +sleep 3 +./minio --quiet --json gateway s3 http://127.0.0.1:24242 --address 127.0.0.1:24240 > gateway.log & +sleep 3 + +mkdir -p /mint +git clone https://github.com/minio/mint /mint +cd /mint + +export MINT_ROOT_DIR=${MINT_ROOT_DIR:-/mint} +export MINT_RUN_CORE_DIR="$MINT_ROOT_DIR/run/core" +export MINT_RUN_SECURITY_DIR="$MINT_ROOT_DIR/run/security" +export WGET="wget --quiet --no-check-certificate" + +go get github.com/go-ini/ini + +./create-data-files.sh +./preinstall.sh + +# install mint app packages +for pkg in "build"/*/install.sh; do + echo "Running $pkg" + $pkg +done + +./postinstall.sh + +/mint/entrypoint.sh || cat server.log gateway.log fail