Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
180 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM ubuntu:16.04 | ||
# FROM arm=armhf/ubuntu:16.04 | ||
|
||
ARG DAPPER_HOST_ARCH=amd64 | ||
ARG http_proxy | ||
ARG https_proxy | ||
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y gcc ca-certificates git wget curl vim less file python-tox python-dev && \ | ||
rm -f /bin/sh && ln -s /bin/bash /bin/sh | ||
|
||
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \ | ||
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \ | ||
DOCKER_URL=DOCKER_URL_${ARCH} | ||
|
||
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker | ||
|
||
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${ARCH} \ | ||
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash | ||
|
||
RUN wget -O - https://storage.googleapis.com/golang/go1.11.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \ | ||
go get github.com/rancher/trash && go get github.com/golang/lint/golint | ||
|
||
ENV DAPPER_SOURCE /go/src/github.com/yasker/local-path-provisioner | ||
ENV DAPPER_OUTPUT ./bin | ||
ENV DAPPER_DOCKER_SOCKET true | ||
ENV DAPPER_ENV IMAGE REPO VERSION TAG | ||
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache | ||
ENV HOME ${DAPPER_SOURCE} | ||
WORKDIR ${DAPPER_SOURCE} | ||
|
||
ENTRYPOINT ["./scripts/entry"] | ||
CMD ["ci"] |
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,23 @@ | ||
TARGETS := $(shell ls scripts) | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
@@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
|
||
$(TARGETS): .dapper | ||
./.dapper $@ | ||
|
||
trash: .dapper | ||
./.dapper -m bind trash | ||
|
||
trash-keep: .dapper | ||
./.dapper -m bind trash -k | ||
|
||
deps: trash | ||
|
||
.DEFAULT_GOAL := ci | ||
|
||
.PHONY: $(TARGETS) |
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,8 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN apt-get update && apt-get install -y curl vim nfs-common iproute dnsutils iputils-ping telnet | ||
|
||
COPY bin /usr/local/sbin/ | ||
|
||
VOLUME /usr/local/sbin | ||
CMD ["local-path-provisioner"] |
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,9 @@ | ||
#!/bin/bash | ||
set -e -x | ||
|
||
cd $(dirname $0)/.. | ||
VERSION=${VERSION:-$(./scripts/version)} | ||
|
||
mkdir -p bin | ||
[ "$(uname)" != "Darwin" ] && LINKFLAGS="-extldflags -static -s" | ||
CGO_ENABLED=0 go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/local-path-provisioner |
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,14 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0) | ||
|
||
./build | ||
./validate | ||
./test -cover | ||
./package | ||
|
||
image=`cat ../bin/latest_image` | ||
|
||
echo | ||
echo Longhorn Manager image: ${image} |
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,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p bin dist | ||
if [ -e ./scripts/$1 ]; then | ||
exec ./scripts/"$@" | ||
else | ||
exec "$@" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
ARCH=${ARCH:-amd64} | ||
SUFFIX="" | ||
[ "${ARCH}" != "amd64" ] && SUFFIX="_${ARCH}" | ||
|
||
export VERSION=${VERSION:-$(./scripts/version)} | ||
|
||
TAG=${TAG:-${VERSION}${SUFFIX}} | ||
REPO=${REPO:-rancher} | ||
IMAGE=${IMAGE:-${REPO}/local-path-provisioner:${TAG}} | ||
|
||
if [ ! -e ./bin/local-path-provisioner ]; then | ||
./scripts/build | ||
fi | ||
|
||
cp -a ./bin ./package/ | ||
trap 'rm -rf ./package/bin' exit | ||
docker build -t ${IMAGE} ./package | ||
|
||
echo Built ${IMAGE} | ||
|
||
echo ${IMAGE} > ./bin/latest_image |
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,3 @@ | ||
#!/bin/bash | ||
|
||
exec $(dirname $0)/ci |
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 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
args=$1 | ||
|
||
echo Running tests | ||
|
||
PACKAGES="$(find . -name '*.go' | xargs -I{} dirname {} | sort -u | grep -Ev '(.git|.trash-cache|vendor|bin)')" | ||
|
||
echo Packages: ${PACKAGES} | ||
|
||
[ "${ARCH}" == "amd64" ] && RACE=-race | ||
go test ${RACE} ${args} ${PACKAGES} |
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,22 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
echo Running validation | ||
|
||
PACKAGES="$(find . -name '*.go' | grep -Ev '.pb.go' | xargs -I{} dirname {} | \ | ||
sort -u | grep -Ev '(.git|.trash-cache|vendor|bin|k8s/pkg|client)')" | ||
|
||
echo Packages: ${PACKAGES} | ||
echo Running: go vet | ||
go vet ${PACKAGES} | ||
echo Running: golint | ||
for i in ${PACKAGES}; do | ||
if [ -n "$(golint $i | grep -v 'should have comment.*or be unexported' | grep -v 'just return error instead.' | tee /dev/stderr)" ]; then | ||
failed=true | ||
fi | ||
done | ||
test -z "$failed" | ||
echo Running: go fmt | ||
test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)" |
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,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then | ||
DIRTY="-dirty" | ||
fi | ||
|
||
COMMIT=$(git rev-parse --short HEAD) | ||
GIT_TAG=$(git tag -l --contains HEAD | head -n 1) | ||
|
||
if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then | ||
VER=$GIT_TAG | ||
else | ||
VER="${COMMIT}${DIRTY}" | ||
fi | ||
|
||
echo ${VER} |