diff --git a/next/Jenkinsfile b/next/Jenkinsfile index 589d003e2..2e78698c8 100644 --- a/next/Jenkinsfile +++ b/next/Jenkinsfile @@ -61,7 +61,7 @@ spec: container('theia-dev') { withCredentials([string(credentialsId: "github-bot-token", variable: 'GITHUB_TOKEN')]) { script { - buildNext(false, 1200) + buildNext('linux') } } } @@ -78,7 +78,9 @@ spec: } steps { script { - buildNext(false, 60) + sh "npm config set registry https://registry.npmjs.org/" + buildNext('mac') + sh "npm config set registry https://registry.npmjs.org/" } } post { @@ -94,8 +96,8 @@ spec: steps { script { sh "npm config set msvs_version 2017" - sh "npx node-gyp install 14.20.0" - buildNext(true, 60) + // sh "npx node-gyp@9.4.0 install 14.20.0" + // buildNext('windows') } } post { @@ -123,70 +125,148 @@ spec: } } -def buildNext(boolean runTests, int sleepBetweenRetries) { - int MAX_RETRY = 3 +def buildNext(String os) { - checkout scm + def VERDACCIO_CONFIG = "uninit" + def VERDACCIO_UPDATE_CONFIG_SCRIPT = "uninit" + + if (os == 'mac') { + echo "mac" + VERDACCIO_CONFIG = """/Users/genie.theia/.config/verdaccio/config.yaml""" + VERDACCIO_UPDATE_CONFIG_SCRIPT = """sed -i -e s/\\\$authenticated/\\\$anonymous/g /Users/genie.theia/.config/verdaccio/config.yaml""" + } + // else if (os == 'windows') { + // } + else { + echo "else" + VERDACCIO_CONFIG = """${env.WORKSPACE}/verdaccio/verdaccio/config.yaml""" + VERDACCIO_UPDATE_CONFIG_SCRIPT = """sed -i -e s/\\\$authenticated/\\\$anonymous/g ${env.WORKSPACE}/verdaccio/verdaccio/config.yaml""" + } - // merge next branch into master to get any known fixes for next version - // TODO there might be a more elegant way to merge a branch into this one - // using a jenkings plugin from here sh "git config user.email \"not@real.user\"" sh "git config user.name \"Not a real user\"" - sh "git fetch origin next" - sh "git merge FETCH_HEAD" sh "node --version" - sh "export NODE_OPTIONS=--max_old_space_size=4096" + cleanWs() + checkout scm + sh "git clone https://github.com/eclipse-theia/theia.git" - // regular build - sh "printenv && yarn cache dir" + sh """ + echo ${VERDACCIO_UPDATE_CONFIG_SCRIPT} + echo ${VERDACCIO_CONFIG} + mkdir cache + export LOCAL_CACHE_PATH=\${PWD}/cache + echo \$LOCAL_CACHE_PATH + export npm_config_cache=\$LOCAL_CACHE_PATH - sh "yarn cache clean" - try { - sh(script: 'yarn --frozen-lockfile --force') - } catch(error) { - retry(MAX_RETRY) { - sleep(sleepBetweenRetries) - echo "yarn failed - Retrying" - sh(script: 'yarn --frozen-lockfile --force') - } - } + echo "Install verdaccio" + mkdir verdaccio + export VERDACCIO_STORAGE_PATH=\${PWD}/verdaccio + echo \$VERDACCIO_STORAGE_PATH + cd verdaccio + touch .npmrc + mkdir node_modules + npm install verdaccio - echo "Updating theia versions to next" - sh "yarn update:next" - try { - sh(script: 'yarn --force') - } catch(error) { - retry(MAX_RETRY) { - sleep(sleepBetweenRetries) - echo "yarn failed - Retrying" - sh(script: 'yarn --force') - } - } + echo "Starting verdaccio" + REGISTRY=http://localhost:4873/ + node_modules/.bin/verdaccio & + VERDACCIO_PID=\$! + echo \$VERDACCIO_PID - echo "Upgrading versions" - sh "yarn upgrade" - sh "git clean -xfd" - try { - sh(script: 'yarn --force') - } catch(error) { - retry(MAX_RETRY) { - sleep(sleepBetweenRetries) - echo "yarn failed - Retrying" - sh(script: 'yarn --force') - } - } + echo "Reconfigure verdaccio" + sleep 20 && ps aux && kill \$VERDACCIO_PID && sleep 20 + \${VERDACCIO_UPDATE_CONFIG_SCRIPT} + cat \${VERDACCIO_CONFIG} - sh "rm -rf ./${distFolder}" - sh "yarn build" - sh "yarn download:plugins" - sshagent(['projects-storage.eclipse.org-bot-ssh']) { - sh "yarn electron package:preview" - } - if (runTests) { - wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) { - sh 'yarn electron test' - } - } + echo "Start verdaccio again" + node_modules/.bin/verdaccio & + VERDACCIO_PID=\$! + echo \$VERDACCIO_PID + + echo "Build Theia..." + cd ../theia + touch .npmrc + echo "registry=http://localhost:4873/" >> .npmrc + yarn + yarn build + + echo "Publish Theia..." + yarn lerna publish preminor --exact --canary --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --yes --registry \$REGISTRY + + echo "Build Blueprint..." + cd .. + yarn && yarn update:next + yarn --registry http://localhost:4873/ + yarn build && yarn download:plugins && yarn electron package + + echo "Stop Verdaccio" + kill \$VERDACCIO_PID + """ + + // int MAX_RETRY = 3 + + // checkout scm + + // // merge next branch into master to get any known fixes for next version + // // TODO there might be a more elegant way to merge a branch into this one + // // using a jenkings plugin from here + // sh "git config user.email \"not@real.user\"" + // sh "git config user.name \"Not a real user\"" + // sh "git fetch origin next" + // sh "git merge FETCH_HEAD" + // sh "node --version" + + // sh "export NODE_OPTIONS=--max_old_space_size=4096" + + // // regular build + // sh "printenv && yarn cache dir" + + // sh "yarn cache clean" + // try { + // sh(script: 'yarn --frozen-lockfile --force') + // } catch(error) { + // retry(MAX_RETRY) { + // sleep(sleepBetweenRetries) + // echo "yarn failed - Retrying" + // sh(script: 'yarn --frozen-lockfile --force') + // } + // } + + // echo "Updating theia versions to next" + // sh "yarn update:next" + // try { + // sh(script: 'yarn --force') + // } catch(error) { + // retry(MAX_RETRY) { + // sleep(sleepBetweenRetries) + // echo "yarn failed - Retrying" + // sh(script: 'yarn --force') + // } + // } + + // echo "Upgrading versions" + // sh "yarn upgrade" + // sh "git clean -xfd" + // try { + // sh(script: 'yarn --force') + // } catch(error) { + // retry(MAX_RETRY) { + // sleep(sleepBetweenRetries) + // echo "yarn failed - Retrying" + // sh(script: 'yarn --force') + // } + // } + + // sh "rm -rf ./${distFolder}" + // sh "yarn build" + // sh "yarn download:plugins" + // sshagent(['projects-storage.eclipse.org-bot-ssh']) { + // sh "yarn electron package:preview" + // } + // if (runTests) { + // wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) { + // sh 'yarn electron test' + // } + // } }