Skip to content

Commit

Permalink
make dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Jan 8, 2025
1 parent a653aa3 commit 1b2367d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/io/jenkins/plugins/jfrog/JfStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected String run() throws Exception {
EnvVars env = getContext().get(EnvVars.class);
Run<?, ?> run = getContext().get(Run.class);

workspace.mkdirs();
boolean isWindows = !launcher.isUnix();
String jfrogBinaryPath = getJFrogCLIPath(env, isWindows);
boolean passwordStdinSupported = isPasswordStdinSupported(workspace, env, launcher, jfrogBinaryPath);
Expand Down Expand Up @@ -144,6 +145,7 @@ protected String run() throws Exception {
public boolean isPasswordStdinSupported(FilePath workspace, EnvVars env, Launcher launcher, String jfrogBinaryPath) throws IOException, InterruptedException {
TaskListener listener = getContext().get(TaskListener.class);
JenkinsBuildInfoLog buildInfoLog = new JenkinsBuildInfoLog(listener);

boolean isPluginLauncher = launcher.getClass().getName().contains("org.jenkinsci.plugins");
if (isPluginLauncher) {
buildInfoLog.info("Launcher is a plugin launcher. Password stdin is not supported.");
Expand All @@ -160,7 +162,10 @@ public boolean isPasswordStdinSupported(FilePath workspace, EnvVars env, Launche
}

static String getJFrogCLIPath(EnvVars env, boolean isWindows) {
// JFROG_BINARY_PATH is set according to the master OS. If not configured, the value of jfrogBinaryPath will
// eventually be 'jf' or 'jf.exe'. In that case, the JFrog CLI from the system path is used.
String jfrogBinaryPath = Paths.get(env.get(JFROG_BINARY_PATH, ""), Utils.getJfrogCliBinaryName(isWindows)).toString();
// Modify jfrogBinaryPath according to the agent's OS
return isWindows ?
FilenameUtils.separatorsToWindows(jfrogBinaryPath) :
FilenameUtils.separatorsToUnix(jfrogBinaryPath);
Expand Down

0 comments on commit 1b2367d

Please sign in to comment.