Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Update scripts to remove some differences between image and buildbot
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Jun 6, 2018
1 parent efe6727 commit 65e6d5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
21 changes: 17 additions & 4 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ then
set -x
fi

: ${NETLIFY_BUILD_BASE="/opt/buildhome"}
NETLIFY_CACHE_DIR="$NETLIFY_BUILD_BASE/cache"
NETLIFY_REPO_DIR="$NETLIFY_BUILD_BASE/repo"

export GIMME_TYPE=binary
export GIMME_NO_ENV_ALIAS=true
export GIMME_CGO_ENABLED=true
Expand Down Expand Up @@ -134,7 +138,8 @@ run_npm() {
then
echo "Installing NPM modules using NPM version $(npm --version)"
run_npm_set_temp
if npm install ${NPM_FLAGS:+"$NPM_FLAGS"}; then
if npm install ${NPM_FLAGS:+"$NPM_FLAGS"}
then
echo "NPM modules installed"
else
echo "Error during NPM install"
Expand All @@ -157,7 +162,7 @@ install_dependencies() {
if [ -f runtime.txt ]
then
PYTHON_VERSION=$(cat runtime.txt)
if source $HOME/python/${PYTHON_VERSION}/bin/activate
if source $HOME/python${PYTHON_VERSION}/bin/activate
then
echo "Python version set to ${PYTHON_VERSION}"
else
Expand Down Expand Up @@ -604,9 +609,17 @@ install_missing_commands() {
fi
}

verify_run_dir() {
set_go_import_path() {
# Setup project GOPATH
if [ -n "$GO_IMPORT_PATH" ]
then
echo "$GOPATH/src/$GO_IMPORT_PATH"
local importPath="$GOPATH/src/$GO_IMPORT_PATH"
local dirPath="$(dirname $importPath)"

rm -rf $dirPath
mkdir -p $dirPath
ln -s $PWD $importPath

cd $importPath
fi
}
19 changes: 4 additions & 15 deletions run-build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/bash

dir="$(dirname "$0")"

: ${NETLIFY_REPO_URL="/opt/repo"}

NETLIFY_BUILD_BASE="/opt/buildhome"
NETLIFY_CACHE_DIR="$NETLIFY_BUILD_BASE/cache"
NETLIFY_REPO_DIR="$NETLIFY_BUILD_BASE/repo"

cmd=$*

Expand All @@ -15,37 +11,30 @@ $cmd
EOF
)

mkdir -p $NETLIFY_CACHE_DIR
rm -rf $NETLIFY_BUILD_BASE/.yarn
. "$dir/run-build-functions.sh"

if [[ ! -d $NETLIFY_REPO_DIR ]]; then
git clone $NETLIFY_REPO_URL $NETLIFY_REPO_DIR
fi
cd $NETLIFY_REPO_DIR

. "$dir/run-build-functions.sh"

: ${NODE_VERSION="8"}
: ${RUBY_VERSION="2.3.6"}
: ${YARN_VERSION="1.3.2"}
: ${PHP_VERSION="5.6"}
: ${GO_VERSION="1.10"}

echo "Installing dependencies: node=$NODE_VERSION ruby=$RUBY_VERSION yarn=$YARN_VERSION php=$PHP_VERSION go=$GO_VERSION"
echo "Installing dependencies"
install_dependencies $NODE_VERSION $RUBY_VERSION $YARN_VERSION $PHP_VERSION $GO_VERSION

echo "Installing missing commands"
install_missing_commands

echo "Verify run directory"
run_dir=`verify_run_dir`
if [ "$run_dir" != "" ]
then
cd $run_dir
fi
set_go_import_path

echo "Executing user command: $cmd"
$cmd
eval "$cmd"
CODE=$?

echo "Caching artifacts"
Expand Down

0 comments on commit 65e6d5c

Please sign in to comment.