ensure npm deps are installed in jenkins pipelines

This commit is contained in:
Roman Volosovskyi 2018-01-03 13:21:54 +02:00
parent b267a3017a
commit 558fc8fd62
No known key found for this signature in database
GPG Key ID: 37135489EAE4B2D7
3 changed files with 40 additions and 4 deletions

15
Jenkinsfile vendored
View File

@ -2,6 +2,17 @@ env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8"
def installJSDeps() {
def attempt = 1
def maxAttempts = 10
def installed = false
while (!installed && attempt <= maxAttempts) {
println "#${attempt} attempt to install npm deps"
sh 'npm install'
installed = fileExists('node_modules/web3/index.js')
}
}
node ('macos1') {
def apkUrl = ''
def ipaUrl = ''
@ -22,7 +33,8 @@ node ('macos1') {
sh 'rm -rf node_modules'
sh 'cp .env.jenkins .env'
sh 'lein deps && npm install'
sh 'lein deps'
installJSDeps()
sh '[ -f node_modules/react-native/packager/src/JSTransformer/index.js ] && sed -i "" "s/301000/1201000/g" node_modules/react-native/packager/src/JSTransformer/index.js || echo "New packager"'
// Fix silly RN upgrade weird env issue
@ -30,7 +42,6 @@ node ('macos1') {
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
sh 'cd ios && pod install && cd ..'
sh 'npm install'
}
stage('Tests') {

View File

@ -5,6 +5,17 @@ env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8"
def installJSDeps() {
def attempt = 1
def maxAttempts = 10
def installed = false
while (!installed && attempt <= maxAttempts) {
println "#${attempt} attempt to install npm deps"
sh 'npm install'
installed = fileExists('node_modules/web3/index.js')
}
}
node ('macos1'){
def apkUrl = ''
def ipaUrl = ''
@ -23,7 +34,8 @@ node ('macos1'){
sh 'git checkout develop'
sh 'rm -rf node_modules'
sh 'cp .env.jenkins .env'
sh 'lein deps && npm install'
sh 'lein deps'
installJSDeps()
sh '[ -f node_modules/react-native/packager/src/JSTransformer/index.js ] && sed -i "" "s/301000/1201000/g" node_modules/react-native/packager/src/JSTransformer/index.js || echo "New packager"'
// Fix silly RN upgrade weird env issue

View File

@ -1,6 +1,18 @@
env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8"
def installJSDeps() {
def attempt = 1
def maxAttempts = 10
def installed = false
while (!installed && attempt <= maxAttempts) {
println "#${attempt} attempt to install npm deps"
sh 'npm install'
installed = fileExists('node_modules/web3/index.js')
}
}
node ('macos1') {
def apkUrl = ''
def ipaUrl = ''
@ -39,7 +51,8 @@ node ('macos1') {
sh 'cat .env'
sh 'echo "**********************************************************************"'
sh 'lein deps && npm install'
sh 'lein deps'
installJSDeps()
// Uncomment with RN merge
sh '[ -f node_modules/react-native/packager/src/JSTransformer/index.js ] && sed -i "" "s/301000/1201000/g" node_modules/react-native/packager/src/JSTransformer/index.js || echo "New packager"'
// sh 'sed -i "" "s/301000/1201000/g" node_modules/react-native/packager/src/JSTransformer/index.js'