Report failing error code on Lumi compilation errors

Report an error when Lumi runtime compilation fails.

Also adds a reusable install_release.sh script to use
for installing Lumi package releases, plus expansion
of symlinks in package Makefiles.
This commit is contained in:
Luke Hoban 2017-07-24 22:43:37 -07:00
parent 2952c3624d
commit 916dd6b235
5 changed files with 40 additions and 4 deletions

View file

@ -129,7 +129,7 @@ func plan(cmd *cobra.Command, info *envCmdInfo, opts deployOptions) (*planResult
// First, compile the package, in preparatin for interpreting it and creating resources.
result := compile(cmd, info.Args)
if result == nil || !result.B.Ctx().Diag.Success() {
return nil, nil
return nil, fmt.Errorf("Errors during compilation: %v", result.B.Ctx().Diag.Errors())
}
// If that succeeded, create a new source that will perform interpretation of the compiled program.

View file

@ -35,5 +35,5 @@ install:
@mkdir -p ${LUMILIB} # ensure the machine-wide library dir exists.
@cp -R ./.lumi/bin/ ${THISLIB} # copy to the standard library location.
@cp package.json ${THISLIB} # ensure the result is an NPM package.
@if [ -d ./node_modules ]; then cp -r ./node_modules ${LUMIROOT}; fi # keep the links we depend upon.
@if [ -d ./node_modules ]; then cp -RL ./node_modules ${LUMIROOT}; fi # copy the links we depend upon.

View file

@ -36,5 +36,5 @@ install:
@mkdir -p ${LUMILIB} # ensure the machine-wide library dir exists.
@cp -R ./.lumi/bin/ ${THISLIB} # copy to the standard library location.
@cp package.json ${THISLIB} # ensure the result is an NPM package.
@if [ -d ./node_modules ]; then cp -r ./node_modules ${LUMIROOT}; fi # keep the links we depend upon.
@if [ -d ./node_modules ]; then cp -RL ./node_modules ${LUMIROOT}; fi # copy the links we depend upon.

View file

@ -35,5 +35,5 @@ install:
@mkdir -p ${LUMILIB} # ensure the machine-wide library dir exists.
@cp -R ./.lumi/bin/ ${THISLIB} # copy to the standard library location.
@cp package.json ${THISLIB} # ensure the result is an NPM package.
@if [ -d ./node_modules ]; then cp -r ./node_modules ${LUMIROOT}; fi # keep the links we depend upon.
@if [ -d ./node_modules ]; then cp -RL ./node_modules ${LUMIROOT}; fi # copy the links we depend upon.

View file

@ -0,0 +1,36 @@
#!/bin/bash
# install_release.sh will download and install the current bits from the usual share location and binplace them.
# The first argument is the release name, the second is the Git commit hash to fetch and the third is the
# target location to install them into.
set -e
RELEASENAME=${1}
GITVER=${2}
INSTALLDIR=${3}
if [ -z "${RELEASENAME}" ]; then
echo error: missing name of release to install
exit 1
fi
if [ -z "${GITVER}" ]; then
echo error: missing Git commit/tag/branch argument
exit 1
fi
if [ -z "${INSTALLDIR}" ]; then
echo error: missing target installation directory
exit 2
fi
# Make the directory, download the bits, and unzip/tar them in place.
RELEASE=s3://eng.pulumi.com/releases/${RELEASENAME}/${GITVER}.tgz
echo Installing ${RELEASE} to: ${PUBTARGET}
mkdir -p ${INSTALLDIR}
aws s3 cp ${RELEASE} ${INSTALLDIR}
tar -xzf ${INSTALLDIR}/${GITVER}.tgz -C ${INSTALLDIR}
# Finally, link the bits so that NPM packages link to the right place.
for pack in ${INSTALLDIR}/packs/*; do
cd ${pack} && yarn link
done