Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release script - install npm earlier #2298

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading