-
Notifications
You must be signed in to change notification settings - Fork 9
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 #205 from leaf-ai/feature/184_flux_trial
Feature/184 CI Pipeline that avoids Travis and a$$ociated dependencies
- Loading branch information
Showing
14 changed files
with
521 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,14 @@ MAINTAINER [email protected] | |
|
||
ENV LANG C.UTF-8 | ||
|
||
ENV GO_VERSION 1.11.4 | ||
ENV GO_VERSION 1.11.5 | ||
|
||
RUN \ | ||
apt-get update && apt-get install -y apt-transport-https && \ | ||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ | ||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list && \ | ||
apt-get update && \ | ||
apt-get install -y kubectl | ||
|
||
RUN \ | ||
mkdir -p /project/go && \ | ||
|
@@ -26,13 +33,22 @@ WORKDIR /project/src/github.com/leaf-ai/studio-go-runner | |
|
||
RUN mkdir $GOPATH/bin && \ | ||
(curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh) && \ | ||
git config --global url."git://github.com".insteadOf "https://github.com" && \ | ||
git config --global url."https://github.com/".insteadOf [email protected]: && \ | ||
git config --global url."https://".insteadOf git:// && \ | ||
go get github.com/karlmutch/enumer && \ | ||
go get github.com/karlmutch/petname && \ | ||
go install github.com/karlmutch/petname/cmd/petname && \ | ||
wget -q -O $GOPATH/bin/semver https://github.com/karlmutch/duat/releases/download/0.9.3/semver-linux-amd64 && \ | ||
wget -q -O $GOPATH/bin/stencil https://github.com/karlmutch/duat/releases/download/0.9.3/stencil-linux-amd64 && \ | ||
chmod +x $GOPATH/bin/semver && \ | ||
chmod +x $GOPATH/bin/stencil && \ | ||
rm /usr/bin/nvidia-* | ||
|
||
LABEL author="Karl Mutch" | ||
|
||
COPY . /project/src/github.com/leaf-ai/studio-go-runner/ | ||
|
||
CMD /bin/bash -c 'set -e ; set -o pipefail ; (dep ensure && go run build.go -r -dirs=internal && go run build.go -r -dirs=cmd && echo "Build Success" || echo "Build Failure") 2>&1 ' | ||
CMD /bin/bash -c './ci.sh' | ||
|
||
# Done last to prevent lots of disruption when bumping versions | ||
LABEL vendor="Open Source" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,124 @@ | ||
#!/bin/bash -e | ||
|
||
[ -z "$GOPATH" ] && echo "Error: env variable GOPATH must be set" && exit 1; | ||
[ -z "$GITHUB_TOKEN" ] && echo "Warning : env variable GITHUB_TOKEN should be set in the event that a release is to be generated" ; | ||
[ -z ${azure_registry_name+x} ] && echo "Warning : env variable azure_registry_name not set"; | ||
|
||
if [[ ":$PATH:" != *":$GOPATH/bin:"* ]]; then | ||
export PATH=$PATH:$GOPATH/bin | ||
fi | ||
|
||
export LOGXI="*=DBG" | ||
export LOGXI_FORMAT="happy,maxcol=1024" | ||
|
||
[ -z "$TERM" ] && export TERM=xterm+256color; | ||
|
||
if [ -n "$(type -t travis_fold)" ] && [ "$(type -t travis_fold)" = function ]; then | ||
type travis_fold | ||
type travis_nanoseconds | ||
type travis_time_start | ||
type travis_time_finish | ||
: | ||
else | ||
declare -i travis_start_time | ||
declare -i travis_end_time | ||
|
||
function travis_nanoseconds () { | ||
local cmd="date"; | ||
local format="+%s%N"; | ||
local os=$(uname); | ||
if hash gdate > /dev/null 2>&1; then | ||
cmd="gdate"; | ||
else | ||
if [[ "$os" = Darwin ]]; then | ||
format="+%s000000000"; | ||
fi; | ||
fi; | ||
$cmd -u $format | ||
} | ||
|
||
function travis_fold() { | ||
local action=$1; | ||
local name=$2; | ||
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" | ||
} | ||
function travis_time_start() { | ||
travis_timer_id=$(printf %08x $(( RANDOM * RANDOM ))); | ||
travis_start_time=$(travis_nanoseconds); | ||
echo -en "travis_time:start:$travis_timer_id\r${ANSI_CLEAR}" | ||
} | ||
function travis_time_finish() { | ||
local result=$?; | ||
travis_end_time=$(travis_nanoseconds); | ||
local duration=$(($travis_end_time-$travis_start_time)); | ||
echo -en "\ntravis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r${ANSI_CLEAR}"; | ||
return $result | ||
|
||
} | ||
fi | ||
|
||
go get -u github.com/golang/dep/cmd/dep | ||
|
||
dep ensure | ||
|
||
bash -c "while true; do echo \$(date) - building ...; sleep 180s; done" & | ||
PING_LOOP_PID=$! | ||
|
||
function cleanup { | ||
# nicely terminate the ping output loop | ||
kill $PING_LOOP_PID | ||
} | ||
trap cleanup EXIT | ||
|
||
function ExitWithError | ||
{ | ||
echo "$*">&2 | ||
rm -f $working_file | ||
exit 1 | ||
} | ||
|
||
function Tidyup | ||
{ | ||
ExitWithError "Abort" | ||
} | ||
|
||
umask 077 | ||
working_file=$$.studio-go-runner-working | ||
rm -f $working_file | ||
trap Tidyup 1 2 3 15 | ||
|
||
export GIT_BRANCH=`echo '{{.duat.gitBranch}}' | stencil - | tr '_' '-' | tr '\/' '-'` | ||
export RUNNER_BUILD_LOG=build-$GIT_BRANCH.log | ||
|
||
exit_code=0 | ||
|
||
# Determine if we are running under a keel based CI build and if so ... | ||
export | ||
|
||
travis_fold start "build.image" | ||
travis_time_start | ||
set -o pipefail ; (go run build.go -r -dirs=internal && go run build.go -r -dirs=cmd && echo "Success" || echo "Failure") 2>&1 | tee $RUNNER_BUILD_LOG | ||
exit_code=$? | ||
if [ $exit_code -ne 0 ]; then | ||
exit $exit_code | ||
fi | ||
travis_time_finish | ||
travis_fold end "build.image" | ||
|
||
cleanup | ||
|
||
echo "Starting the namespace injections etc" $K8S_POD_NAME | ||
kubectl label deployment build keel.sh/policy=force --namespace=$K8S_NAMESPACE | ||
kubectl scale --namespace $K8S_NAMESPACE --replicas=0 rc/rabbitmq-controller | ||
kubectl scale --namespace $K8S_NAMESPACE --replicas=0 deployment/minio-deployment | ||
|
||
for (( ; ; )) | ||
do | ||
sleep 600 | ||
done | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
exit $exit_code | ||
fi | ||
|
||
exit 0 |
Oops, something went wrong.