@@ -39,19 +39,18 @@ node("docker-ubuntu20-xlarge") {
3939 identifier = ' v2-jf'
4040 nodeVersion = ' v8.17.0'
4141
42- masterBranch = ' master'
43-
4442 releaseVersion = ' '
4543
4644 repo = ' jfrog-cli'
4745 sh ' rm -rf temp'
4846 sh ' mkdir temp'
49- def goRoot = tool ' go-1.25.4 '
47+ def goRoot = tool ' go-1.25.5 '
5048 env. GOROOT = " $goRoot "
5149 env. PATH + = " :${ goRoot} /bin:/tmp/node-${ nodeVersion} -linux-x64/bin"
5250 env. GO111MODULE = " on"
5351 env. CI = true
54- env. JFROG_CLI_LOG_LEVEL = " DEBUG"
52+ env. JFROG_CLI_LOG_LEVEL = " INFO"
53+ env. JFROG_CLI_REPORT_USAGE = " false"
5554
5655 dir(' temp' ) {
5756 sh " cat /etc/lsb-release"
@@ -160,6 +159,7 @@ def runRelease(architectures) {
160159 stage(" Publish latest scripts" ) {
161160 withCredentials([string(credentialsId : ' jfrog-cli-automation' , variable : ' JFROG_CLI_AUTOMATION_ACCESS_TOKEN' )]) {
162161 options = " --url https://releases.jfrog.io/artifactory --access-token=$JFROG_CLI_AUTOMATION_ACCESS_TOKEN "
162+ print " Copying latest scripts from jfrog-cli/$identifier /$version /scripts/ to jfrog-cli/$identifier /scripts/"
163163 sh """ #!/bin/bash
164164 $builderPath rt cp jfrog-cli/$identifier /$version /scripts/getCli.sh jfrog-cli/$identifier /scripts/ --flat $options --fail-no-op
165165 $builderPath rt cp jfrog-cli/$identifier /$version /scripts/install-cli.sh jfrog-cli/$identifier /scripts/ --flat $options --fail-no-op
@@ -212,7 +212,6 @@ def runRelease(architectures) {
212212
213213def setReleaseVersion () {
214214 dir(" $cliWorkspace /$repo " ) {
215- sh " git checkout $masterBranch "
216215 sh " build/build.sh"
217216 releaseVersion = getCliVersion(" ./jf" )
218217 }
@@ -337,7 +336,9 @@ def uploadCli(architectures) {
337336 stage(" Build and upload ${ currentBuild.pkg} " ) {
338337 // MacOS binaries should be downloaded from GitHub packages, as they are signed there.
339338 if (currentBuild. goos == ' darwin' ) {
340- uploadSignedDarwinBinaries(currentBuild. goarch,currentBuild. pkg)
339+ if (params. RUN_DARWIN_WORKFLOW ) {
340+ uploadSignedDarwinBinaries(currentBuild. goarch,currentBuild. pkg)
341+ }
341342 } else {
342343 buildAndUpload(currentBuild. goos, currentBuild. goarch, currentBuild. pkg, currentBuild. fileExtension)
343344 }
@@ -395,30 +396,35 @@ def pushDockerImageVersion(name, version) {
395396}
396397
397398def uploadGetCliToJfrogRepo21 () {
399+ print " Uploading $jfrogCliRepoDir /build/getcli/${ cliExecutableName} .sh to ecosys-jfrog-cli/$identifier /$version /scripts/getCli.sh"
398400 sh """ #!/bin/bash
399401 $builderPath rt u $jfrogCliRepoDir /build/getcli/${ cliExecutableName} .sh ecosys-jfrog-cli/$identifier /$version /scripts/getCli.sh --flat
400402 """
401403}
402404
403405def uploadInstallCliToJfrogRepo21 () {
406+ print " Uploading $jfrogCliRepoDir /build/installcli/${ cliExecutableName} .sh to ecosys-jfrog-cli/$identifier /$version /scripts/install-cli.sh"
404407 sh """ #!/bin/bash
405408 $builderPath rt u $jfrogCliRepoDir /build/installcli/${ cliExecutableName} .sh ecosys-jfrog-cli/$identifier /$version /scripts/install-cli.sh --flat
406409 """
407410}
408411
409412def uploadSetupCliToJfrogRepo21 () {
413+ print " Uploading $jfrogCliRepoDir /build/setupcli/${ cliExecutableName} .sh to ecosys-jfrog-cli/$identifier /$version /scripts/setup-cli.sh"
410414 sh """ #!/bin/bash
411415 $builderPath rt u $jfrogCliRepoDir /build/setupcli/${ cliExecutableName} .sh ecosys-jfrog-cli/$identifier /$version /scripts/setup-cli.sh --flat
412416 """
413417}
414418
415419def uploadGitLabSetupToJfrogRepo21 () {
420+ print " Uploading $jfrogCliRepoDir /build/gitlab/(*) to ecosys-jfrog-cli/$identifier /$version /scripts/gitlab/{1}"
416421 sh """ #!/bin/bash
417422 $builderPath rt u "$jfrogCliRepoDir /build/gitlab/(*)" "ecosys-jfrog-cli/$identifier /$version /scripts/gitlab/{1}"
418423 """
419424}
420425
421426def uploadBinaryToJfrogRepo21 (pkg , fileName ) {
427+ print " Uploading $jfrogCliRepoDir /$fileName to ecosys-jfrog-cli/$identifier /$version /$pkg /"
422428 sh """ #!/bin/bash
423429 $builderPath rt u $jfrogCliRepoDir /$fileName ecosys-jfrog-cli/$identifier /$version /$pkg / --flat
424430 """
@@ -428,6 +434,7 @@ def build(goos, goarch, pkg, fileName) {
428434 dir(" ${ jfrogCliRepoDir} " ) {
429435 env. GOOS = " $goos "
430436 env. GOARCH = " $goarch "
437+ print " Building $fileName on $goos $goarch "
431438 sh " build/build.sh $fileName "
432439 sh " chmod +x $fileName "
433440 // Remove goos and goarch env var to prevent interfering with following builds.
@@ -458,7 +465,21 @@ def buildAndUpload(goos, goarch, pkg, fileExtension) {
458465}
459466
460467def distributeToReleases (stage , version , rbcSpecName ) {
461- sh """ $builderPath ds rbc $stage -rb-$identifier $version --spec=${ cliWorkspace} /${ repo} /build/release_specs/$rbcSpecName --spec-vars="VERSION=$version ;IDENTIFIER=$identifier " --sign"""
468+ sh """ #!/bin/bash
469+ output=\$ ($builderPath ds rbc $stage -rb-$identifier $version --spec=${ cliWorkspace} /${ repo} /build/release_specs/$rbcSpecName --spec-vars="VERSION=$version ;IDENTIFIER=$identifier " --sign 2>&1)
470+ exit_code=\$ ?
471+ if [[ \$ exit_code -ne 0 ]]; then
472+ if echo "\$ output" | grep -q "already exists"; then
473+ echo "Release bundle creation skipped - already exists"
474+ exit 0
475+ else
476+ echo "\$ output"
477+ exit \$ exit_code
478+ fi
479+ else
480+ echo "\$ output"
481+ fi
482+ """
462483 sh " $builderPath ds rbd $stage -rb-$identifier $version --site=releases.jfrog.io --sync"
463484}
464485
@@ -468,7 +489,19 @@ def publishNpmPackage(jfrogCliRepoDir) {
468489 sh ''' #!/bin/bash
469490 echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
470491 echo "registry=https://registry.npmjs.org" >> .npmrc
471- npm publish
492+ output=$(npm publish 2>&1)
493+ exit_code=$?
494+ if [[ $exit_code -ne 0 ]]; then
495+ if echo "$output" | grep -qi "You cannot publish over the previously published versions"; then
496+ echo "NPM package publish skipped - already exists"
497+ exit 0
498+ else
499+ echo "$output"
500+ exit $exit_code
501+ fi
502+ else
503+ echo "$output"
504+ fi
472505 '''
473506 }
474507 }
0 commit comments