Skip to content

Commit

Permalink
Merge pull request #9 from ibuildthecloud/scripts
Browse files Browse the repository at this point in the history
Scripts
  • Loading branch information
ibuildthecloud authored Oct 4, 2016
2 parents dff0e00 + 24df754 commit 4ea3674
Show file tree
Hide file tree
Showing 554 changed files with 57,490 additions and 233 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./bin
./.dapper
./dist
./.trash-cache
12 changes: 9 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
image: golang:1.4.2
script:
- ./scripts/ci
---
pipeline:
build:
privileged: true
image: rancher/dapper:1.11.2
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- dapper ci
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.DS_Store
external-lb
/.dapper
/bin
/dist
*.swp
/.trash-cache
1 change: 0 additions & 1 deletion .package

This file was deleted.

3 changes: 0 additions & 3 deletions Dockerfile

This file was deleted.

31 changes: 31 additions & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:16.04
# FROM arm=armhf/ubuntu:16.04

ARG DAPPER_HOST_ARCH
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 && \
rm -f /bin/sh && ln -s /bin/bash /bin/sh

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.6.2.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get github.com/golang/lint/golint

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 DAPPER_SOURCE /go/src/github.com/rancher/external-lb/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}

ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]
47 changes: 0 additions & 47 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

2 changes: 0 additions & 2 deletions Godeps/_workspace/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions Godeps/_workspace/src/golang.org/x/sys/LICENSE

This file was deleted.

22 changes: 0 additions & 22 deletions Godeps/_workspace/src/golang.org/x/sys/PATENTS

This file was deleted.

File renamed without changes.
23 changes: 23 additions & 0 deletions Makefile
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)
2 changes: 1 addition & 1 deletion healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func healthcheck(w http.ResponseWriter, req *http.Request) {
// 1) test metadata server
_, err := m.MetadataClient.GetSelfStack()
if err != nil {
logrus.Error("Metadata health check failed: %v", err)
logrus.Errorf("Metadata health check failed: %v", err)
http.Error(w, "Failed to reach metadata server", http.StatusInternalServerError)
} else {
// 2) test provider
Expand Down
3 changes: 3 additions & 0 deletions package/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu:16.04
COPY external-lb /usr/bin/
CMD ["external-lb"]
10 changes: 0 additions & 10 deletions packaging/Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/bootstrap

This file was deleted.

28 changes: 7 additions & 21 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
#!/bin/bash -e
#!/bin/bash
set -e

cd $(dirname $0)/..

if [ -f ./build/bootstrap.envs ];then
. ./build/bootstrap.envs
fi

. ./scripts/common_functions

set_project_vars
source $(dirname $0)/version

if [ -L ${PACKAGE} ]; then
rm ${PACKAGE}
fi

if [ ! -e ${PACKAGE} ]; then
mkdir -p $(dirname $PACKAGE)
ln -s $(pwd) $PACKAGE
fi

echo export GOPATH=$GOPATH
cd $(dirname $0)/..

CGO_ENABLED=0 go build -o bin/${PROJECT}
mkdir -p bin
[ "$(uname)" != "Darwin" ] && LINKFLAGS="-linkmode external -extldflags -static -s"
go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/external-lb
12 changes: 5 additions & 7 deletions scripts/ci
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash

set -e

cd $(dirname $0)/..
cd $(dirname $0)

./scripts/clean
./scripts/bootstrap
./scripts/build
./scripts/test
./scripts/package
./build
./test
./validate
./package
11 changes: 0 additions & 11 deletions scripts/clean

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/common_functions

This file was deleted.

11 changes: 11 additions & 0 deletions scripts/entry
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

mkdir -p bin dist
if [ -e ./scripts/$1 ]; then
./scripts/"$@"
else
exec "$@"
fi

chown -R $DAPPER_UID:$DAPPER_GID .
24 changes: 11 additions & 13 deletions scripts/package
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#!/bin/bash
set -e

cd $(dirname $0)/..
source $(dirname $0)/version

CONTENT=$(</proc/sys/kernel/random/uuid)
ARCH=${ARCH:?"ARCH not set"}
SUFFIX=""
[ "${ARCH}" != "amd64" ] && SUFFIX="_${ARCH}"

rm -rf dist/artifacts
cd $(dirname $0)/../package

mkdir -p build/${CONTENT}
mkdir -p dist/artifacts
TAG=${TAG:-${VERSION}${SUFFIX}}
REPO=${REPO:-rancher}

cp -rf apply.sh bin content build/${CONTENT}
cp ../bin/external-lb .
docker build -t ${REPO}/external-lb:${TAG} .

cd build

sha1sum -b $(find ${CONTENT} -type f) > ${CONTENT}/SHA1SUMS
sha1sum ${CONTENT}/SHA1SUMS > ${CONTENT}/SHA1SUMSSUM

tar czf ../dist/artifacts/external-lb.tar.gz ${CONTENT}
echo Created dist/artifacts/external-lb.tar.gz
echo Built ${REPO}/external-lb:${TAG}
3 changes: 3 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec $(dirname $0)/ci
Loading

0 comments on commit 4ea3674

Please sign in to comment.