From 89510d0f9bbe6eb066e5e9e15db1a15ceeca975b Mon Sep 17 00:00:00 2001 From: IL-Automation Date: Sun, 7 Jan 2024 20:04:23 +0000 Subject: [PATCH 1/3] Bump version from 2.52.8 to 2.52.9 --- build/npm/v2-jf/package-lock.json | 2 +- build/npm/v2-jf/package.json | 2 +- build/npm/v2/package-lock.json | 2 +- build/npm/v2/package.json | 2 +- utils/cliutils/cli_consts.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/npm/v2-jf/package-lock.json b/build/npm/v2-jf/package-lock.json index 344188761..239796521 100644 --- a/build/npm/v2-jf/package-lock.json +++ b/build/npm/v2-jf/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.8", + "version": "2.52.9", "lockfileVersion": 1 } diff --git a/build/npm/v2-jf/package.json b/build/npm/v2-jf/package.json index 421d61552..bcbaab171 100644 --- a/build/npm/v2-jf/package.json +++ b/build/npm/v2-jf/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.8", + "version": "2.52.9", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/build/npm/v2/package-lock.json b/build/npm/v2/package-lock.json index fdc085730..bd4b3db87 100644 --- a/build/npm/v2/package-lock.json +++ b/build/npm/v2/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2", - "version": "2.52.8", + "version": "2.52.9", "lockfileVersion": 2 } diff --git a/build/npm/v2/package.json b/build/npm/v2/package.json index 6d4bd45d3..0cf3008e4 100644 --- a/build/npm/v2/package.json +++ b/build/npm/v2/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2", - "version": "2.52.8", + "version": "2.52.9", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/utils/cliutils/cli_consts.go b/utils/cliutils/cli_consts.go index f56408079..6cd1a2f8d 100644 --- a/utils/cliutils/cli_consts.go +++ b/utils/cliutils/cli_consts.go @@ -4,7 +4,7 @@ import "time" const ( // General CLI constants - CliVersion = "2.52.8" + CliVersion = "2.52.9" ClientAgent = "jfrog-cli-go" // CLI base commands constants: From 8bb855cbd47db47b5774f71c475306bd73afd61a Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Sun, 7 Jan 2024 23:44:52 +0200 Subject: [PATCH 2/3] Decouple bump-version.sh from Jenkinsfile (#2409) --- Jenkinsfile | 37 ++++++++++------------- build/bump-version.sh | 49 ++++++++++++++++++++++++++----- build/npm/v2-jf/package-lock.json | 2 +- build/npm/v2-jf/package.json | 2 +- build/npm/v2/package-lock.json | 2 +- build/npm/v2/package.json | 2 +- utils/cliutils/cli_consts.go | 2 +- 7 files changed, 62 insertions(+), 34 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4f230ec04..35e124208 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,6 +30,8 @@ node("docker") { devBranch = 'dev-v1' } + releaseVersion = '' + repo = 'jfrog-cli' sh 'rm -rf temp' sh 'mkdir temp' @@ -61,11 +63,9 @@ node("docker") { """ } - stage('Bump version') { - bumpVersion() - } - stage('Sync branches') { + setReleaseVersion() + validateReleaseVersion() synchronizeBranches() } @@ -112,7 +112,6 @@ def runRelease(architectures) { configRepo21() try { - validateReleaseVersion() if (identifier != "v2") { stage("Audit") { dir("$jfrogCliRepoDir") { @@ -174,22 +173,16 @@ def runRelease(architectures) { } } -def bumpVersion() { +def setReleaseVersion() { dir("$cliWorkspace/$repo") { - withCredentials([string(credentialsId: 'ecosystem-github-automation', variable: 'GITHUB_ACCESS_TOKEN')]) { - sh "git checkout $devBranch" - sh "build/build.sh" - fromVersion = getCliVersion("./jf") - sh "build/bump-version.sh $fromVersion $RELEASE_VERSION" - sh "git commit -m \"Bump version from $fromVersion to $RELEASE_VERSION\"" - sh "git push \"https://$GITHUB_ACCESS_TOKEN@github.com/jfrog/jfrog-cli.git\"" - } + sh "git checkout $devBranch" + sh "build/build.sh" + releaseVersion = getCliVersion("./jf") } } def synchronizeBranches() { dir("$cliWorkspace/$repo") { - releaseTag = "v$RELEASE_VERSION" withCredentials([string(credentialsId: 'ecosystem-github-automation', variable: 'GITHUB_ACCESS_TOKEN')]) { print "Merge to $masterBranch" sh """#!/bin/bash @@ -212,7 +205,7 @@ def synchronizeBranches() { def createTag() { stage('Create a tag and a GitHub release') { dir("$jfrogCliRepoDir") { - releaseTag = "v$RELEASE_VERSION" + releaseTag = "v$releaseVersion" withCredentials([string(credentialsId: 'ecosystem-github-automation', variable: 'GITHUB_ACCESS_TOKEN')]) { sh """#!/bin/bash git tag $releaseTag @@ -224,16 +217,16 @@ def createTag() { } def validateReleaseVersion() { - if (RELEASE_VERSION=="") { - error "RELEASE_VERSION parameter is mandatory on this execution mode" + if (releaseVersion=="") { + error "releaseVersion parameter is empty" } - if (RELEASE_VERSION.startsWith("v")) { - error "RELEASE_VERSION parameter should not start with a preceding \"v\"" + if (releaseVersion.startsWith("v")) { + error "releaseVersion parameter should not start with a preceding \"v\"" } // Verify version stands in semantic versioning. def pattern = /^2\.(\d+)\.(\d+)$/ - if (!(RELEASE_VERSION =~ pattern)) { - error "RELEASE_VERSION is not a valid version" + if (!(releaseVersion =~ pattern)) { + error "releaseVersion is not a valid version" } } diff --git a/build/bump-version.sh b/build/bump-version.sh index 47bd54b51..03a00bae4 100755 --- a/build/bump-version.sh +++ b/build/bump-version.sh @@ -1,13 +1,21 @@ #!/bin/bash +# Function to get fromVersion from a file +populateFromVersion() { + build/build.sh + fromVersion=$(./jf -v | tr -d 'jfrog version' | tr -d '\n') +} + # Function to validate arguments -validateArgs() { +validateArg() { # Check if both arguments are provided - if [ $# -ne 2 ]; then - echo "Error: Please provide exactly two arguments - fromVersion and toVersion." + if [ $# -ne 1 ]; then + echo "Error: Please provide exactly one argument - the version to bump." exit 1 fi +} +validateVersions() { # Extract arguments fromVersion=$1 toVersion=$2 @@ -23,6 +31,18 @@ validateArgs() { echo "Error: fromVersion and toVersion must have different values." exit 1 fi + + echo Bumping version from $fromVersion to $toVersion +} + +createBranch() { + branchName=bump-ver-from-$fromVersion-to-$toVersion + git remote add upstream https://github.com/jfrog/jfrog-cli.git + git checkout dev + git fetch upstream dev + git pull upstream dev + git push + git checkout -b $branchName } # Function to replace version in file @@ -62,15 +82,30 @@ replaceVersion() { git add "$filePath" } -# Call the function to validate arguments -validateArgs "$@" +## Validate the argument was received. +validateArg -# Add calls to the function to replace version in file with specified filePath values +## Read the script argument into the toVersion variable +toVersion=$1 + +## Call the function to populate the fromVersion argument from the current version of the local JFrog CLI binary +populateFromVersion + +## Call the function to validate arguments +validateVersions "$fromVersion" "$toVersion" + +## Create a new branch +createBranch + +## Add calls to the function to replace version in file with specified filePath values replaceVersion "utils/cliutils/cli_consts.go" "CliVersion = \"$fromVersion\"" "$fromVersion" "$toVersion" replaceVersion "build/npm/v2/package-lock.json" "\"version\": \"$fromVersion\"," "$fromVersion" "$toVersion" replaceVersion "build/npm/v2/package.json" "\"version\": \"$fromVersion\"," "$fromVersion" "$toVersion" replaceVersion "build/npm/v2-jf/package-lock.json" "\"version\": \"$fromVersion\"," "$fromVersion" "$toVersion" replaceVersion "build/npm/v2-jf/package.json" "\"version\": \"$fromVersion\"," "$fromVersion" "$toVersion" -# Print success message if validation and replacement pass +## Print success message if validation and replacement pass echo "Version bumped successfully." + +## Push the new branch, with the version bump +git push --set-upstream origin $branchName diff --git a/build/npm/v2-jf/package-lock.json b/build/npm/v2-jf/package-lock.json index 239796521..344188761 100644 --- a/build/npm/v2-jf/package-lock.json +++ b/build/npm/v2-jf/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.9", + "version": "2.52.8", "lockfileVersion": 1 } diff --git a/build/npm/v2-jf/package.json b/build/npm/v2-jf/package.json index bcbaab171..421d61552 100644 --- a/build/npm/v2-jf/package.json +++ b/build/npm/v2-jf/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.9", + "version": "2.52.8", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/build/npm/v2/package-lock.json b/build/npm/v2/package-lock.json index bd4b3db87..fdc085730 100644 --- a/build/npm/v2/package-lock.json +++ b/build/npm/v2/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2", - "version": "2.52.9", + "version": "2.52.8", "lockfileVersion": 2 } diff --git a/build/npm/v2/package.json b/build/npm/v2/package.json index 0cf3008e4..6d4bd45d3 100644 --- a/build/npm/v2/package.json +++ b/build/npm/v2/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2", - "version": "2.52.9", + "version": "2.52.8", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/utils/cliutils/cli_consts.go b/utils/cliutils/cli_consts.go index 6cd1a2f8d..f56408079 100644 --- a/utils/cliutils/cli_consts.go +++ b/utils/cliutils/cli_consts.go @@ -4,7 +4,7 @@ import "time" const ( // General CLI constants - CliVersion = "2.52.9" + CliVersion = "2.52.8" ClientAgent = "jfrog-cli-go" // CLI base commands constants: From 98bc97cd8ef8331385e82ba4a7e84ac89e8618ce Mon Sep 17 00:00:00 2001 From: Eyal Ben Moshe Date: Mon, 8 Jan 2024 00:00:00 +0200 Subject: [PATCH 3/3] Bump version from 2.52.8 to 2.52.9 (#2410) --- build/npm/v2-jf/package-lock.json | 2 +- build/npm/v2-jf/package.json | 2 +- build/npm/v2/package-lock.json | 2 +- build/npm/v2/package.json | 2 +- utils/cliutils/cli_consts.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/npm/v2-jf/package-lock.json b/build/npm/v2-jf/package-lock.json index 344188761..239796521 100644 --- a/build/npm/v2-jf/package-lock.json +++ b/build/npm/v2-jf/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.8", + "version": "2.52.9", "lockfileVersion": 1 } diff --git a/build/npm/v2-jf/package.json b/build/npm/v2-jf/package.json index 421d61552..bcbaab171 100644 --- a/build/npm/v2-jf/package.json +++ b/build/npm/v2-jf/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2-jf", - "version": "2.52.8", + "version": "2.52.9", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/build/npm/v2/package-lock.json b/build/npm/v2/package-lock.json index fdc085730..bd4b3db87 100644 --- a/build/npm/v2/package-lock.json +++ b/build/npm/v2/package-lock.json @@ -1,5 +1,5 @@ { "name": "jfrog-cli-v2", - "version": "2.52.8", + "version": "2.52.9", "lockfileVersion": 2 } diff --git a/build/npm/v2/package.json b/build/npm/v2/package.json index 6d4bd45d3..0cf3008e4 100644 --- a/build/npm/v2/package.json +++ b/build/npm/v2/package.json @@ -1,6 +1,6 @@ { "name": "jfrog-cli-v2", - "version": "2.52.8", + "version": "2.52.9", "description": "🐸 Command-line interface for JFrog Artifactory, Xray, Distribution, Pipelines and Mission Control 🐸", "homepage": "https://github.com/jfrog/jfrog-cli", "preferGlobal": true, diff --git a/utils/cliutils/cli_consts.go b/utils/cliutils/cli_consts.go index f56408079..6cd1a2f8d 100644 --- a/utils/cliutils/cli_consts.go +++ b/utils/cliutils/cli_consts.go @@ -4,7 +4,7 @@ import "time" const ( // General CLI constants - CliVersion = "2.52.8" + CliVersion = "2.52.9" ClientAgent = "jfrog-cli-go" // CLI base commands constants: