Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Sep 12, 2024
1 parent be50054 commit 4f65153
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/main/java/io/jenkins/plugins/jfrog/JfStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ private void logIfNoToolProvided(EnvVars env, TaskListener listener) {
/**
* Configure all JFrog relevant environment variables and all servers (if they haven't been configured yet).
*
* @param run running as part of a specific build
* @param env environment variables applicable to this step
* @param launcher a way to start processes
* @param listener a place to send output
* @param workspace a workspace to use for any file operations
* @param run running as part of a specific build
* @param env environment variables applicable to this step
* @param launcher a way to start processes
* @param listener a place to send output
* @param workspace a workspace to use for any file operations
* @return launcher applicable to this step.
* @throws InterruptedException if the step is interrupted
* @throws IOException in case of any I/O error, or we failed to run the 'jf' command
Expand Down Expand Up @@ -220,13 +220,12 @@ private void addConfigArguments(ArgumentListBuilder builder, JFrogPlatformInstan
builder.add(jfrogBinaryPath).add("c").add("add").add(jfrogPlatformInstance.getId());
// Add credentials
StringCredentials accessTokenCredentials = PluginsUtils.accessTokenCredentialsLookup(credentialsId, job);
// Access Token
if (accessTokenCredentials != null) {
builder.addMasked("--access-token=" + accessTokenCredentials.getSecret().getPlainText());
} else {
Credentials credentials = PluginsUtils.credentialsLookup(credentialsId, job);
builder.add("--user=" + credentials.getUsername());


// Use password-stdin if available
if (isCliVersionGreaterThanOrEqual(this.currentCliVersion, MIN_CLI_VERSION_PASSWORD_STDIN)) {
builder.add("--password-stdin");
Expand Down Expand Up @@ -315,7 +314,7 @@ String getJfrogCliVersion(Launcher.ProcStarter launcher) throws IOException, Int
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ArgumentListBuilder builder = new ArgumentListBuilder();
builder.add(jfrogBinaryPath).add("--version");
builder.add(jfrogBinaryPath).add("-v");
int exitCode = launcher
.cmds(builder)
.pwd(launcher.pwd())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public void testJFrogCliInstallationFromArtifactory(JenkinsRule jenkins) throws
// Download the latest CLI version.
// Using remote repository to 'releases.jfrog.io' in the client's Artifactory.
configureJfrogCliFromArtifactory(JFROG_CLI_TOOL_NAME_1, TEST_CONFIGURED_SERVER_ID, getRepoKey(TestRepository.CLI_REMOTE_REPO), true);
WorkflowRun job = runPipeline(jenkins, "basic_version_command");
assertTrue(job.getLog().contains("jf version "));
runPipeline(jenkins, "basic_version_command");
}

// Gets JfrogInstallation directory in Jenkins work root.
Expand Down

0 comments on commit 4f65153

Please sign in to comment.