Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
562b48cf
Commit
562b48cf
authored
Nov 10, 2016
by
Ben Patterson
Committed by
GitHub
Nov 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13911 from edx/benp/nodeenv
Use nodeenv to manage node version in Jenkins builds
parents
2c86a6dd
b3a3d729
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
pavelib/prereqs.py
+1
-1
scripts/jenkins-common.sh
+33
-1
No files found.
pavelib/prereqs.py
View file @
562b48cf
...
...
@@ -15,7 +15,7 @@ from .utils.timer import timed
PREREQS_STATE_DIR
=
os
.
getenv
(
'PREREQ_CACHE_DIR'
,
Env
.
REPO_ROOT
/
'.prereqs_cache'
)
NPM_REGISTRY
=
"http://registry.npmjs.org/"
NPM_REGISTRY
=
"http
s
://registry.npmjs.org/"
NO_PREREQ_MESSAGE
=
"NO_PREREQ_INSTALL is set, not installing prereqs"
COVERAGE_REQ_FILE
=
'requirements/edx/coverage.txt'
...
...
scripts/jenkins-common.sh
View file @
562b48cf
...
...
@@ -4,6 +4,11 @@ set -e
source
$HOME
/jenkins_env
NODE_ENV_DIR
=
$HOME
/nenv
NODE_VERSION
=
0.10.37
NODE_INSTALL_COMMAND
=
"nodeenv --node=
$NODE_VERSION
--prebuilt
$NODE_ENV_DIR
--force"
# Clear the mongo database
# Note that this prevents us from running jobs in parallel on a single worker.
mongo
--quiet
--eval
'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
...
...
@@ -24,9 +29,36 @@ fi
# Activate the Python virtualenv
source
$HOME
/edx-venv/bin/activate
# add the node
_js
packages dir to PATH
# add the node packages dir to PATH
PATH
=
$PATH
:node_modules/.bin
echo
"setting up nodeenv"
pip install nodeenv
# Ensure we are starting with a clean node env directory
rm
-rf
$NODE_ENV_DIR
# Occasionally, the command to install node hangs. We need to catch that and retry.
# Note that this will retry even if the command itself fails.
WAIT_COUNT
=
0
until
timeout 30s
$NODE_INSTALL_COMMAND
||
[
$WAIT_COUNT
-eq
2
]
;
do
echo
"re-trying to install node version..."
sleep 2
WAIT_COUNT
=
$((
WAIT_COUNT+1
))
done
# If we tried the max number of times, we need to quit.
if
[
$WAIT_COUNT
-eq
2
]
;
then
echo
"Node environment installation command was not successful. Exiting."
exit
1
fi
source
$NODE_ENV_DIR
/bin/activate
echo
"done setting up nodeenv"
echo
"node version is
`
node
--version
`
"
echo
"npm version is
`
npm
--version
`
"
# TODO: Provide a cached node_modules/ directory for faster/smaller installs
# Manage the npm cache on Jenkins.
# (In this case, remove it. That ensures from run-to-run, it is a clean npm environment)
echo
"--> Cleaning npm cache"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment