Skip to content

Commit

Permalink
Release script - install npm earlier (#2298)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Nov 9, 2023
1 parent b9396ba commit a5e2d33
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -45,6 +46,10 @@ node("docker") {
}
}

stage('install npm') {
installNpm(nodeVersion)
}

stage('jf release phase') {
runRelease(architectures)
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a5e2d33

Please sign in to comment.