Skip to content

Commit

Permalink
Get latest build-env fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
clarsonneur committed Oct 1, 2018
1 parent 18a35c0 commit d25d207
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build-env-docker/glide/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER [email protected]
ARG UID
ARG GID

ENV GLIDE_VERSION 0.13.1
ENV GLIDE_VERSION 0.13.2
ENV GLIDE_DOWNLOAD_URL=https://github.com/Masterminds/glide/releases/download/v${GLIDE_VERSION}/glide-v${GLIDE_VERSION}-linux-amd64.tar.gz \
GLIDE_HOME=/go/.glide/${GLIDE_VERSION}

Expand Down
21 changes: 21 additions & 0 deletions lib/build-env.fcts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function be_ci_detected {
export CI_ENABLED=FALSE
if [[ "$WORKSPACE" != "" ]]
then
set +xe
echo "Jenkins environment detected"
export CI_WORKSPACE="$WORKSPACE"
export CI_ENABLED=TRUE
Expand Down Expand Up @@ -251,6 +252,26 @@ function docker_build_env {
then
be_create_${1}_docker_build
fi
if [[ $1 = core ]]
then
_be_gitignore
fi
}
function _be_gitignore {
if [[ -f .gitignore ]]
then
if [[ "$(grep '^.be-\*$' .gitignore)" = "" ]]
then
echo ".be-*" >> .gitignore
echo ".gitignore updated."
fi
else
echo ".be-*" > .gitignore
echo ".gitignore created."
fi
}
function _be_set_debug {
Expand Down
28 changes: 28 additions & 0 deletions lib/source-be-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,34 @@ function go_check_and_set {
fi
echo "$1" > .be-gopath
echo "$1 added as GOPATH"
else # Determine GOPATH from current path
local curPath=$(pwd)
local parentPath=$(dirname $curPath)
local parentName=$(basename $parentPath)

while [[ $found = false ]]
do
if [[ $parentName == src ]]
then
# Check if curPath has .git
if [[ ! -d "$curPath/.git" ]]
then
echo "Unable to determine GOPATH: $curPath is not a valid GIT repository"
fi
gopath=$(dirname $parentPath)
break
fi
curPath=$parentPath
parentPath=$(dirname $curPath)
parentName=$(basename $parentPath)

done
if [[ $parentName == src ]]
then
local gopath=$(dirname $parentPath)
echo "$gopath" > .be-gopath
echo "Detected $gopath as GOPATH from $(pwd). If wrong, update .be-gopath"
fi
fi

if [[ -f .be-gopath ]]
Expand Down
4 changes: 2 additions & 2 deletions lib/source-build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

source lib/build-env.fcts.sh

be_ci_detected

if [[ -f .build-env.def ]]
then
for var in $(grep -e '^\(.*=.*\)' .build-env.def)
Expand Down Expand Up @@ -29,8 +31,6 @@ then
return
fi

be_ci_detected

be_setup

if [ $# -ne 0 ]
Expand Down

0 comments on commit d25d207

Please sign in to comment.