From 82e26c935ef1bee00a3145beb8eb94b3cdc3a398 Mon Sep 17 00:00:00 2001 From: yahavi Date: Wed, 8 Nov 2023 15:23:25 +0200 Subject: [PATCH] Release script - install npm earlier --- Jenkinsfile | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aed8e48b1..df9c92979 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,13 +21,14 @@ node("docker") { cliExecutableName = 'jf' identifier = 'v2-jf' + nodeVersion = 'v8.17.0' repo = 'jfrog-cli' sh 'rm -rf temp' sh 'mkdir temp' def goRoot = tool 'go-1.20.10' env.GOROOT="$goRoot" - env.PATH+=":${goRoot}/bin" + env.PATH+=":${goRoot}/bin:/tmp/node-${nodeVersion}-linux-x64/bin" env.GO111MODULE="on" env.CI=true env.JFROG_CLI_LOG_LEVEL="DEBUG" @@ -45,6 +46,10 @@ node("docker") { } } + stage('install npm') { + installNpm(nodeVersion) + } + stage('jf release phase') { runRelease(architectures) } @@ -395,19 +400,9 @@ def distributeToReleases(stage, version, rbcSpecName) { } def publishNpmPackage(jfrogCliRepoDir) { - dir('/tmp') { - sh '''#!/bin/bash - apt update - apt install wget -y - echo "Downloading npm..." - wget https://nodejs.org/dist/v8.17.0/node-v8.17.0-linux-x64.tar.xz - tar -xvf node-v8.17.0-linux-x64.tar.xz - ''' - } dir(jfrogCliRepoDir+"build/npm/$identifier") { withCredentials([string(credentialsId: 'npm-authorization', variable: 'NPM_AUTH_TOKEN')]) { sh '''#!/bin/bash - export PATH=/tmp/node-v8.17.0-linux-x64/bin:$PATH echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc echo "registry=https://registry.npmjs.org" >> .npmrc npm publish @@ -416,6 +411,18 @@ def publishNpmPackage(jfrogCliRepoDir) { } } +def installNpm(nodeVersion) { + dir('/tmp') { + sh """#!/bin/bash + apt update + apt install wget -y + echo "Downloading npm..." + wget https://nodejs.org/dist/${nodeVersion}/node-${nodeVersion}-linux-x64.tar.xz + tar -xf node-${nodeVersion}-linux-x64.tar.xz + """ + } +} + def publishChocoPackageWithRetries(version, jfrogCliRepoDir, architectures) { def maxAttempts = 10 def currentAttempt = 1