From 8891afb5c4b3630c00106898cf02115c5f97583f Mon Sep 17 00:00:00 2001 From: chengyi01 Date: Mon, 14 Feb 2022 14:11:29 +0800 Subject: [PATCH] upgrade bazel 1. upgrade bazel to 4.2.2 2. support clang-7.0.1 3. support gcc-8.3.0 4. test in debian10 5. dockerfile can be used to make an image of the build environment add patch: 1. https://github.com/apache/incubator-brpc/commit/6efb0cff5f30f32437c660cef01c93549cf62679 2. https://github.com/apache/incubator-brpc/commit/3a928ddbad1e2f2bc7106f8ca8eddec7bfd435d6 --- .bazelrc | 5 + .bazelversion | 2 +- Makefile | 5 +- WORKSPACE | 86 +++++++----- build.sh | 8 +- copts.bzl | 13 +- curvefs/Makefile | 5 +- curvefs/docker/debian10/Dockerfile | 8 ++ curvefs/docker/debian10/base/Dockerfile | 36 +++++ curvefs/docker/debian10/base/Makefile | 4 + curvefs/docker/debian10/compile/Dockerfile | 36 +++++ curvefs/docker/debian10/compile/Makefile | 4 + curvefs/docker/{ => debian10}/entrypoint.sh | 0 curvefs/docker/debian11/Dockerfile | 8 ++ curvefs/docker/debian11/base/Dockerfile | 36 +++++ curvefs/docker/debian11/base/Makefile | 4 + curvefs/docker/debian11/compile/Dockerfile | 36 +++++ curvefs/docker/debian11/compile/Makefile | 4 + curvefs/docker/debian11/entrypoint.sh | 120 +++++++++++++++++ curvefs/docker/{ => debian9}/Dockerfile | 0 curvefs/docker/{ => debian9}/base/Dockerfile | 0 curvefs/docker/{ => debian9}/base/Makefile | 0 curvefs/docker/debian9/compile/Dockerfile | 25 ++++ curvefs/docker/debian9/compile/Makefile | 4 + curvefs/docker/debian9/entrypoint.sh | 120 +++++++++++++++++ curvefs/src/client/fuse_common.h | 2 +- curvefs/src/client/s3/client_s3_adaptor.h | 1 - .../src/client/s3/disk_cache_manager_impl.h | 2 - curvefs/test/space/fake_user.cpp | 2 +- curvefs/util/build.sh | 12 +- curvefs/util/image.sh | 7 +- docker/debian10/Dockerfile | 8 ++ docker/debian10/base/Dockerfile | 35 +++++ docker/debian10/base/Makefile | 4 + docker/debian10/compile/Dockerfile | 36 +++++ docker/debian10/compile/Makefile | 4 + docker/{ => debian10}/entrypoint.sh | 0 docker/debian11/Dockerfile | 8 ++ docker/debian11/base/Dockerfile | 35 +++++ docker/debian11/base/Makefile | 4 + docker/debian11/compile/Dockerfile | 36 +++++ docker/debian11/compile/Makefile | 4 + docker/debian11/entrypoint.sh | 127 ++++++++++++++++++ docker/{ => debian9}/Dockerfile | 0 docker/{ => debian9}/base/Dockerfile | 0 docker/{ => debian9}/base/Makefile | 0 docker/debian9/compile/Dockerfile | 25 ++++ docker/debian9/compile/Makefile | 4 + docker/debian9/entrypoint.sh | 127 ++++++++++++++++++ {bazel => external/bazel}/etcdclient.BUILD | 0 {bazel => external/bazel}/gflags.BUILD | 0 {bazel => external/bazel}/glog.BUILD | 0 {bazel => external/bazel}/gmock.BUILD | 0 {bazel => external/bazel}/gtest.BUILD | 0 {bazel => external/bazel}/jsoncpp.BUILD | 0 {bazel => external/bazel}/leveldb.BUILD | 0 replace-curve-repo.sh | 27 +++- src/mds/nameserver2/BUILD | 2 +- test/chunkserver/client.cpp | 2 +- test/chunkserver/server.cpp | 2 +- test/integration/common/BUILD | 1 + test/integration/common/chunkservice_op.cpp | 3 + test/integration/common/peer_cluster.cpp | 6 +- thirdparties/brpc/brpc.patch | 40 ++++++ thirdparties/protobuf/protobuf.patch | 22 +++ util/build.sh | 12 +- util/image.sh | 6 +- 67 files changed, 1109 insertions(+), 66 deletions(-) create mode 100644 .bazelrc create mode 100644 curvefs/docker/debian10/Dockerfile create mode 100644 curvefs/docker/debian10/base/Dockerfile create mode 100644 curvefs/docker/debian10/base/Makefile create mode 100644 curvefs/docker/debian10/compile/Dockerfile create mode 100644 curvefs/docker/debian10/compile/Makefile rename curvefs/docker/{ => debian10}/entrypoint.sh (100%) create mode 100644 curvefs/docker/debian11/Dockerfile create mode 100644 curvefs/docker/debian11/base/Dockerfile create mode 100644 curvefs/docker/debian11/base/Makefile create mode 100644 curvefs/docker/debian11/compile/Dockerfile create mode 100644 curvefs/docker/debian11/compile/Makefile create mode 100755 curvefs/docker/debian11/entrypoint.sh rename curvefs/docker/{ => debian9}/Dockerfile (100%) rename curvefs/docker/{ => debian9}/base/Dockerfile (100%) rename curvefs/docker/{ => debian9}/base/Makefile (100%) create mode 100644 curvefs/docker/debian9/compile/Dockerfile create mode 100644 curvefs/docker/debian9/compile/Makefile create mode 100755 curvefs/docker/debian9/entrypoint.sh create mode 100644 docker/debian10/Dockerfile create mode 100644 docker/debian10/base/Dockerfile create mode 100644 docker/debian10/base/Makefile create mode 100644 docker/debian10/compile/Dockerfile create mode 100644 docker/debian10/compile/Makefile rename docker/{ => debian10}/entrypoint.sh (100%) create mode 100644 docker/debian11/Dockerfile create mode 100644 docker/debian11/base/Dockerfile create mode 100644 docker/debian11/base/Makefile create mode 100644 docker/debian11/compile/Dockerfile create mode 100644 docker/debian11/compile/Makefile create mode 100644 docker/debian11/entrypoint.sh rename docker/{ => debian9}/Dockerfile (100%) rename docker/{ => debian9}/base/Dockerfile (100%) rename docker/{ => debian9}/base/Makefile (100%) create mode 100644 docker/debian9/compile/Dockerfile create mode 100644 docker/debian9/compile/Makefile create mode 100644 docker/debian9/entrypoint.sh rename {bazel => external/bazel}/etcdclient.BUILD (100%) rename {bazel => external/bazel}/gflags.BUILD (100%) rename {bazel => external/bazel}/glog.BUILD (100%) rename {bazel => external/bazel}/gmock.BUILD (100%) rename {bazel => external/bazel}/gtest.BUILD (100%) rename {bazel => external/bazel}/jsoncpp.BUILD (100%) rename {bazel => external/bazel}/leveldb.BUILD (100%) create mode 100644 thirdparties/protobuf/protobuf.patch diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000000..ae4ab8e6b6 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,5 @@ +build --define=with_glog=true --define=libunwind=true +build --copt -DHAVE_ZLIB=1 --copt -DGFLAGS_NS=google --copt -DUSE_BTHREAD_MUTEX +build --cxxopt -Wno-error=format-security +build:gcc7-later --cxxopt -faligned-new +build --incompatible_blacklisted_protos_requires_proto_info=false diff --git a/.bazelversion b/.bazelversion index c3d16c1646..af8c8ec7c1 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -0.17.2 +4.2.2 diff --git a/Makefile b/Makefile index d6ca86677c..5cedc3e134 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,16 @@ release?= 0 only?= "*" tag?= "curvebs:unknown" case?= "*" +os?= "debian9" list: @bash util/build.sh --list build: - @bash util/build.sh --only=$(only) --release=$(release) + @bash util/build.sh --only=$(only) --release=$(release) --os=$(os) install: @bash util/install.sh --prefix=$(prefix) --only=$(only) image: - @bash util/image.sh $(tag) \ No newline at end of file + @bash util/image.sh $(tag) $(os) \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE index 5c4a351f16..aa04127351 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -17,6 +17,20 @@ workspace(name = "curve") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# skylib +http_archive( + name = "bazel_skylib", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz", + ], + sha256 = "af87959afe497dc8dfd4c6cb66e1279cb98ccc84284619ebfec27d9c09a903de", +) +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +bazel_skylib_workspace() git_repository( name = "com_github_baidu_braft", @@ -32,13 +46,30 @@ bind( # proto_library, cc_proto_library, and java_proto_library rules implicitly # depend on @com_google_protobuf for protoc and proto runtimes. # This statement defines the @com_google_protobuf repo. + +# zlib http_archive( - name = "com_google_protobuf", - sha256 = "cef7f1b5a7c5fba672bec2a319246e8feba471f04dcebfe362d55930ee7c1c30", - strip_prefix = "protobuf-3.5.0", - urls = ["https://github.com/google/protobuf/archive/v3.5.0.zip"], + name = "net_zlib", + build_file = "@com_google_protobuf//:third_party/zlib.BUILD", + sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", + strip_prefix = "zlib-1.2.11", + urls = ["https://zlib.net/zlib-1.2.11.tar.gz"], +) + +bind( + name = "zlib", + actual = "@net_zlib//:zlib", ) +http_archive( + name = "com_google_protobuf", + strip_prefix = "protobuf-3.6.1.3", + patch_args = ["-p1"], + patches = ["//:thirdparties/protobuf/protobuf.patch"], + sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2", + urls = ["https://github.com/google/protobuf/archive/v3.6.1.3.zip"], +) + bind( name = "protobuf", actual = "@com_google_protobuf//:protobuf", @@ -76,10 +107,7 @@ bind( http_archive( name = "com_github_gflags_gflags", strip_prefix = "gflags-2.2.2", - urls = [ - "https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz", - "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz", - ], + urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"], ) bind( @@ -87,11 +115,11 @@ bind( actual = "@com_github_gflags_gflags//:gflags", ) -new_http_archive( +http_archive( name = "com_github_google_leveldb", build_file = "bazel/leveldb.BUILD", strip_prefix = "leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6", - url = "https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz", + urls = ["https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz"], ) bind( @@ -142,49 +170,37 @@ bind( new_local_repository( name = "etcdclient", - build_file = "bazel/etcdclient.BUILD", + build_file = "external/bazel/etcdclient.BUILD", path = "thirdparties/etcdclient", ) -new_http_archive( +http_archive( name = "aws", - urls = [ - "https://github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz", - "https://mirror.bazel.build/github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz", - ], + urls = ["https://github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz"], sha256 = "2e82517045efb55409cff1408c12829d9e8aea22c1e2888529cb769b7473b0bf", strip_prefix = "aws-sdk-cpp-1.7.340", build_file = "//:thirdparties/aws/aws.BUILD", ) -new_http_archive( +http_archive( name = "aws_c_common", - urls = [ - "https://github.com/awslabs/aws-c-common/archive/v0.4.29.tar.gz", - "https://mirror.tensorflow.org/github.com/awslabs/aws-c-common/archive/v0.4.29.tar.gz", - ], + urls = ["https://github.com/awslabs/aws-c-common/archive/v0.4.29.tar.gz"], sha256 = "01c2a58553a37b3aa5914d9e0bf7bf14507ff4937bc5872a678892ca20fcae1f", strip_prefix = "aws-c-common-0.4.29", build_file = "//:thirdparties/aws/aws-c-common.BUILD", ) -new_http_archive( +http_archive( name = "aws_c_event_stream", - urls = [ - "https://github.com/awslabs/aws-c-event-stream/archive/v0.1.4.tar.gz", - "https://mirror.tensorflow.org/github.com/awslabs/aws-c-event-stream/archive/v0.1.4.tar.gz", - ], + urls = ["https://github.com/awslabs/aws-c-event-stream/archive/v0.1.4.tar.gz"], sha256 = "31d880d1c868d3f3df1e1f4b45e56ac73724a4dc3449d04d47fc0746f6f077b6", strip_prefix = "aws-c-event-stream-0.1.4", build_file = "//:thirdparties/aws/aws-c-event-stream.BUILD", ) -new_http_archive( +http_archive( name = "aws_checksums", - urls = [ - "https://github.com/awslabs/aws-checksums/archive/v0.1.5.tar.gz", - "https://mirror.tensorflow.org/github.com/awslabs/aws-checksums/archive/v0.1.5.tar.gz", - ], + urls = ["https://github.com/awslabs/aws-checksums/archive/v0.1.5.tar.gz"], sha256 = "6e6bed6f75cf54006b6bafb01b3b96df19605572131a2260fddaf0e87949ced0", strip_prefix = "aws-checksums-0.1.5", build_file = "//:thirdparties/aws/aws-checksums.BUILD", @@ -205,3 +221,11 @@ http_archive( strip_prefix = "abseil-cpp-20210324.2", sha256 = "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f", ) + +# Bazel platform rules. +http_archive( + name = "platforms", + sha256 = "b601beaf841244de5c5a50d2b2eddd34839788000fa1be4260ce6603ca0d8eb7", + strip_prefix = "platforms-98939346da932eef0b54cf808622f5bb0928f00b", + urls = ["https://github.com/bazelbuild/platforms/archive/98939346da932eef0b54cf808622f5bb0928f00b.zip"], +) diff --git a/build.sh b/build.sh index 8d1bbb73d1..9d714c28d6 100644 --- a/build.sh +++ b/build.sh @@ -51,16 +51,16 @@ curve_version=${tag_version}+${commit_id}${debug} #step3 执行编译 -# check bazel verion, bazel vesion must = 0.17.2 +# check bazel verion, bazel vesion must = 4.2.2 bazel_version=`bazel version | grep "Build label" | awk '{print $3}'` if [ -z ${bazel_version} ] then - echo "please install bazel 0.17.2 first" + echo "please install bazel 4.2.2 first" exit fi -if [ ${bazel_version} != "0.17.2" ] +if [ ${bazel_version} != "4.2.2" ] then - echo "bazel version must 0.17.2" + echo "bazel version must 4.2.2" echo "now version is ${bazel_version}" exit fi diff --git a/copts.bzl b/copts.bzl index fa1e08cfac..6362fa90b9 100644 --- a/copts.bzl +++ b/copts.bzl @@ -120,9 +120,8 @@ CURVE_LLVM_FLAGS = [ "-Wvla", "-Wwrite-strings", "-Wno-float-conversion", - "-Wno-implicit-float-conversion", - "-Wno-implicit-int-float-conversion", - "-Wno-implicit-int-conversion", + "-Wno-float-conversion", + "-Wno-float-overflow-conversion", "-Wno-shorten-64-to-32", "-Wno-sign-conversion", "-DNOMINMAX", @@ -146,10 +145,16 @@ CURVE_LLVM_TEST_FLAGS = [ "-Wno-used-but-marked-unused", "-Wno-zero-as-null-pointer-constant", "-Wno-gnu-zero-variadic-macro-arguments", + "-Wbraced-scalar-init", +] + +# FIXME: temporary disabled because triggered in many places +CURVE_LLVM_DISABLED_FLGAS = [ + "-Wno-c++11-narrowing", ] CURVE_DEFAULT_COPTS = select({ - "//:clang_compiler": CURVE_LLVM_FLAGS + CXX_FLAGS + BASE_FLAGS, + "//:clang_compiler": CURVE_LLVM_FLAGS + CXX_FLAGS + BASE_FLAGS + CURVE_LLVM_DISABLED_FLGAS, "//conditions:default": CURVE_GCC_FLAGS + CXX_FLAGS + BASE_FLAGS + CURVE_GCC_DISABLED_FLGAS, }) diff --git a/curvefs/Makefile b/curvefs/Makefile index ed081d66ca..1347878899 100644 --- a/curvefs/Makefile +++ b/curvefs/Makefile @@ -7,6 +7,7 @@ release?= 0 only?= "*" hosts?= "*" tag?= "curvefs:unknown" +os?= "debian9" define deploy_begin @bash util/deploy.sh begin @@ -31,13 +32,13 @@ define only_specify endef build: - @bash util/build.sh --only=$(only) --release=$(release) + @bash util/build.sh --only=$(only) --release=$(release) --os=$(os) install: @bash util/install.sh --prefix=$(prefix) --only=$(only) image: - @bash util/image.sh $(tag) + @bash util/image.sh $(tag) $(os) deploy: $(call deploy_begin) diff --git a/curvefs/docker/debian10/Dockerfile b/curvefs/docker/debian10/Dockerfile new file mode 100644 index 0000000000..cb0e8b22e8 --- /dev/null +++ b/curvefs/docker/debian10/Dockerfile @@ -0,0 +1,8 @@ +FROM opencurvedocker/curve-base:debian10 +ENV TZ=Asia/Shanghai +RUN mkdir -p /curvefs /etc/curvefs /core +COPY curvefs /curvefs +COPY entrypoint.sh / +COPY curvefs/tools/sbin/curvefs_tool /usr/bin +RUN chmod a+x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/curvefs/docker/debian10/base/Dockerfile b/curvefs/docker/debian10/base/Dockerfile new file mode 100644 index 0000000000..a54319e6a3 --- /dev/null +++ b/curvefs/docker/debian10/base/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:10 + +RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + gcc \ + gdb \ + make \ + openssl \ + net-tools \ + libcurl3-gnutls \ + perl \ + linux-perf \ + vim \ + curl \ + cron \ + procps \ + lsof \ + nginx \ + less \ + fuse3 \ + libnl-3-200 \ + libnl-genl-3-200 \ + libjemalloc2 \ + && ln -s /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so + +COPY libetcdclient.so /usr/lib/ \ No newline at end of file diff --git a/curvefs/docker/debian10/base/Makefile b/curvefs/docker/debian10/base/Makefile new file mode 100644 index 0000000000..76b6029c7b --- /dev/null +++ b/curvefs/docker/debian10/base/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:debian10 . diff --git a/curvefs/docker/debian10/compile/Dockerfile b/curvefs/docker/debian10/compile/Dockerfile new file mode 100644 index 0000000000..7d9c36d9a8 --- /dev/null +++ b/curvefs/docker/debian10/compile/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:10 + +RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + wget \ + git \ + gcc \ + g++ \ + clang \ + libssl-dev \ + libnl-genl-3-dev \ + libcurl4-gnutls-dev \ + uuid-dev \ + libfiu-dev \ + libfuse3-dev \ + zlib1g-dev \ + make \ + openjdk-11-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk diff --git a/curvefs/docker/debian10/compile/Makefile b/curvefs/docker/debian10/compile/Makefile new file mode 100644 index 0000000000..09ce5bc7fb --- /dev/null +++ b/curvefs/docker/debian10/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian10 . diff --git a/curvefs/docker/entrypoint.sh b/curvefs/docker/debian10/entrypoint.sh similarity index 100% rename from curvefs/docker/entrypoint.sh rename to curvefs/docker/debian10/entrypoint.sh diff --git a/curvefs/docker/debian11/Dockerfile b/curvefs/docker/debian11/Dockerfile new file mode 100644 index 0000000000..a242925fee --- /dev/null +++ b/curvefs/docker/debian11/Dockerfile @@ -0,0 +1,8 @@ +FROM opencurvedocker/curve-base:debian11 +ENV TZ=Asia/Shanghai +RUN mkdir -p /curvefs /etc/curvefs /core +COPY curvefs /curvefs +COPY entrypoint.sh / +COPY curvefs/tools/sbin/curvefs_tool /usr/bin +RUN chmod a+x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/curvefs/docker/debian11/base/Dockerfile b/curvefs/docker/debian11/base/Dockerfile new file mode 100644 index 0000000000..6aeafd8052 --- /dev/null +++ b/curvefs/docker/debian11/base/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:11 + +RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + gcc \ + gdb \ + make \ + openssl \ + net-tools \ + libcurl3-gnutls \ + perl \ + linux-perf \ + vim \ + curl \ + cron \ + procps \ + lsof \ + nginx \ + less \ + fuse3 \ + libnl-3-200 \ + libnl-genl-3-200 \ + libjemalloc2 \ + && ln -s /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so + +COPY libetcdclient.so /usr/lib/ diff --git a/curvefs/docker/debian11/base/Makefile b/curvefs/docker/debian11/base/Makefile new file mode 100644 index 0000000000..a06c7cb1a1 --- /dev/null +++ b/curvefs/docker/debian11/base/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:debian11 . diff --git a/curvefs/docker/debian11/compile/Dockerfile b/curvefs/docker/debian11/compile/Dockerfile new file mode 100644 index 0000000000..d94d163a08 --- /dev/null +++ b/curvefs/docker/debian11/compile/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:11 + +RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + wget \ + git \ + gcc \ + g++ \ + clang \ + libssl-dev \ + libnl-genl-3-dev \ + libcurl4-gnutls-dev \ + uuid-dev \ + libfiu-dev \ + libfuse3-dev \ + zlib1g-dev \ + make \ + openjdk-11-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk diff --git a/curvefs/docker/debian11/compile/Makefile b/curvefs/docker/debian11/compile/Makefile new file mode 100644 index 0000000000..fc22be12cb --- /dev/null +++ b/curvefs/docker/debian11/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian11 . diff --git a/curvefs/docker/debian11/entrypoint.sh b/curvefs/docker/debian11/entrypoint.sh new file mode 100755 index 0000000000..244d88f783 --- /dev/null +++ b/curvefs/docker/debian11/entrypoint.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc. + +############################ GLOBAL VARIABLES +g_role="" +g_args="" +g_prefix="" +g_binary="" +g_start_args="" + +############################ BASIC FUNCTIONS +function msg() { + printf '%b' "$1" >&2 +} + +function success() { + msg "\33[32m[✔]\33[0m ${1}${2}" +} + +function die() { + msg "\33[31m[✘]\33[0m ${1}${2}" + exit 1 +} + +############################ FUNCTIONS +function usage () { + cat << _EOC_ +Usage: + entrypoint.sh --role=ROLE + entrypoint.sh --role=ROLE --args=ARGS + +Examples: + entrypoint.sh --role=etcd + entrypoint.sh --role=client --args="-o default_permissions" +_EOC_ +} + +function get_options() { + local long_opts="role:,args:,help" + local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"` + eval set -- "${args}" + while true + do + case "$1" in + -r|--role) + g_role=$2 + shift 2 + ;; + -a|--args) + g_args=$2 + shift 2 + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + exit 1 + ;; + esac + done +} + +function prepare() { + g_prefix="/curvefs/$g_role" + conf_path="$g_prefix/conf/$g_role.conf" + + case $g_role in + etcd) + g_binary="$g_prefix/sbin/etcd" + g_start_args="--config-file $conf_path" + ;; + mds) + g_binary="$g_prefix/sbin/curvefs-mds" + g_start_args="--confPath $conf_path" + ;; + metaserver) + g_binary="$g_prefix/sbin/curvefs-metaserver" + g_start_args="--confPath $conf_path" + ;; + client) + g_binary="$g_prefix/sbin/curve-fuse" + g_start_args="--confPath $conf_path" + ;; + *) + usage + exit 1 + ;; + esac + + if [ "$g_args" != "" ]; then + g_start_args=$g_args + fi +} + +function create_directory() { + chmod 700 "$g_prefix/data" + if [ "$g_role" == "etcd" ]; then + mkdir -p "$g_prefix/data/wal" + elif [ "$g_role" == "client" ]; then + mkdir -p "$g_prefix/mnt" + fi +} + +function main() { + get_options "$@" + + prepare + create_directory + [[ $(command -v crontab) ]] && cron + exec $g_binary $g_start_args +} + +############################ MAIN() +main "$@" diff --git a/curvefs/docker/Dockerfile b/curvefs/docker/debian9/Dockerfile similarity index 100% rename from curvefs/docker/Dockerfile rename to curvefs/docker/debian9/Dockerfile diff --git a/curvefs/docker/base/Dockerfile b/curvefs/docker/debian9/base/Dockerfile similarity index 100% rename from curvefs/docker/base/Dockerfile rename to curvefs/docker/debian9/base/Dockerfile diff --git a/curvefs/docker/base/Makefile b/curvefs/docker/debian9/base/Makefile similarity index 100% rename from curvefs/docker/base/Makefile rename to curvefs/docker/debian9/base/Makefile diff --git a/curvefs/docker/debian9/compile/Dockerfile b/curvefs/docker/debian9/compile/Dockerfile new file mode 100644 index 0000000000..0e0a948071 --- /dev/null +++ b/curvefs/docker/debian9/compile/Dockerfile @@ -0,0 +1,25 @@ +FROM opencurvedocker/curve-base:debian9 + +RUN apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + g++ \ + wget \ + clang \ + git \ + libnl-genl-3-dev \ + libssl-dev \ + uuid-dev \ + zlib1g-dev \ + libcurl4-gnutls-dev \ + libfiu-dev \ + openjdk-8-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk +COPY fuse3/* /usr/include/fuse3/ diff --git a/curvefs/docker/debian9/compile/Makefile b/curvefs/docker/debian9/compile/Makefile new file mode 100644 index 0000000000..e6eaf82596 --- /dev/null +++ b/curvefs/docker/debian9/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian9 . diff --git a/curvefs/docker/debian9/entrypoint.sh b/curvefs/docker/debian9/entrypoint.sh new file mode 100755 index 0000000000..244d88f783 --- /dev/null +++ b/curvefs/docker/debian9/entrypoint.sh @@ -0,0 +1,120 @@ +#!/usr/bin/env bash + +# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc. + +############################ GLOBAL VARIABLES +g_role="" +g_args="" +g_prefix="" +g_binary="" +g_start_args="" + +############################ BASIC FUNCTIONS +function msg() { + printf '%b' "$1" >&2 +} + +function success() { + msg "\33[32m[✔]\33[0m ${1}${2}" +} + +function die() { + msg "\33[31m[✘]\33[0m ${1}${2}" + exit 1 +} + +############################ FUNCTIONS +function usage () { + cat << _EOC_ +Usage: + entrypoint.sh --role=ROLE + entrypoint.sh --role=ROLE --args=ARGS + +Examples: + entrypoint.sh --role=etcd + entrypoint.sh --role=client --args="-o default_permissions" +_EOC_ +} + +function get_options() { + local long_opts="role:,args:,help" + local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"` + eval set -- "${args}" + while true + do + case "$1" in + -r|--role) + g_role=$2 + shift 2 + ;; + -a|--args) + g_args=$2 + shift 2 + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + exit 1 + ;; + esac + done +} + +function prepare() { + g_prefix="/curvefs/$g_role" + conf_path="$g_prefix/conf/$g_role.conf" + + case $g_role in + etcd) + g_binary="$g_prefix/sbin/etcd" + g_start_args="--config-file $conf_path" + ;; + mds) + g_binary="$g_prefix/sbin/curvefs-mds" + g_start_args="--confPath $conf_path" + ;; + metaserver) + g_binary="$g_prefix/sbin/curvefs-metaserver" + g_start_args="--confPath $conf_path" + ;; + client) + g_binary="$g_prefix/sbin/curve-fuse" + g_start_args="--confPath $conf_path" + ;; + *) + usage + exit 1 + ;; + esac + + if [ "$g_args" != "" ]; then + g_start_args=$g_args + fi +} + +function create_directory() { + chmod 700 "$g_prefix/data" + if [ "$g_role" == "etcd" ]; then + mkdir -p "$g_prefix/data/wal" + elif [ "$g_role" == "client" ]; then + mkdir -p "$g_prefix/mnt" + fi +} + +function main() { + get_options "$@" + + prepare + create_directory + [[ $(command -v crontab) ]] && cron + exec $g_binary $g_start_args +} + +############################ MAIN() +main "$@" diff --git a/curvefs/src/client/fuse_common.h b/curvefs/src/client/fuse_common.h index b7b151894d..0e5de58255 100644 --- a/curvefs/src/client/fuse_common.h +++ b/curvefs/src/client/fuse_common.h @@ -27,7 +27,7 @@ #define FUSE_USE_VERSION 34 #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/curvefs/src/client/s3/client_s3_adaptor.h b/curvefs/src/client/s3/client_s3_adaptor.h index 17a236e1e0..32233de1eb 100644 --- a/curvefs/src/client/s3/client_s3_adaptor.h +++ b/curvefs/src/client/s3/client_s3_adaptor.h @@ -45,7 +45,6 @@ namespace curvefs { namespace client { using ::curve::common::Thread; -using curvefs::client::common::S3ClientAdaptorOption; using curvefs::client::common::DiskCacheType; using curvefs::metaserver::Inode; using curvefs::metaserver::S3ChunkInfo; diff --git a/curvefs/src/client/s3/disk_cache_manager_impl.h b/curvefs/src/client/s3/disk_cache_manager_impl.h index d29e499001..befc9ac98e 100644 --- a/curvefs/src/client/s3/disk_cache_manager_impl.h +++ b/curvefs/src/client/s3/disk_cache_manager_impl.h @@ -43,8 +43,6 @@ namespace client { using curvefs::common::PosixWrapper; -class S3ClientAdaptorOption; - struct DiskCacheOption { DiskCacheType diskCacheType; uint64_t trimCheckIntervalSec; diff --git a/curvefs/test/space/fake_user.cpp b/curvefs/test/space/fake_user.cpp index b6fc5d7065..c6fc3788cf 100644 --- a/curvefs/test/space/fake_user.cpp +++ b/curvefs/test/space/fake_user.cpp @@ -145,7 +145,7 @@ void Init() { } void Run() { - thread_local unsigned int seed = time(nullptr); + static thread_local unsigned int seed = time(nullptr); while (true) { if (rand_r(&seed) % 4 == 0 || noSpace.load(std::memory_order_relaxed) == true) { diff --git a/curvefs/util/build.sh b/curvefs/util/build.sh index 32420ef044..17da6d25cf 100644 --- a/curvefs/util/build.sh +++ b/curvefs/util/build.sh @@ -17,6 +17,8 @@ g_build_opts=( "--copt -DUSE_BTHREAD_MUTEX" ) +g_os="debian9" + ############################ BASIC FUNCTIONS get_version() { #get tag version @@ -81,7 +83,7 @@ _EOC_ } get_options() { - local args=`getopt -o lorh --long list,only:,release: -n "$0" -- "$@"` + local args=`getopt -o lorh --long list,only:,os:,release: -n "$0" -- "$@"` eval set -- "${args}" while true do @@ -98,6 +100,10 @@ get_options() { g_release=$2 shift 2 ;; + --os) + g_os=$2 + shift 2 + ;; -h) usage exit 1 @@ -137,6 +143,10 @@ build_target() { # set version g_build_opts+=("--copt -DCURVEVERSION=${curve_version}") + if [ "$g_os" == "debian10" -o "$g_os" == "debian11" ]; then + g_build_opts+=("--config=gcc7-later") + fi + for target in `get_target` do bazel build ${g_build_opts[@]} $target diff --git a/curvefs/util/image.sh b/curvefs/util/image.sh index d869b0ec9a..d1e7948b68 100644 --- a/curvefs/util/image.sh +++ b/curvefs/util/image.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash # tmpl.sh = /usr/local/metaserver.conf /tmp/metaserver.conf +# $1: tag $2: os function tmpl() { dsv=$1 src=$2 @@ -15,7 +16,7 @@ function tmpl() { done < $src > $dst } -prefix="$(pwd)/docker/curvefs" +prefix="$(pwd)/docker/$2/curvefs" mkdir -p $prefix $prefix/conf make install prefix="$prefix" make install prefix="$prefix" only=etcd @@ -29,5 +30,5 @@ do tmpl $dsv "conf/$file" "$prefix/conf/$file" done -docker pull opencurvedocker/curve-base:debian9 -docker build -t "$1" "$(pwd)/docker" +docker pull opencurvedocker/curve-base:$2 +docker build -t "$1" "$(pwd)/docker/$2" diff --git a/docker/debian10/Dockerfile b/docker/debian10/Dockerfile new file mode 100644 index 0000000000..44d4f0f81d --- /dev/null +++ b/docker/debian10/Dockerfile @@ -0,0 +1,8 @@ +FROM opencurvedocker/curve-base:debian10 +ENV TZ=Asia/Shanghai +RUN mkdir -p /curvebs /etc/curve /etc/nebd /core +COPY curvebs /curvebs +COPY entrypoint.sh exec.sh / +COPY curvebs/tools/sbin/curve_ops_tool curvebs/nbd/sbin/curve-nbd /usr/bin/ +RUN chmod a+x /entrypoint.sh /exec.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/debian10/base/Dockerfile b/docker/debian10/base/Dockerfile new file mode 100644 index 0000000000..608f3e21c6 --- /dev/null +++ b/docker/debian10/base/Dockerfile @@ -0,0 +1,35 @@ +FROM debian:10 + +RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + gcc \ + gdb \ + make \ + openssl \ + net-tools \ + libcurl3-gnutls \ + perl \ + linux-perf \ + vim \ + curl \ + cron \ + procps \ + lsof \ + nginx \ + less \ + fuse \ + libnl-3-200 \ + libnl-genl-3-200 \ + libjemalloc2 + +COPY libetcdclient.so /usr/lib/ diff --git a/docker/debian10/base/Makefile b/docker/debian10/base/Makefile new file mode 100644 index 0000000000..76b6029c7b --- /dev/null +++ b/docker/debian10/base/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:debian10 . diff --git a/docker/debian10/compile/Dockerfile b/docker/debian10/compile/Dockerfile new file mode 100644 index 0000000000..7d9c36d9a8 --- /dev/null +++ b/docker/debian10/compile/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:10 + +RUN echo "deb http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + wget \ + git \ + gcc \ + g++ \ + clang \ + libssl-dev \ + libnl-genl-3-dev \ + libcurl4-gnutls-dev \ + uuid-dev \ + libfiu-dev \ + libfuse3-dev \ + zlib1g-dev \ + make \ + openjdk-11-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk diff --git a/docker/debian10/compile/Makefile b/docker/debian10/compile/Makefile new file mode 100644 index 0000000000..09ce5bc7fb --- /dev/null +++ b/docker/debian10/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian10 . diff --git a/docker/entrypoint.sh b/docker/debian10/entrypoint.sh similarity index 100% rename from docker/entrypoint.sh rename to docker/debian10/entrypoint.sh diff --git a/docker/debian11/Dockerfile b/docker/debian11/Dockerfile new file mode 100644 index 0000000000..a242925fee --- /dev/null +++ b/docker/debian11/Dockerfile @@ -0,0 +1,8 @@ +FROM opencurvedocker/curve-base:debian11 +ENV TZ=Asia/Shanghai +RUN mkdir -p /curvefs /etc/curvefs /core +COPY curvefs /curvefs +COPY entrypoint.sh / +COPY curvefs/tools/sbin/curvefs_tool /usr/bin +RUN chmod a+x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/debian11/base/Dockerfile b/docker/debian11/base/Dockerfile new file mode 100644 index 0000000000..2058279335 --- /dev/null +++ b/docker/debian11/base/Dockerfile @@ -0,0 +1,35 @@ +FROM debian:11 + +RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + gcc \ + gdb \ + make \ + openssl \ + net-tools \ + libcurl3-gnutls \ + perl \ + linux-perf \ + vim \ + curl \ + cron \ + procps \ + lsof \ + nginx \ + less \ + fuse \ + libnl-3-200 \ + libnl-genl-3-200 \ + libjemalloc2 + +COPY libetcdclient.so /usr/lib/ \ No newline at end of file diff --git a/docker/debian11/base/Makefile b/docker/debian11/base/Makefile new file mode 100644 index 0000000000..a06c7cb1a1 --- /dev/null +++ b/docker/debian11/base/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:debian11 . diff --git a/docker/debian11/compile/Dockerfile b/docker/debian11/compile/Dockerfile new file mode 100644 index 0000000000..d94d163a08 --- /dev/null +++ b/docker/debian11/compile/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:11 + +RUN echo "deb http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib\n" \ + "deb-src http://mirrors.163.com/debian-security/ stable-security main non-free contrib\n" \ + > /etc/apt/sources.list \ + && apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + wget \ + git \ + gcc \ + g++ \ + clang \ + libssl-dev \ + libnl-genl-3-dev \ + libcurl4-gnutls-dev \ + uuid-dev \ + libfiu-dev \ + libfuse3-dev \ + zlib1g-dev \ + make \ + openjdk-11-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk diff --git a/docker/debian11/compile/Makefile b/docker/debian11/compile/Makefile new file mode 100644 index 0000000000..fc22be12cb --- /dev/null +++ b/docker/debian11/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian11 . diff --git a/docker/debian11/entrypoint.sh b/docker/debian11/entrypoint.sh new file mode 100644 index 0000000000..8614954fe5 --- /dev/null +++ b/docker/debian11/entrypoint.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash + +# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc. + +############################ GLOBAL VARIABLES +g_role="" +g_args="" +g_prefix="" +g_preexec="" +g_binary="" +g_start_args="" + +############################ BASIC FUNCTIONS +function msg() { + printf '%b' "$1" >&2 +} + +function success() { + msg "\33[32m[✔]\33[0m ${1}${2}" +} + +function die() { + msg "\33[31m[✘]\33[0m ${1}${2}" + exit 1 +} + +############################ FUNCTIONS +function usage () { + cat << _EOC_ +Usage: + entrypoint.sh --role=ROLE + entrypoint.sh --role=ROLE --args=ARGS + +Examples: + entrypoint.sh --role=etcd + entrypoint.sh --role=client --args="-o default_permissions" +_EOC_ +} + +function get_options() { + local long_opts="role:,args:,help" + local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"` + eval set -- "${args}" + while true + do + case "$1" in + -r|--role) + g_role=$2 + shift 2 + ;; + -a|--args) + g_args=$2 + shift 2 + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + exit 1 + ;; + esac + done +} + +function prepare() { + g_prefix="/curvebs/$g_role" + conf_path="$g_prefix/conf/$g_role.conf" + + case $g_role in + etcd) + g_binary="$g_prefix/sbin/etcd" + g_start_args="--config-file $conf_path" + ;; + mds) + g_binary="$g_prefix/sbin/curvebs-mds" + g_start_args="--confPath $conf_path" + ;; + chunkserver) + g_binary="$g_prefix/sbin/curvebs-chunkserver" + g_start_args="--conf=$conf_path" + ;; + snapshotclone) + g_preexec="/usr/sbin/nginx -c $g_prefix/conf/nginx.conf" + g_binary="$g_prefix/sbin/curvebs-snapshotclone" + g_start_args="--conf=$conf_path" + ;; + nebd) + g_binary="$g_prefix/sbin/nebd-server" + g_start_args="-confPath=$g_prefix/conf/nebd-server.conf -log_dir=$g_prefix/logs" + ;; + *) + usage + exit 1 + ;; + esac + + if [ "$g_args" != "" ]; then + g_start_args=$g_args + fi +} + +function create_directory() { + chmod 700 "$g_prefix/data" + if [ "$g_role" == "etcd" ]; then + mkdir -p "$g_prefix/data/wal" + elif [ "$g_role" == "client" ]; then + mkdir -p "$g_prefix/mnt" + fi +} + +function main() { + get_options "$@" + + prepare + create_directory + [[ $(command -v crontab) ]] && cron + [[ ! -z $g_preexec ]] && $g_preexec + exec $g_binary $g_start_args +} + +############################ MAIN() +main "$@" diff --git a/docker/Dockerfile b/docker/debian9/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/debian9/Dockerfile diff --git a/docker/base/Dockerfile b/docker/debian9/base/Dockerfile similarity index 100% rename from docker/base/Dockerfile rename to docker/debian9/base/Dockerfile diff --git a/docker/base/Makefile b/docker/debian9/base/Makefile similarity index 100% rename from docker/base/Makefile rename to docker/debian9/base/Makefile diff --git a/docker/debian9/compile/Dockerfile b/docker/debian9/compile/Dockerfile new file mode 100644 index 0000000000..0e0a948071 --- /dev/null +++ b/docker/debian9/compile/Dockerfile @@ -0,0 +1,25 @@ +FROM opencurvedocker/curve-base:debian9 + +RUN apt-get clean \ + && apt-get -y update \ + && apt-get -y install \ + g++ \ + wget \ + clang \ + git \ + libnl-genl-3-dev \ + libssl-dev \ + uuid-dev \ + zlib1g-dev \ + libcurl4-gnutls-dev \ + libfiu-dev \ + openjdk-8-jdk \ + sudo \ + && wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 \ + && mv bazelisk-linux-amd64 /usr/bin/bazelisk \ + && ln -s /usr/bin/bazelisk /usr/bin/bazel \ + && wget https://github.com/bazelbuild/bazel/releases/download/4.2.2/bazel-4.2.2-linux-x86_64 \ + && mkdir -p /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin \ + && mv bazel-4.2.2-linux-x86_64 /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel \ + && chmod +x /root/.cache/bazelisk/downloads/bazelbuild/bazel-4.2.2-linux-x86_64/bin/bazel /usr/bin/bazel /usr/bin/bazelisk +COPY fuse3/* /usr/include/fuse3/ diff --git a/docker/debian9/compile/Makefile b/docker/debian9/compile/Makefile new file mode 100644 index 0000000000..e6eaf82596 --- /dev/null +++ b/docker/debian9/compile/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + docker build -t opencurvedocker/curve-base:build-debian9 . diff --git a/docker/debian9/entrypoint.sh b/docker/debian9/entrypoint.sh new file mode 100644 index 0000000000..8614954fe5 --- /dev/null +++ b/docker/debian9/entrypoint.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash + +# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc. + +############################ GLOBAL VARIABLES +g_role="" +g_args="" +g_prefix="" +g_preexec="" +g_binary="" +g_start_args="" + +############################ BASIC FUNCTIONS +function msg() { + printf '%b' "$1" >&2 +} + +function success() { + msg "\33[32m[✔]\33[0m ${1}${2}" +} + +function die() { + msg "\33[31m[✘]\33[0m ${1}${2}" + exit 1 +} + +############################ FUNCTIONS +function usage () { + cat << _EOC_ +Usage: + entrypoint.sh --role=ROLE + entrypoint.sh --role=ROLE --args=ARGS + +Examples: + entrypoint.sh --role=etcd + entrypoint.sh --role=client --args="-o default_permissions" +_EOC_ +} + +function get_options() { + local long_opts="role:,args:,help" + local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"` + eval set -- "${args}" + while true + do + case "$1" in + -r|--role) + g_role=$2 + shift 2 + ;; + -a|--args) + g_args=$2 + shift 2 + ;; + -h) + usage + exit 1 + ;; + --) + shift + break + ;; + *) + exit 1 + ;; + esac + done +} + +function prepare() { + g_prefix="/curvebs/$g_role" + conf_path="$g_prefix/conf/$g_role.conf" + + case $g_role in + etcd) + g_binary="$g_prefix/sbin/etcd" + g_start_args="--config-file $conf_path" + ;; + mds) + g_binary="$g_prefix/sbin/curvebs-mds" + g_start_args="--confPath $conf_path" + ;; + chunkserver) + g_binary="$g_prefix/sbin/curvebs-chunkserver" + g_start_args="--conf=$conf_path" + ;; + snapshotclone) + g_preexec="/usr/sbin/nginx -c $g_prefix/conf/nginx.conf" + g_binary="$g_prefix/sbin/curvebs-snapshotclone" + g_start_args="--conf=$conf_path" + ;; + nebd) + g_binary="$g_prefix/sbin/nebd-server" + g_start_args="-confPath=$g_prefix/conf/nebd-server.conf -log_dir=$g_prefix/logs" + ;; + *) + usage + exit 1 + ;; + esac + + if [ "$g_args" != "" ]; then + g_start_args=$g_args + fi +} + +function create_directory() { + chmod 700 "$g_prefix/data" + if [ "$g_role" == "etcd" ]; then + mkdir -p "$g_prefix/data/wal" + elif [ "$g_role" == "client" ]; then + mkdir -p "$g_prefix/mnt" + fi +} + +function main() { + get_options "$@" + + prepare + create_directory + [[ $(command -v crontab) ]] && cron + [[ ! -z $g_preexec ]] && $g_preexec + exec $g_binary $g_start_args +} + +############################ MAIN() +main "$@" diff --git a/bazel/etcdclient.BUILD b/external/bazel/etcdclient.BUILD similarity index 100% rename from bazel/etcdclient.BUILD rename to external/bazel/etcdclient.BUILD diff --git a/bazel/gflags.BUILD b/external/bazel/gflags.BUILD similarity index 100% rename from bazel/gflags.BUILD rename to external/bazel/gflags.BUILD diff --git a/bazel/glog.BUILD b/external/bazel/glog.BUILD similarity index 100% rename from bazel/glog.BUILD rename to external/bazel/glog.BUILD diff --git a/bazel/gmock.BUILD b/external/bazel/gmock.BUILD similarity index 100% rename from bazel/gmock.BUILD rename to external/bazel/gmock.BUILD diff --git a/bazel/gtest.BUILD b/external/bazel/gtest.BUILD similarity index 100% rename from bazel/gtest.BUILD rename to external/bazel/gtest.BUILD diff --git a/bazel/jsoncpp.BUILD b/external/bazel/jsoncpp.BUILD similarity index 100% rename from bazel/jsoncpp.BUILD rename to external/bazel/jsoncpp.BUILD diff --git a/bazel/leveldb.BUILD b/external/bazel/leveldb.BUILD similarity index 100% rename from bazel/leveldb.BUILD rename to external/bazel/leveldb.BUILD diff --git a/replace-curve-repo.sh b/replace-curve-repo.sh index d3437f2809..86a9d320b8 100644 --- a/replace-curve-repo.sh +++ b/replace-curve-repo.sh @@ -8,14 +8,17 @@ sed -i "s;https://github.com/etcd-io/etcd;https://gitee.com/mirrors/etcd;g" thir # braft sed -i "s;https://github.com/baidu/braft;https://gitee.com/baidu/braft;g" WORKSPACE +# zlib +sed -i "s;https://zlib.net/zlib-1.2.11.tar.gz;https://curve-build.nos-eastchina1.126.net/zlib-1.2.11.tar.gz;g" WORKSPACE + # protobuf -sed -i "s;https://github.com/google/protobuf/archive/v3.5.0.zip;https://curve-build.nos-eastchina1.126.net/protobuf-3.5.0.zip;g" WORKSPACE +sed -i "s;https://github.com/google/protobuf/archive/v3.6.1.3.zip;https://curve-build.nos-eastchina1.126.net/protobuf-3.6.1.3.zip;g" WORKSPACE # googletest sed -i "s;https://github.com/google/googletest;https://gitee.com/mirrors/googletest;g" WORKSPACE # gflags -sed -i "s;https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz;https://curve-build.nos-eastchina1.126.net/gflags-2.2.2.tar.gz;g" WORKSPACE +sed -i "s;https://github.com/gflags/gflags/archive/v2.2.2.tar.gz;https://curve-build.nos-eastchina1.126.net/gflags-2.2.2.tar.gz;g" WORKSPACE # leveldb sed -i "s;https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz;https://curve-build.nos-eastchina1.126.net/leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz;g" WORKSPACE @@ -26,8 +29,26 @@ sed -i "s;https://github.com/apache/incubator-brpc;https://gitee.com/baidu/BRPC; # jsoncpp sed -i "s;https://github.com/open-source-parsers/jsoncpp.git;https://gitee.com/mirrors/jsoncpp;g" WORKSPACE -# aws +# aws-sdk-cpp sed -i "s;https://github.com/aws/aws-sdk-cpp/archive/1.7.340.tar.gz;https://curve-build.nos-eastchina1.126.net/aws-sdk-cpp-1.7.340.tar.gz;g" WORKSPACE # glog sed -i "s;https://github.com/google/glog;https://gitee.com/mirrors/glog;g" WORKSPACE + +# aws_c_common +sed -i "s;https://github.com/awslabs/aws-c-common/archive/v0.4.29.tar.gz;https://curve-build.nos-eastchina1.126.net/aws-c-common-0.4.29.tar.gz;g" WORKSPACE + +# aws_c_event_stream +sed -i "s;https://github.com/awslabs/aws-c-event-stream/archive/v0.1.4.tar.gz;https://curve-build.nos-eastchina1.126.net/aws-c-event-stream-0.1.4.tar.gz;g" WORKSPACE + +# aws_checksums +sed -i "s;https://github.com/awslabs/aws-checksums/archive/v0.1.5.tar.gz;https://curve-build.nos-eastchina1.126.net/aws-checksums-0.1.5.tar.gz;g" WORKSPACE + +# abseil-cpp +sed -i "s;https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.2.tar.gz;https://curve-build.nos-eastchina1.126.net/abseil-cpp-20210324.2.tar.gz;g" WORKSPACE + +# platforms +sed -i "s;https://github.com/bazelbuild/platforms/archive/98939346da932eef0b54cf808622f5bb0928f00b.zip;https://curve-build.nos-eastchina1.126.net/platforms-98939346da932eef0b54cf808622f5bb0928f00b.zip;g" WORKSPACE + +# rules_cc +sed -i "s;https://github.com/bazelbuild/platforms/archive/98939346da932eef0b54cf808622f5bb0928f00b.zip;https://curve-build.nos-eastchina1.126.net/rules_cc-9e10b8a6db775b1ecd358d8ddd3dab379a2c29a5.zip;g" WORKSPACE diff --git a/src/mds/nameserver2/BUILD b/src/mds/nameserver2/BUILD index 62f30f6b83..33c22d5096 100644 --- a/src/mds/nameserver2/BUILD +++ b/src/mds/nameserver2/BUILD @@ -21,7 +21,7 @@ cc_library( srcs = glob(["*.cpp"]), hdrs = glob(["*.h"]), copts = CURVE_DEFAULT_COPTS + [ - "-Wno-write-strings" + "-Wno-write-strings", ], visibility = ["//visibility:public"], deps = [ diff --git a/test/chunkserver/client.cpp b/test/chunkserver/client.cpp index a498593bd1..e66bc9b5e5 100644 --- a/test/chunkserver/client.cpp +++ b/test/chunkserver/client.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { uint64_t sn = 1; char fillCh = 'a'; PeerId leader; - Configuration conf; + curve::chunkserver::Configuration conf; if (0 != conf.parse_from(FLAGS_confs)) { LOG(FATAL) << "conf parse failed: " << FLAGS_confs; diff --git a/test/chunkserver/server.cpp b/test/chunkserver/server.cpp index 59f701cd5a..d0bebeec1f 100644 --- a/test/chunkserver/server.cpp +++ b/test/chunkserver/server.cpp @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) { LOG_IF(FATAL, false == copysetNodeOptions.concurrentapply->Init(opt)) << "Failed to init concurrent apply module"; - Configuration conf; + curve::chunkserver::Configuration conf; if (conf.parse_from(FLAGS_conf) != 0) { LOG(ERROR) << "Fail to parse configuration `" << FLAGS_conf << '\''; return -1; diff --git a/test/integration/common/BUILD b/test/integration/common/BUILD index 7d2870119e..3961c0bad1 100644 --- a/test/integration/common/BUILD +++ b/test/integration/common/BUILD @@ -40,5 +40,6 @@ cc_library( "//src/common:curve_common", "//test/util:test_util", "@com_google_googletest//:gtest", + "//include:include-common", ], ) diff --git a/test/integration/common/chunkservice_op.cpp b/test/integration/common/chunkservice_op.cpp index db4710edfa..353a0746e7 100644 --- a/test/integration/common/chunkservice_op.cpp +++ b/test/integration/common/chunkservice_op.cpp @@ -23,6 +23,8 @@ #include "test/integration/common/chunkservice_op.h" #include "proto/chunk.pb.h" +#include "include/curve_compiler_specific.h" + namespace curve { namespace chunkserver { @@ -305,6 +307,7 @@ int ChunkServiceOp::GetChunkInfo(struct ChunkServiceOpConf *opConf, switch (response.chunksn().size()) { case 2: *snapSn = response.chunksn(1); + FALLTHROUGH_INTENDED; case 1: *curSn = response.chunksn(0); break; diff --git a/test/integration/common/peer_cluster.cpp b/test/integration/common/peer_cluster.cpp index 5d8ffaa603..741a83923e 100644 --- a/test/integration/common/peer_cluster.cpp +++ b/test/integration/common/peer_cluster.cpp @@ -769,9 +769,9 @@ void CopysetStatusVerify(const std::vector &peers, cntl.set_timeout_ms(2000); request.set_logicpoolid(logicPoolID); request.set_copysetid(copysetId); - Peer *peer = new Peer(); - request.set_allocated_peer(peer); - peer->set_address(peerId.to_string()); + Peer *peerP = new Peer(); + request.set_allocated_peer(peerP); + peerP->set_address(peerId.to_string()); request.set_queryhash(true); stub.GetCopysetStatus(&cntl, &request, &response, nullptr); LOG_IF(INFO, cntl.Failed()) << cntl.ErrorText(); diff --git a/thirdparties/brpc/brpc.patch b/thirdparties/brpc/brpc.patch index a9a8f2d5e3..0799d8b281 100644 --- a/thirdparties/brpc/brpc.patch +++ b/thirdparties/brpc/brpc.patch @@ -3216,3 +3216,43 @@ index 08d0bfc..77a1bab 100644 } // namespace logging +} // namespace butil #endif +diff --git a/src/bvar/scoped_timer.h b/src/bvar/scoped_timer.h +index 34de59fb..7ad92c5d 100644 +--- a/src/bvar/scoped_timer.h ++++ b/src/bvar/scoped_timer.h +@@ -49,7 +49,7 @@ public: + + private: + DISALLOW_COPY_AND_ASSIGN(ScopedTimer); +- const int64_t _start_time; ++ int64_t _start_time; + T* _bvar; + }; + } // namespace bvar +diff --git a/src/butil/thread_local.h b/src/butil/thread_local.h +index fc8bdf2c..020d5316 100644 +--- a/src/butil/thread_local.h ++++ b/src/butil/thread_local.h +@@ -22,22 +22,6 @@ + #include // NULL + #include "butil/macros.h" + +-// Provide thread_local keyword (for primitive types) before C++11 +-// DEPRECATED: define this keyword before C++11 might make the variable ABI +-// incompatible between C++11 and C++03 +-#if !defined(thread_local) && \ +- (__cplusplus < 201103L || \ +- (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800) +-// GCC supports thread_local keyword of C++11 since 4.8.0 +-#ifdef _MSC_VER +-// WARNING: don't use this macro in C++03 +-#define thread_local __declspec(thread) +-#else +-// WARNING: don't use this macro in C++03 +-#define thread_local __thread +-#endif // _MSC_VER +-#endif +- + #ifdef _MSC_VER + #define BAIDU_THREAD_LOCAL __declspec(thread) + #else diff --git a/thirdparties/protobuf/protobuf.patch b/thirdparties/protobuf/protobuf.patch new file mode 100644 index 0000000000..48ba89187f --- /dev/null +++ b/thirdparties/protobuf/protobuf.patch @@ -0,0 +1,22 @@ +diff --git a/protobuf.bzl b/protobuf.bzl +index 4226a1424..36c325aa9 100644 +--- a/protobuf.bzl ++++ b/protobuf.bzl +@@ -105,7 +105,7 @@ def _proto_gen_impl(ctx): + inputs += [plugin] + + if args: +- ctx.action( ++ ctx.actions.run( + inputs=inputs, + outputs=ctx.outputs.outs, + arguments=args + import_flags + [s.path for s in srcs], +@@ -130,7 +130,7 @@ proto_gen = rule( + "protoc": attr.label( + cfg = "host", + executable = True, +- single_file = True, ++ allow_single_file = True, + mandatory = True, + ), + "plugin": attr.label( diff --git a/util/build.sh b/util/build.sh index 122f51defe..991b4c7065 100644 --- a/util/build.sh +++ b/util/build.sh @@ -15,6 +15,8 @@ g_build_opts=( "--copt -DUSE_BTHREAD_MUTEX" ) +g_os="debian9" + ############################ BASIC FUNCTIONS msg() { printf '%b' "$1" >&2 @@ -49,7 +51,7 @@ _EOC_ } get_options() { - local args=`getopt -o lorh --long list,only:,release: -n "$0" -- "$@"` + local args=`getopt -o lorh --long list,only:,os:,release: -n "$0" -- "$@"` eval set -- "${args}" while true do @@ -66,6 +68,10 @@ get_options() { g_release=$2 shift 2 ;; + --os) + g_os=$2 + shift 2 + ;; -h) usage exit 1 @@ -113,6 +119,10 @@ build_target() { echo "debug" > .BUILD_MODE fi g_build_opts+=("--copt -DCURVEVERSION=${version}") + + if [ "$g_os" == "debian10" -o "$g_os" == "debian11" ]; then + g_build_opts+=("--config=gcc7-later") + fi for target in `get_target` do diff --git a/util/image.sh b/util/image.sh index dbe9c1f8fd..508dae2072 100644 --- a/util/image.sh +++ b/util/image.sh @@ -15,7 +15,7 @@ function tmpl() { done < $src > $dst } -prefix="$(pwd)/docker/curvebs" +prefix="$(pwd)/docker/$2/curvebs" mkdir -p $prefix $prefix/conf make install prefix="$prefix" make install prefix="$prefix" only=etcd @@ -39,5 +39,5 @@ do tmpl $dsv "$dir/$file" "$prefix/conf/$dst" done -docker pull opencurvedocker/curve-base:debian9 -docker build -t "$1" "$(pwd)/docker" +docker pull opencurvedocker/curve-base:$2 +docker build -t "$1" "$(pwd)/docker/$2"