From 1b2367d6fc04621a6fe264e014010c85e59f9b12 Mon Sep 17 00:00:00 2001 From: delarea Date: Wed, 8 Jan 2025 11:29:45 +0200 Subject: [PATCH] make dirs --- src/main/java/io/jenkins/plugins/jfrog/JfStep.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/jenkins/plugins/jfrog/JfStep.java b/src/main/java/io/jenkins/plugins/jfrog/JfStep.java index 04dfec7e..dd1f3e74 100644 --- a/src/main/java/io/jenkins/plugins/jfrog/JfStep.java +++ b/src/main/java/io/jenkins/plugins/jfrog/JfStep.java @@ -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); @@ -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."); @@ -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);