author Michael Ratcliffe <mratcliffe@mozilla.com>
Mon, 02 May 2016 00:22:31 +0100
changeset 338722 b4564c057f93c736521672ffa54b23d9b4c92b94
permissions -rwxr-xr-x
Bug 1265082 - ESLint jobs are apparently hitting the network r=me,dustin,pbro,jryans So a few changes here: - node_modules is downloaded using tooltool so that we dont need to rely on external infrastructure. - We have a npm-shrinkwrap.json file that version locks all of our node packages. - eslint, eslint-plugin-mozilla etc. are now all installed locally. In reality this means that we don't hit the network and we don't force users into installing global packages. ./mach eslint --setup has also been improved. We install packages locally and display the path of the user's eslint binary (useful for configuring editors). eslint-plugin-mozilla has been moved from testing/eslint-plugin-mozilla to /testing/eslint/eslint-plugin-mozilla. The node_modules directory for eslint and other plugins is located in testing/eslint/. MozReview-Commit-ID: 4SFSxzka6BS

# Force the scripts working directory to be projdir/testing/eslint.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR

echo "To complete this script you will need the following tokens from https://api.pub.build.mozilla.org/tokenauth/"
echo " - tooltool.upload.public"
echo " - tooltool.download.public"
echo ""
read -p "Are these tokens visible at the above URL (y/n)?" choice
case "$choice" in
  y|Y )
    echo ""
    echo "1. Go to https://api.pub.build.mozilla.org/"
    echo "2. Log In using your Mozilla LDAP account."
    echo "3. Click on \"Tokens.\""
    echo "4. Issue a user token with the permissions tooltool.upload.public and tooltool.download.public."
    echo ""
    echo "When you click issue you will be presented with a long string. Paste the string into a temporary file called ~/.tooltool-token."
    echo ""
    read -rsp $'Press any key to continue...\n' -n 1
  n|N )
    echo ""
    echo "You will need to contact somebody that has these permissions... people most likely to have these permissions are members of the releng, ateam, a sheriff or mratcliffe@mozilla.com."
    exit 1
  * )
    echo ""
  echo "Invalid input."

echo ""
echo "Removing node_modules and npm_shrinkwrap.json..."
rm -rf node_modules/
rm npm-shrinkwrap.json

echo "Installing eslint and dependencies..."
../../mach eslint --setup

echo "Creating npm shrinkwrap..."
npm shrinkwrap

echo "Creating eslint.tar.gz..."
tar cvfz eslint.tar.gz node_modules

echo "Downloading tooltool..."
wget https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py
chmod +x tooltool.py

echo "Adding eslint.tar.gz to tooltool..."
rm manifest.tt
./tooltool.py add --visibility public eslint.tar.gz

echo "Uploading eslint.tar.gz to tooltool..."
./tooltool.py upload --authentication-file=~/.tooltool-token --message "node_modules folder update for testing/eslint"

echo "Cleaning up..."
rm eslint.tar.gz
rm tooltool.py

echo ""
echo "Update complete, please commit and check in your changes."