mirror of
https://github.com/rancher/cli.git
synced 2026-02-05 09:48:36 +01:00
Initial Commit
This commit is contained in:
9
scripts/build
Executable file
9
scripts/build
Executable 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
9
scripts/ci
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
./build
|
||||
./test
|
||||
./validate
|
||||
./package
|
||||
11
scripts/entry
Executable file
11
scripts/entry
Executable 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
14
scripts/package
Executable 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
3
scripts/release
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec $(dirname $0)/ci
|
||||
10
scripts/test
Executable file
10
scripts/test
Executable 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
20
scripts/validate
Executable 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
14
scripts/version
Executable 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
|
||||
Reference in New Issue
Block a user