1
0
mirror of https://github.com/rancher/cli.git synced 2026-02-05 09:48:36 +01:00

Initial Commit

This commit is contained in:
Darren Shepherd
2016-05-26 20:00:15 -07:00
commit fd5da291c4
44 changed files with 2780 additions and 0 deletions

9
scripts/build Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -e
source $(dirname $0)/version
cd $(dirname $0)/..
mkdir -p bin
go build -ldflags "-X main.VERSION=$VERSION -linkmode external -extldflags -static" -o bin/cli

9
scripts/ci Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -e
cd $(dirname $0)
./build
./test
./validate
./package

11
scripts/entry Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
trap "chown -R $DAPPER_UID:$DAPPER_GID ." exit
mkdir -p bin
if [ -e ./scripts/$1 ]; then
./scripts/"$@"
else
"$@"
fi

14
scripts/package Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
source $(dirname $0)/version
cd $(dirname $0)/../package
TAG=${TAG:-${VERSION}}
REPO=${REPO:-rancher}
cp ../bin/cli .
docker build -t ${REPO}/cli:${TAG} .
echo Built ${REPO}/cli:${TAG}

3
scripts/release Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec $(dirname $0)/ci

10
scripts/test Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
echo Running tests
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
go test -race -cover -tags=test ${PACKAGES}

20
scripts/validate Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
echo Running validation
PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
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' | tee /dev/stderr)" ]; then
failed=true
fi
done
test -z "$failed"
echo Running: go fmt
test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)"

14
scripts/version Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
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
VERSION=$GIT_TAG
else
VERSION="${COMMIT}${DIRTY}"
fi