-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): build and push images from libcstor (#70)
Signed-off-by: mittachaitu <[email protected]>
- Loading branch information
sai chaithanya
authored
Sep 9, 2020
1 parent
41f08fd
commit c35e678
Showing
27 changed files
with
912 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,28 @@ | ||
# Copyright © 2020 The OpenEBS 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. | ||
|
||
ACLOCAL_AMFLAGS= -I m4 | ||
AUTOMAKE_OPTIONS = foreign | ||
|
||
SUBDIRS = src include | ||
|
||
check-license: | ||
@echo ">> checking license header" | ||
licRes=$$(for file in $$(find . -type f -regex '.*\.sh\|.*\.c\|.*\.cc\|.*\.am\|.*\.h\|.*Docker.*' ! -path ./config.h) ; do \ | ||
awk 'NR<=5' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \ | ||
done); \ | ||
if [ -n "$${licRes}" ]; then \ | ||
echo "license header checking failed:"; echo "$${licRes}"; \ | ||
exit 1; \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# Copyright © 2019 The OpenEBS 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. | ||
|
||
autoreconf -fiv | ||
rm -Rf autom4te.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#!/bin/bash | ||
|
||
# Copyright © 2020 The OpenEBS 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. | ||
|
||
set -e | ||
|
||
pwd | ||
|
||
# Determine the arch/os we're building for | ||
ARCH=$(uname -m) | ||
|
||
# Build libcstor | ||
make clean | ||
sh autogen.sh | ||
./configure --with-zfs-headers=$PWD/../cstor/include --with-spl-headers=$PWD/../cstor/lib/libspl/include | ||
make -j$(nproc) | ||
sudo make install | ||
sudo ldconfig | ||
|
||
# Build cstor | ||
cd ../cstor | ||
make clean | ||
sh autogen.sh | ||
./configure --enable-uzfs=yes --with-config=user --with-jemalloc --with-libcstor=$PWD/../libcstor/include | ||
make clean | ||
make -j$(nproc) | ||
|
||
# Build zrepl binary | ||
cd ../libcstor/cmd/zrepl | ||
make clean | ||
make | ||
cd ../../ | ||
|
||
# The images can be pushed to any docker/image registeries | ||
# like docker hub, quay. The registries are specified in | ||
# the `build/push` script. | ||
# | ||
# The images of a project or company can then be grouped | ||
# or hosted under a unique organization key like `openebs` | ||
# | ||
# Each component (container) will be pushed to a unique | ||
# repository under an organization. | ||
# Putting all this together, an unique uri for a given | ||
# image comprises of: | ||
# <registry url>/<image org>/<image repo>:<image-tag> | ||
# | ||
# IMAGE_ORG can be used to customize the organization | ||
# under which images should be pushed. | ||
# By default the organization name is `openebs`. | ||
|
||
if [ -z "${IMAGE_ORG}" ]; then | ||
IMAGE_ORG="openebs" | ||
fi | ||
|
||
# Specify the date of build | ||
DBUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%SZ') | ||
|
||
# Specify the docker arg for repository url | ||
if [ -z "${DBUILD_REPO_URL}" ]; then | ||
DBUILD_REPO_URL="https://github.com/openebs/libcstor" | ||
fi | ||
|
||
# Specify the docker arg for website url | ||
if [ -z "${DBUILD_SITE_URL}" ]; then | ||
DBUILD_SITE_URL="https://openebs.io" | ||
fi | ||
|
||
DBUILD_ARGS="--build-arg DBUILD_DATE=${DBUILD_DATE} --build-arg DBUILD_REPO_URL=${DBUILD_REPO_URL} --build-arg DBUILD_SITE_URL=${DBUILD_SITE_URL} --build-arg ARCH=${ARCH}" | ||
|
||
|
||
if [ "${ARCH}" = "x86_64" ]; then | ||
REPO_NAME="$IMAGE_ORG/cstor-base" | ||
DOCKERFILE_BASE="Dockerfile.base" | ||
DOCKERFILE="Dockerfile" | ||
elif [ "${ARCH}" = "aarch64" ]; then | ||
REPO_NAME="$IMAGE_ORG/cstor-base-arm64" | ||
DOCKERFILE_BASE="Dockerfile.base.arm64" | ||
DOCKERFILE="Dockerfile.arm64" | ||
else | ||
echo "${ARCH} is not supported" | ||
exit 1 | ||
fi | ||
|
||
mkdir -p ./docker/zfs/bin | ||
mkdir -p ./docker/zfs/lib | ||
|
||
cp cmd/zrepl/.libs/zrepl ./docker/zfs/bin | ||
cp ../cstor/cmd/zpool/.libs/zpool ./docker/zfs/bin | ||
cp ../cstor/cmd/zfs/.libs/zfs ./docker/zfs/bin | ||
cp ../cstor/cmd/zstreamdump/.libs/zstreamdump ./docker/zfs/bin | ||
|
||
cp ../cstor/lib/libzpool/.libs/*.so* ./docker/zfs/lib | ||
cp ../cstor/lib/libuutil/.libs/*.so* ./docker/zfs/lib | ||
cp ../cstor/lib/libnvpair/.libs/*.so* ./docker/zfs/lib | ||
cp ../cstor/lib/libzfs/.libs/*.so* ./docker/zfs/lib | ||
cp ../cstor/lib/libzfs_core/.libs/*.so* ./docker/zfs/lib | ||
cp src/.libs/*.so* ./docker/zfs/lib | ||
|
||
sudo docker version | ||
sudo docker build --help | ||
|
||
curl --fail https://raw.githubusercontent.com/openebs/charts/gh-pages/scripts/release/buildscripts/push > ./docker/push | ||
chmod +x ./docker/push | ||
|
||
## Building image for cstor-base | ||
echo "Build image ${REPO_NAME}:ci with BUILD_DATE=${DBUILD_DATE}" | ||
cd docker && \ | ||
sudo docker build -f ${DOCKERFILE_BASE} -t ${REPO_NAME}:ci ${DBUILD_ARGS} . && \ | ||
DIMAGE=${REPO_NAME} ./push && \ | ||
cd .. | ||
|
||
if [ "${ARCH}" = "x86_64" ]; then | ||
REPO_NAME="$IMAGE_ORG/cstor-pool" | ||
elif [ "${ARCH}" = "aarch64" ]; then | ||
REPO_NAME="$IMAGE_ORG/cstor-pool-arm64" | ||
fi | ||
|
||
echo "Build image ${REPO_NAME}:ci with BUILD_DATE=${DBUILD_DATE}" | ||
cd docker && \ | ||
sudo docker build -f ${DOCKERFILE} -t ${REPO_NAME}:ci ${DBUILD_ARGS} . && \ | ||
DIMAGE=${REPO_NAME} ./push && \ | ||
cd .. | ||
|
||
rm -rf ./docker/zfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
chore(build): build and push images to repositories from libcstor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright © 2020 The OpenEBS 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. | ||
|
||
SUBDIRS = zrepl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/zrepl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright © 2020 The OpenEBS 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. | ||
|
||
# -Wnoformat-truncation to get rid of compiler warning for unchecked | ||
# truncating snprintfs on gcc 7.1.1. | ||
AM_CFLAGS = $(FRAME_LARGER_THAN) | ||
# Dynamic symbol table is needed for printing symbol names in stack trace | ||
AM_LDFLAGS = -rdynamic | ||
|
||
AM_CPPFLAGS = -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT | ||
AM_CPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 | ||
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE -DHAVE_LARGE_STACKS=1 | ||
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\" | ||
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\" | ||
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\" | ||
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\" | ||
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" | ||
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) $(UZFS_CFLAGS) | ||
|
||
DEFAULT_INCLUDES = \ | ||
-I$(top_srcdir)/include \ | ||
${ZFS_SRC} \ | ||
${SPL_SRC} | ||
|
||
sbin_PROGRAMS = zrepl | ||
|
||
zrepl_SOURCES = \ | ||
zrepl.c | ||
|
||
zrepl_LDADD = \ | ||
$(zfssrc)/../lib/libnvpair/libnvpair.la \ | ||
$(zfssrc)/../lib/libuutil/libuutil.la \ | ||
$(zfssrc)/../lib/libzpool/libzpool.la \ | ||
$(zfssrc)/../lib/libzfs/libzfs.la \ | ||
$(zfssrc)/../lib/libzfs_core/libzfs_core.la | ||
|
||
zrepl_LDADD += -lcstor -ludev -luuid -lz |
Oops, something went wrong.