From 3ca159391969beecfbb2aab1dc162fe3236c8a56 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 17 Jun 2020 18:17:28 +0200 Subject: [PATCH] build with docker:generic --- lotus-testground/Dockerfile | 75 +++++++++++++++++++++++++++ lotus-testground/manifest.toml | 5 +- lotus-testground/manifest.toml-backup | 46 ++++++++++++++++ 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 lotus-testground/Dockerfile create mode 100644 lotus-testground/manifest.toml-backup diff --git a/lotus-testground/Dockerfile b/lotus-testground/Dockerfile new file mode 100644 index 000000000..74f3c2639 --- /dev/null +++ b/lotus-testground/Dockerfile @@ -0,0 +1,75 @@ +#::: +#::: BUILD CONTAINER +#::: + +# GO_VERSION is the golang version this image will be built against. +ARG GO_VERSION=1.14.2 + +# This Dockerfile performs a multi-stage build and RUNTIME_IMAGE is the image +# onto which to copy the resulting binary. +# Picking a different runtime base image from the build image allows us to +# slim down the deployable considerably. +# +# The user can override the runtime image by passing in the appropriate builder +# configuration option. +#ARG RUNTIME_IMAGE=busybox:1.31.1-glibc + +# Dynamically select the golang version. +FROM golang:${GO_VERSION}-buster AS builder + +RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev jq gcc git bzr pkg-config +ARG LOTUS_VERSION=master +RUN git clone https://github.com/filecoin-project/lotus.git ${PLAN_DIR}/../lotus && cd ${PLAN_DIR}/../lotus && git checkout ${LOTUS_VERSION} && git submodule update --init && make 2k +RUN cd ${PLAN_DIR}/../lotus/extern/filecoin-ffi \ + && make \ + && mkdir /tmp/filecoin-ffi \ + && cp -R ${PLAN_DIR}/../lotus/extern/filecoin-ffi /tmp + +# TESTPLAN_EXEC_PKG is the executable package of the testplan to build. +# The image will build that package only. +ARG TESTPLAN_EXEC_PKG="." + +# GO_PROXY is the go proxy that will be used, or direct by default. +ARG GO_PROXY=http://testground-goproxy:8081 + +# BUILD_TAGS is either nothing, or when expanded, it expands to "-tags " +ARG BUILD_TAGS + +ENV TESTPLAN_EXEC_PKG ${TESTPLAN_EXEC_PKG} + +# PLAN_DIR is the location containing the plan source inside the container. +ENV PLAN_DIR /plan + +# Copy only go.mod files and download deps, in order to leverage Docker caching. +COPY /plan/go.mod ${PLAN_DIR}/go.mod + +# Download deps. +RUN echo "Using go proxy: ${GO_PROXY}" \ + && cd ${PLAN_DIR} \ + && go env -w GOPROXY="${GO_PROXY}" \ + && go mod download + +# Now copy the rest of the source and run the build. +COPY . / + +RUN cd ${PLAN_DIR} \ + && go env -w GOPROXY="${GO_PROXY}" \ + && GOOS=linux GOARCH=amd64 go build -o testplan ${BUILD_TAGS} ${TESTPLAN_EXEC_PKG} + +# Store module dependencies +RUN cd ${PLAN_DIR} \ + && go list -m all > /testground_dep_list + +#::: +#::: RUNTIME CONTAINER +#::: + +#FROM ${RUNTIME_IMAGE} AS binary + +#COPY /usr/lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/* /usr/lib/ +#COPY /testground_dep_list / +RUN cp /plan/testplan / + +EXPOSE 6060 +ENTRYPOINT [ "/testplan"] + diff --git a/lotus-testground/manifest.toml b/lotus-testground/manifest.toml index d78063768..216ac91be 100644 --- a/lotus-testground/manifest.toml +++ b/lotus-testground/manifest.toml @@ -11,7 +11,7 @@ enabled = true pre_mod_download = """ RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev jq ARG LOTUS_VERSION=master -RUN git clone https://github.com/filecoin-project/lotus.git ${PLAN_DIR}/../lotus && cd ${PLAN_DIR}/../lotus && git checkout ${LOTUS_VERSION} && git submodule update --init +RUN git clone https://github.com/filecoin-project/lotus.git ${PLAN_DIR}/../lotus && cd ${PLAN_DIR}/../lotus && git checkout ${LOTUS_VERSION} && git submodule update --init && make 2k RUN cd ${PLAN_DIR}/../lotus/extern/filecoin-ffi \ && make \ && mkdir /tmp/filecoin-ffi \ @@ -31,6 +31,9 @@ enabled = true [runners."local:exec"] enabled = true +[runners."cluster:swarm"] +enabled = true + [runners."cluster:k8s"] enabled = true diff --git a/lotus-testground/manifest.toml-backup b/lotus-testground/manifest.toml-backup new file mode 100644 index 000000000..216ac91be --- /dev/null +++ b/lotus-testground/manifest.toml-backup @@ -0,0 +1,46 @@ +name = "lotus-testground" + +[defaults] +builder = "exec:go" +runner = "local:exec" + +[builders."docker:go"] +enabled = true + +[builders."docker:go".dockerfile_extensions] +pre_mod_download = """ +RUN apt-get update && apt-get install -y ca-certificates llvm clang mesa-opencl-icd ocl-icd-opencl-dev jq +ARG LOTUS_VERSION=master +RUN git clone https://github.com/filecoin-project/lotus.git ${PLAN_DIR}/../lotus && cd ${PLAN_DIR}/../lotus && git checkout ${LOTUS_VERSION} && git submodule update --init && make 2k +RUN cd ${PLAN_DIR}/../lotus/extern/filecoin-ffi \ + && make \ + && mkdir /tmp/filecoin-ffi \ + && cp -R ${PLAN_DIR}/../lotus/extern/filecoin-ffi /tmp +""" + +pre_runtime_copy = """ +COPY --from=builder /usr/lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/* /usr/lib/ +""" + +[builders."exec:go"] +enabled = true + +[runners."local:docker"] +enabled = true + +[runners."local:exec"] +enabled = true + +[runners."cluster:swarm"] +enabled = true + +[runners."cluster:k8s"] +enabled = true + +# seq 0 +[[testcases]] +name = "lotus-network" +instances = { min = 2, max = 2, default = 2 } + +[testcases.params] + miner-count = { type = "int", default = 1 }