-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #611 from CS-SI/pr/docs
Bugfixes and Doc updates
- Loading branch information
Showing
25 changed files
with
3,364 additions
and
2,616 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
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,104 @@ | ||
FROM ubuntu:focal as base | ||
LABEL maintainer="CS SI" | ||
ARG http_proxy="" | ||
ARG https_proxy="" | ||
ARG LC_ALL=C.UTF-8 | ||
ARG LANG=C.UTF-8 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV BUILD_ENV docker | ||
ENV BRANCH_NAME $BRANCH_NAME | ||
ENV GOVERSION $GOVERSION | ||
ENV PROTOVERSION $PROTOVERSION | ||
ENV COMMITSHA $COMMITSHA | ||
ENV GOOSX $GOOSX | ||
ENV GOARCHX $GOARCHX | ||
|
||
RUN apt-get update -y \ | ||
&& apt-get install -y --allow-unauthenticated --no-install-recommends \ | ||
wget unzip apt-utils | ||
|
||
WORKDIR /tmp | ||
|
||
# ---------------------- | ||
# Install GO $GOVERSION | ||
# ---------------------- | ||
RUN wget --no-check-certificate https://dl.google.com/go/go$GOVERSION.linux-amd64.tar.gz \ | ||
&& tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz \ | ||
&& rm /tmp/go$GOVERSION.linux-amd64.tar.gz | ||
ENV PATH $PATH:/usr/local/go/bin:/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
# ---------------------- | ||
# Install Protoc $PROTOVERSION | ||
# ---------------------- | ||
RUN wget --no-check-certificate https://github.com/google/protobuf/releases/download/v$PROTOVERSION/protoc-$PROTOVERSION-linux-x86_64.zip \ | ||
&& unzip -d /usr/local/protoc protoc-$PROTOVERSION-linux-x86_64.zip \ | ||
&& ln -s /usr/local/protoc/bin/protoc /usr/local/bin \ | ||
&& rm /tmp/protoc-$PROTOVERSION-linux-x86_64.zip | ||
|
||
FROM base AS builder | ||
|
||
WORKDIR /tmp | ||
|
||
# ----------------- | ||
# Install Standard packages | ||
# ----------------- | ||
RUN apt-get install -y --allow-unauthenticated --no-install-recommends \ | ||
locales \ | ||
sudo \ | ||
build-essential \ | ||
make \ | ||
curl \ | ||
git \ | ||
jq \ | ||
python3 \ | ||
python3-pip \ | ||
&& apt-get autoclean -y \ | ||
&& apt-get autoremove -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the locale | ||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
RUN python3 -c "print('testing UTF8: 👌')" | ||
|
||
ENV SHELL /bin/bash | ||
ENV GOPATH /go | ||
COPY build-safescale2.sh /opt/build-safescale.sh | ||
|
||
CMD sleep 5 | ||
|
||
COPY marker /dev/null | ||
|
||
RUN cd /opt && COMMITSHA=$COMMITSHA GOOSX=$GOOSX GOARCHX=$GOARCHX ./build-safescale.sh | ||
|
||
# -- | ||
|
||
FROM golang:$GOVERSION-alpine | ||
LABEL maintainer="CS SI" | ||
ARG http_proxy="" | ||
ARG https_proxy="" | ||
ARG LC_ALL=C.UTF-8 | ||
ARG LANG=C.UTF-8 | ||
ENV BUILD_ENV docker | ||
|
||
RUN apk update && \ | ||
apk add --no-cache \ | ||
nano \ | ||
curl \ | ||
wget \ | ||
openssl \ | ||
ca-certificates \ | ||
iproute2 \ | ||
iperf | ||
|
||
RUN ln -s /usr/lib/tc /lib/tc | ||
RUN mkdir /exported-$GOOSX-$GOARCHX | ||
|
||
RUN apk add --no-cache bash | ||
|
||
COPY --from=builder /exported-$GOOSX-$GOARCHX/safescaled /exported-$GOOSX-$GOARCHX/safescaled | ||
COPY --from=builder /exported-$GOOSX-$GOARCHX/safescale /exported-$GOOSX-$GOARCHX/safescale | ||
COPY --from=builder /exported-$GOOSX-$GOARCHX/go.mod /exported-$GOOSX-$GOARCHX/go.mod | ||
COPY --from=builder /exported-$GOOSX-$GOARCHX/go.sum /exported-$GOOSX-$GOARCHX/go.sum |
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#! /bin/bash | ||
|
||
echo "Checks..." | ||
if [[ ! -v BUILD_ENV ]]; then | ||
echo "BUILD_ENV is not set, this script is intended to run inside a docker container" | ||
[[ $SHLVL -gt 2 ]] && return 1 || exit 1 | ||
fi | ||
|
||
# ---------------------- | ||
# Create working directory | ||
# ---------------------- | ||
echo "Create working directory" | ||
export WRKDIR=/opt | ||
mkdir -p ${WRKDIR} | ||
cd ${WRKDIR} | ||
rm -rf SafeScale | ||
|
||
if [ -z "$COMMITSHA" ] | ||
then | ||
# ---------------------- | ||
# Get source code | ||
# ---------------------- | ||
echo "Get source code" | ||
BRANCH_NAME=${BRANCH_NAME:="develop"} | ||
GIT_REPO_URL=${GIT_REPO_URL:="https://github.com/CS-SI/SafeScale.git"} | ||
echo "Cloning branch '${BRANCH_NAME}' from repo '${GIT_REPO_URL}'" | ||
|
||
git clone ${GIT_REPO_URL} -b ${BRANCH_NAME} --depth=1 | ||
|
||
cd SafeScale | ||
sed -i "s#\(.*\)develop#\1${BRANCH_NAME}#" common.mk | ||
else | ||
# ---------------------- | ||
# Get source code | ||
# ---------------------- | ||
echo "Get source code, commit $COMMITSHA" | ||
GIT_REPO_URL=${GIT_REPO_URL:="https://github.com/CS-SI/SafeScale.git"} | ||
|
||
git clone ${GIT_REPO_URL} | ||
cd SafeScale | ||
|
||
git reset --hard $COMMITSHA | ||
sed -i "s#\(.*\)develop#\1${BRANCH_NAME}#" common.mk | ||
fi | ||
|
||
# ---------------------- | ||
# Compile | ||
# ---------------------- | ||
|
||
echo "deps" | ||
make getdevdeps | ||
|
||
sleep 4 | ||
|
||
echo "mod" | ||
make mod | ||
|
||
sleep 4 | ||
|
||
make sdk | ||
|
||
sleep 4 | ||
|
||
make force_sdk_python | ||
|
||
sleep 4 | ||
|
||
make force_sdk_js | ||
|
||
sleep 4 | ||
|
||
make generate | ||
|
||
sleep 4 | ||
|
||
export GOOS=$GOOSX | ||
export GOARCH=$GOARCHX | ||
|
||
echo "Make All" | ||
make release | ||
[ $? -ne 0 ] && echo "Build failure" && exit 1 | ||
|
||
echo "Install" | ||
make install | ||
[ $? -ne 0 ] && echo "Install failure" && exit 1 | ||
|
||
echo "Export" | ||
export CIBIN=/exported-$GOOS-$GOARCH | ||
mkdir -p /exported-$GOOS-$GOARCH | ||
|
||
CIBIN=/exported-$GOOS-$GOARCH make installci | ||
[ $? -ne 0 ] && echo "Export failure" && exit 1 | ||
|
||
cp ${WRKDIR}/SafeScale/go.mod /exported-$GOOS-$GOARCH | ||
cp ${WRKDIR}/SafeScale/go.sum /exported-$GOOS-$GOARCH | ||
|
||
exit 0 |
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,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$(uname -s)" = "Darwin" ]; then | ||
WRKDIR=$(readlink -n $(dirname "$0")) | ||
[ -z "$WRKDIR" ] && WRKDIR=$(dirname "$0") | ||
else | ||
WRKDIR=$(readlink -f $(dirname "$0")) | ||
fi | ||
|
||
if [ ! -z "$1" ]; then | ||
if [[ $1 == "-f" ]]; then | ||
date >marker | ||
fi | ||
fi | ||
|
||
if [ ! -f ./marker ]; then | ||
curl https://api.github.com/repos/CS-SI/SafeScale/commits/$(git rev-parse --abbrev-ref HEAD) 2>&1 | grep '"date"' | tail -n 1 >./marker | ||
else | ||
curl https://api.github.com/repos/CS-SI/SafeScale/commits/$(git rev-parse --abbrev-ref HEAD) 2>&1 | grep '"date"' | tail -n 1 >./newMarker | ||
diff ./marker ./newMarker 1>/dev/null && rm ./newMarker && echo "Nothing to do !, if you want to force a docker build launch with the -f flag" && exit 0 | ||
fi | ||
|
||
stamp=$(date +"%s") | ||
|
||
[ -z "$BRANCH_NAME" ] && BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | ||
[ -z "$GOVERSION" ] && GOVERSION=1.18.4 | ||
[ -z "$PROTOVERSION" ] && PROTOVERSION=3.17.3 | ||
|
||
BRANCH_NAME=$BRANCH_NAME PROTOVERSION=$PROTOVERSION GOVERSION=$GOVERSION COMMITSHA=$COMMITSHA envsubst <Dockerfile2 >Dockerfile.$stamp | ||
if [ -z "$COMMITSHA" ] | ||
then | ||
sed -i '/ENV COMMITSHA/d' Dockerfile.$stamp | ||
fi | ||
|
||
echo docker build --rm --network host --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg BRANCH_NAME=$BRANCH_NAME --build-arg GOVERSION=$GOVERSION -f ${WRKDIR}/Dockerfile.$stamp -t "safescale:${BRANCH_NAME/\//_}" $WRKDIR | ||
docker build --rm --network host --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg BRANCH_NAME=$BRANCH_NAME --build-arg GOVERSION=$GOVERSION -f ${WRKDIR}/Dockerfile.$stamp -t "safescale:${BRANCH_NAME/\//_}" $WRKDIR | ||
[ $? -ne 0 ] && echo "Docker build failed !!" && { | ||
rm -f ./marker | ||
rm -f ./Dockerfile.$stamp | ||
exit 1 | ||
} | ||
|
||
echo "Docker build OK" | ||
|
||
docker create -ti --name dummy "safescale:${BRANCH_NAME/\//_}" bash | ||
[ $? -ne 0 ] && echo "Failure extracting binaries 1/3" && exit 1 | ||
docker cp dummy:/exported-$GOOSX-$GOARCHX . | ||
[ $? -ne 0 ] && echo "Failure extracting binaries 2/3" && exit 1 | ||
docker rm -f dummy | ||
[ $? -ne 0 ] && echo "Failure extracting binaries 3/3" && exit 1 | ||
|
||
echo "Binaries extracted successfully" | ||
if [ -f ./newMarker ]; then | ||
mv ./newMarker ./marker | ||
fi | ||
|
||
rm -f ./Dockerfile.$stamp | ||
|
||
exit 0 |
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,4 @@ | ||
VERSION=22.11.2 | ||
VERSION=22.11.5 | ||
export VERSION | ||
|
||
ifeq ($(MAKE_LEVEL),) | ||
|
Oops, something went wrong.