c9-core/b9/lib/_npm.sh

37 wiersze
940 B
Bash
Czysty Zwykły widok Historia

2016-02-03 18:52:24 +00:00
_b9_npm() {
local WORKDIR=$1
shift
# TODO run all build steps in a container
if [ $(id -u) == "1000" ]; then
docker run \
--rm \
-w /home/ubuntu/newclient \
-v $WORKDIR:/home/ubuntu/newclient \
--sig-proxy -a STDIN -a STDOUT -a STDERR \
$(_b9_get_newclient_image) bash -c "
echo \"$(_b9_npm_get_github_ssh)\" >> /home/ubuntu/.ssh/id_rsa_deploy
chmod 600 /home/ubuntu/.ssh/id_rsa_deploy
npm "$@"
"
else
pushd $WORKDIR &> /dev/null
2016-02-08 14:08:08 +00:00
$NPM "$@"
popd &> /dev/null
fi
}
_b9_npm_get_github_ssh() {
local FILE
for FILE in "$B9_GITHUB_SSH_FILE" ~/.ssh/id_rsa_c9robot ~/.ssh/id_rsa_deploy ~/.ssh/id_rsa; do
if [ -e "$FILE" ]; then
cat $FILE
return
fi
done
echo "Can't find SSH key for Github" 1>&2
exit 1
2016-02-03 18:52:24 +00:00
}