Switch Linux toolcache to GitHub package registry (#316)

* Switch toolcache to GitHub package registry

* Add Execute in /tmp & show failure code

* Added boost 1.72 & tmp folder parameters

* Change "github_feed_token" to "null"
This commit is contained in:
Mihran
2020-01-29 11:26:47 +04:00
committed by GitHub
parent 548a28dc8d
commit 2b2aa98d56
5 changed files with 41 additions and 21 deletions

View File

@@ -10,12 +10,23 @@ source $HELPER_SCRIPTS/document.sh
# Fail out if any setups fail
set -e
TOOLCACHE_REGISTRY="npm.pkg.github.com"
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir $AGENT_TOOLSDIRECTORY
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
chmod -R 777 $AGENT_TOOLSDIRECTORY
echo "Configure npm to use github package registry for '@actions' scope"
npm config set @actions:registry "https://${TOOLCACHE_REGISTRY}"
# Execute in /imagegeneration/installers folder to avoid node_modules creation in $HOME
pushd $INSTALLER_SCRIPT_FOLDER
# GitHub Package Registry doesn't support downloading public packages without auth so we have to authorize
echo "Configure auth for github package registry"
echo "//${TOOLCACHE_REGISTRY}/:_authToken=${GITHUB_FEED_TOKEN}" > ".npmrc"
echo "Installing npm-toolcache..."
TOOLSET_PATH="$INSTALLER_SCRIPT_FOLDER/toolcache.json"
@@ -25,10 +36,19 @@ for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do
PACKAGE_VERSIONS=($(jq -r ".[\"$PACKAGE_NAME\"] | .[]" $TOOLSET_PATH))
for PACKAGE_VERSION in ${PACKAGE_VERSIONS[@]}; do
echo "Install ${PACKAGE_NAME}@${PACKAGE_VERSION}"
npm install ${PACKAGE_NAME}@${PACKAGE_VERSION} --registry=${TOOLCACHE_REGISTRY}
npm install ${PACKAGE_NAME}@${PACKAGE_VERSION}
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "${PACKAGE_NAME}@${PACKAGE_VERSION} installation failure; Error:${exit_code}"
exit 1
fi
done;
done;
popd
DocumentInstalledItem "Python:"
pythons=$(ls $AGENT_TOOLSDIRECTORY/Python)
for python in $pythons; do
@@ -45,4 +65,4 @@ DocumentInstalledItem "PyPy:"
pypys=$(ls $AGENT_TOOLSDIRECTORY/PyPy)
for pypy in $pypys; do
DocumentInstalledItemIndent "PyPy $pypy"
done;
done;