Skip to content
Merged
Show file tree
Hide file tree
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
49 changes: 41 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ node("docker-ubuntu20-xlarge") {
identifier = 'v2-jf'
nodeVersion = 'v8.17.0'

masterBranch = 'master'

releaseVersion = ''

repo = 'jfrog-cli'
sh 'rm -rf temp'
sh 'mkdir temp'
def goRoot = tool 'go-1.25.4'
def goRoot = tool 'go-1.25.5'
env.GOROOT="$goRoot"
env.PATH+=":${goRoot}/bin:/tmp/node-${nodeVersion}-linux-x64/bin"
env.GO111MODULE="on"
env.CI=true
env.JFROG_CLI_LOG_LEVEL="DEBUG"
env.JFROG_CLI_LOG_LEVEL="INFO"
env.JFROG_CLI_REPORT_USAGE="false"

dir('temp') {
sh "cat /etc/lsb-release"
Expand Down Expand Up @@ -160,6 +159,7 @@ def runRelease(architectures) {
stage("Publish latest scripts") {
withCredentials([string(credentialsId: 'jfrog-cli-automation', variable: 'JFROG_CLI_AUTOMATION_ACCESS_TOKEN')]) {
options = "--url https://releases.jfrog.io/artifactory --access-token=$JFROG_CLI_AUTOMATION_ACCESS_TOKEN"
print "Copying latest scripts from jfrog-cli/$identifier/$version/scripts/ to jfrog-cli/$identifier/scripts/"
sh """#!/bin/bash
$builderPath rt cp jfrog-cli/$identifier/$version/scripts/getCli.sh jfrog-cli/$identifier/scripts/ --flat $options --fail-no-op
$builderPath rt cp jfrog-cli/$identifier/$version/scripts/install-cli.sh jfrog-cli/$identifier/scripts/ --flat $options --fail-no-op
Expand Down Expand Up @@ -212,7 +212,6 @@ def runRelease(architectures) {

def setReleaseVersion() {
dir("$cliWorkspace/$repo") {
sh "git checkout $masterBranch"
sh "build/build.sh"
releaseVersion = getCliVersion("./jf")
}
Expand Down Expand Up @@ -337,7 +336,9 @@ def uploadCli(architectures) {
stage("Build and upload ${currentBuild.pkg}") {
// MacOS binaries should be downloaded from GitHub packages, as they are signed there.
if (currentBuild.goos == 'darwin') {
uploadSignedDarwinBinaries(currentBuild.goarch,currentBuild.pkg)
if (params.RUN_DARWIN_WORKFLOW) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if RUN_DARWIN_WORKFLOW is false ? Nothing builds ?

uploadSignedDarwinBinaries(currentBuild.goarch,currentBuild.pkg)
}
} else {
buildAndUpload(currentBuild.goos, currentBuild.goarch, currentBuild.pkg, currentBuild.fileExtension)
}
Expand Down Expand Up @@ -395,30 +396,35 @@ def pushDockerImageVersion(name, version) {
}

def uploadGetCliToJfrogRepo21() {
print "Uploading $jfrogCliRepoDir/build/getcli/${cliExecutableName}.sh to ecosys-jfrog-cli/$identifier/$version/scripts/getCli.sh"
sh """#!/bin/bash
$builderPath rt u $jfrogCliRepoDir/build/getcli/${cliExecutableName}.sh ecosys-jfrog-cli/$identifier/$version/scripts/getCli.sh --flat
"""
}

def uploadInstallCliToJfrogRepo21() {
print "Uploading $jfrogCliRepoDir/build/installcli/${cliExecutableName}.sh to ecosys-jfrog-cli/$identifier/$version/scripts/install-cli.sh"
sh """#!/bin/bash
$builderPath rt u $jfrogCliRepoDir/build/installcli/${cliExecutableName}.sh ecosys-jfrog-cli/$identifier/$version/scripts/install-cli.sh --flat
"""
}

def uploadSetupCliToJfrogRepo21() {
print "Uploading $jfrogCliRepoDir/build/setupcli/${cliExecutableName}.sh to ecosys-jfrog-cli/$identifier/$version/scripts/setup-cli.sh"
sh """#!/bin/bash
$builderPath rt u $jfrogCliRepoDir/build/setupcli/${cliExecutableName}.sh ecosys-jfrog-cli/$identifier/$version/scripts/setup-cli.sh --flat
"""
}

def uploadGitLabSetupToJfrogRepo21() {
print "Uploading $jfrogCliRepoDir/build/gitlab/(*) to ecosys-jfrog-cli/$identifier/$version/scripts/gitlab/{1}"
sh """#!/bin/bash
$builderPath rt u "$jfrogCliRepoDir/build/gitlab/(*)" "ecosys-jfrog-cli/$identifier/$version/scripts/gitlab/{1}"
"""
}

def uploadBinaryToJfrogRepo21(pkg, fileName) {
print "Uploading $jfrogCliRepoDir/$fileName to ecosys-jfrog-cli/$identifier/$version/$pkg/"
sh """#!/bin/bash
$builderPath rt u $jfrogCliRepoDir/$fileName ecosys-jfrog-cli/$identifier/$version/$pkg/ --flat
"""
Expand All @@ -428,6 +434,7 @@ def build(goos, goarch, pkg, fileName) {
dir("${jfrogCliRepoDir}") {
env.GOOS="$goos"
env.GOARCH="$goarch"
print "Building $fileName on $goos $goarch"
sh "build/build.sh $fileName"
sh "chmod +x $fileName"
// Remove goos and goarch env var to prevent interfering with following builds.
Expand Down Expand Up @@ -458,7 +465,21 @@ def buildAndUpload(goos, goarch, pkg, fileExtension) {
}

def distributeToReleases(stage, version, rbcSpecName) {
sh """$builderPath ds rbc $stage-rb-$identifier $version --spec=${cliWorkspace}/${repo}/build/release_specs/$rbcSpecName --spec-vars="VERSION=$version;IDENTIFIER=$identifier" --sign"""
sh """#!/bin/bash
output=\$($builderPath ds rbc $stage-rb-$identifier $version --spec=${cliWorkspace}/${repo}/build/release_specs/$rbcSpecName --spec-vars="VERSION=$version;IDENTIFIER=$identifier" --sign 2>&1)
exit_code=\$?
if [[ \$exit_code -ne 0 ]]; then
if echo "\$output" | grep -q "already exists"; then
echo "Release bundle creation skipped - already exists"
exit 0
else
echo "\$output"
exit \$exit_code
fi
else
echo "\$output"
fi
"""
sh "$builderPath ds rbd $stage-rb-$identifier $version --site=releases.jfrog.io --sync"
}

Expand All @@ -468,7 +489,19 @@ def publishNpmPackage(jfrogCliRepoDir) {
sh '''#!/bin/bash
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > .npmrc
echo "registry=https://registry.npmjs.org" >> .npmrc
npm publish
output=$(npm publish 2>&1)
exit_code=$?
if [[ $exit_code -ne 0 ]]; then
if echo "$output" | grep -qi "You cannot publish over the previously published versions"; then
echo "NPM package publish skipped - already exists"
exit 0
else
echo "$output"
exit $exit_code
fi
else
echo "$output"
fi
'''
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG repo_name_21
# Remove ${repo_name_21} to pull from Docker Hub.
FROM ${repo_name_21}/jfrog-docker/golang:1.25.4-alpine as builder
FROM ${repo_name_21}/jfrog-docker/golang:1.25.5-alpine as builder
ARG image_name=jfrog-cli
ARG cli_executable_name
WORKDIR /${image_name}
Expand Down
Loading