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

Fix JFrog CLI's Chocolatey package deployment #857

Merged
merged 1 commit into from
Oct 13, 2020
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
11 changes: 6 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ node("docker") {
if ("$EXECUTION_MODE".toString().equals("Publish packages")) {
buildRpmAndDeb(version, architectures)

// Download cert files, to be used for signing the Windows executable, packaged by Chocolatey.
downloadToolsCert()
stage('Build and Publish Chocolatey') {
publishChocoPackage(version,jfrogCliRepoDir)
publishChocoPackage(version, jfrogCliRepoDir, architectures)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it is necessary

Suggested change
publishChocoPackage(version, jfrogCliRepoDir, architectures)
publishChocoPackage(version, jfrogCliRepoDir)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The publishChocoPackage function does not have access to the "global" architectures variable.
I also thought it does initially, but it doesn't.

}

stage('Npm Publish') {
Expand Down Expand Up @@ -200,17 +202,16 @@ def publishNpmPackage(jfrogCliRepoDir) {
}
}

def publishChocoPackage(version,jfrogCliRepoDir) {
downloadToolsCert()
def architecture = architectures.find { it.goos == "windows" && it.goarch == "adm64" }
def publishChocoPackage(version, jfrogCliRepoDir, architectures) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def publishChocoPackage(version, jfrogCliRepoDir, architectures) {
def publishChocoPackage(version, jfrogCliRepoDir) {

def architecture = architectures.find { it.goos == 'windows' && it.goarch == 'amd64' }
build(architecture.goos, architecture.goarch, architecture.pkg, 'jfrog.exe')
dir(jfrogCliRepoDir+'build/chocolatey') {
withCredentials([string(credentialsId: 'choco-api-key', variable: 'CHOCO_API_KEY')]) {
sh """#!/bin/bash
mv $jfrogCliRepoDir/jfrog.exe $jfrogCliRepoDir/build/chocolatey/tools
cp $jfrogCliRepoDir/LICENSE $jfrogCliRepoDir/build/chocolatey/tools
docker run -v \$PWD:/work -w /work $architecture.chocoImage pack version=$version
docker run -v \$PWD:/work -w /work $architecture.chocoImage push --apiKey \$CHOCO_API_KEY jfrog-cli.$version.nupkg
docker run -v \$PWD:/work -w /work $architecture.chocoImage push --apiKey \$CHOCO_API_KEY jfrog-cli.${version}.nupkg
"""
}
}
Expand Down