Skip to content

Commit 34005c6

Browse files
committed
Added new solution tasks
1 parent 1f81bc4 commit 34005c6

File tree

173 files changed

+4140
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+4140
-499
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @al3xanndru @ganeshborle @cotovanu-cristian @AlexandruCGhimisi @sgeorgescu-uipath @dbeje
1+
@aoltean16 @leonard-apostoaie @AndreiDinca24

GenerateHelpFiles.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ $ActivitiesFolders = @{"ExternalAppAuthenticationEntry" = "entries\\authenticati
1313
"RobotEntry" = "entries\\job\\RobotEntry";
1414
"TestProjectEntry" = "entries\\testExecutionTarget\\TestProjectEntry";
1515
"TestSetEntry" = "entries\\testExecutionTarget\\TestSetEntry";
16+
"UiPathSolutionDeletePackage" = "solutions\\UiPathSolutionDeletePackage";
17+
"UiPathSolutionDeploy" = "solutions\\UiPathSolutionDeploy";
18+
"UiPathSolutionActivateDeployment" = "solutions\\UiPathSolutionActivateDeployment";
19+
"UiPathSolutionUninstallDeployment" = "solutions\\UiPathSolutionUninstallDeployment";
20+
"UiPathSolutionDownloadConfig" = "solutions\\UiPathSolutionDownloadConfig";
21+
"UiPathSolutionDownloadPackage" = "solutions\\UiPathSolutionDownloadPackage";
22+
"UiPathSolutionUploadPackage" = "solutions\\UiPathSolutionUploadPackage";
23+
"UiPathSolutionPack" = "solutions\\UiPathSolutionPack";
1624
"UiPathAssets" = "UiPathAssets";
1725
"UiPathDeploy" = "UiPathDeploy";
1826
"UiPathPack" = "UiPathPack";

README.md

Lines changed: 7 additions & 320 deletions
Large diffs are not rendered by default.

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ resources:
3535
endpoint: "GitHub connection"
3636
- repository: fossa
3737
name: UiPath/AzurePipelinesTemplates
38-
ref: refs/tags/uipath.security.fossa.3.0.11
38+
ref: refs/tags/uipath.security.fossa.3.0.15
3939
type: github
4040
endpoint: "GitHub connection"
4141

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<packaging>hpi</packaging>
1414

1515
<properties>
16-
<revision>4.0</revision>
16+
<revision>6.0</revision>
1717
<changelist>999999-SNAPSHOT</changelist>
1818
<gitHubRepo>jenkinsci/uipath-automation-package-plugin</gitHubRepo>
1919
<jenkins.version>2.414.3</jenkins.version>
@@ -335,6 +335,7 @@
335335
<groupId>io.jenkins.plugins</groupId>
336336
<artifactId>bootstrap5-api</artifactId>
337337
<version>${bootstrap5-api.version}</version>
338+
<scope>test</scope>
338339
</dependency>
339340
<dependency>
340341
<groupId>io.jenkins.plugins</groupId>

src/main/java/com/uipath/uipathpackage/UiPathInstallPlatform.java

Lines changed: 72 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.kohsuke.stapler.QueryParameter;
2222

2323
import javax.annotation.Nonnull;
24+
import java.io.IOException;
2425
import java.io.PrintStream;
2526
import java.util.Map;
2627
import java.util.ArrayList;
@@ -69,49 +70,72 @@ public void perform(
6970
try {
7071
EnvVars envVars = TaskScopedEnvVarsManager.addRequiredEnvironmentVariables(run, env, listener);
7172

72-
cliConfiguration.updateSelectedCliVersionKey(run, cliVersion);
73-
boolean isSelectedCliAlreadyCached = cliConfiguration.getCliPath(launcher, envVars, cliVersion).isPresent();
73+
String scopedVersion = cliVersion;
74+
UiPathCliConfiguration.Configuration versionConfiguration = null;
75+
FilePath actualCliNupkgPath = null;
7476

75-
logger.println(isSelectedCliAlreadyCached ? "cli is already cached.." : "cli is not found in cache..");
77+
if (scopedVersion.contains("CustomVersion")) {
78+
if(StringUtils.isBlank(cliNupkgPath)){
79+
throw new AbortException("CustomVersion is selected, but path to local nupkg is not provided.");
80+
}
81+
try {
82+
actualCliNupkgPath = cliNupkgPath.contains("${WORKSPACE}") ?
83+
new FilePath(launcher.getChannel(), envVars.expand(cliNupkgPath)) :
84+
workspace.child(envVars.expand(cliNupkgPath));
7685

77-
if(this.forceInstall || !isSelectedCliAlreadyCached) {
86+
versionConfiguration = cliConfiguration.getConfigurationFromPackageName(actualCliNupkgPath.getBaseName());
87+
scopedVersion = versionConfiguration.getConfigurationUniqueId();
88+
cliConfiguration.AddCliConfiguration(scopedVersion, versionConfiguration);
89+
} catch (Exception e) {
90+
logger.println("Exception: " + e.getMessage());
91+
throw new AbortException("Failed to parse custom CLI version from path: " + cliNupkgPath + ". Make sure you didn't change default nupkg name downloaded from feed");
92+
}
93+
}
94+
else {
95+
versionConfiguration = cliConfiguration.getConfiguration(scopedVersion);
96+
}
97+
98+
logger.println("Validating CLI selected version: " + versionConfiguration.getDisplayName() + "...");
99+
validateCliCompatibility(versionConfiguration, logger, workspace);
78100

101+
boolean isSelectedCliAlreadyCached = cliConfiguration.getCliPath(launcher, envVars, scopedVersion).isPresent();
102+
103+
logger.println(isSelectedCliAlreadyCached ? "cli " + scopedVersion + " is already cached.." : "cli " + scopedVersion + " is not found in cache..");
104+
105+
if(this.forceInstall || !isSelectedCliAlreadyCached) {
79106
if(forceInstall) {
80-
logger.println("force installing the cli , any previous cache for version "+cliVersion+" will be invalidate..");
107+
logger.println("force installing the cli , any previous cache for version " + scopedVersion + " will be invalidated..");
81108
}
82109

83-
FilePath cliRootCacheDirPath = cliConfiguration.getCliRootCachedDirectoryPath(launcher, envVars, cliVersion);
110+
FilePath cliRootCacheDirPath = cliConfiguration.getCliRootCachedDirectoryPath(launcher, envVars, scopedVersion);
84111

85-
if(cliVersion.equals(cliConfiguration.getDefaultCliVersionKey())) {
112+
if(scopedVersion.equals(cliConfiguration.getDefaultCliVersionKey())) {
86113
logger.print("(caching) extracting the pre-packaged cli...");
87114
util.extractCliApp(cliRootCacheDirPath, listener, envVars);
88115

89-
} else if(StringUtils.isNotBlank(cliNupkgPath)) {
90-
91-
FilePath actualCliNupkgPath = cliNupkgPath.contains("${WORKSPACE}") ?
92-
new FilePath(launcher.getChannel(), envVars.expand(cliNupkgPath)) :
93-
workspace.child(envVars.expand(cliNupkgPath));
94-
116+
} else if(cliVersion.contains("CustomVersion") && StringUtils.isNotBlank(cliNupkgPath)) {
95117
if(!actualCliNupkgPath.exists()){
96118
logger.println("CliNupkgPath provided doesn't exists "+actualCliNupkgPath.getRemote());
97119
throw new AbortException(Messages.UiPathInstallPlatform_DescriptorImpl_Error_CliNupkgPath());
98120
}
99-
logger.print("(caching) extracting the provided cli-nuget...");
121+
logger.println("(caching) extracting provided cli-nuget from path " + actualCliNupkgPath.getRemote());
100122
actualCliNupkgPath.unzip(cliRootCacheDirPath);
101123
} else {
102-
UiPathCliConfiguration.Configuration configuration = cliConfiguration.getConfiguration().get(cliVersion);
103-
FilePath downloadsRootPath = cliConfiguration.getCliRootDownloadsDirectoryPath(launcher, envVars, cliVersion);
124+
UiPathCliConfiguration.Configuration configuration = cliConfiguration.getConfiguration().get(scopedVersion);
125+
FilePath downloadsRootPath = cliConfiguration.getCliRootDownloadsDirectoryPath(launcher, envVars, scopedVersion);
104126

105127
String fileName = configuration.getName().concat(".").concat(configuration.getVersion().getComplete()).concat(".nupkg");
106128

107129
FilePath downloadCliPath = downloadsRootPath.child(fileName);
108130
util.downloadCli(configuration.getFeedUrl(), downloadCliPath, listener);
109131

110-
logger.print("(caching) extracting the downloaded cli...");
132+
logger.println("(caching) extracting the downloaded cli...");
111133
downloadCliPath.unzip(cliRootCacheDirPath);
112134
}
113-
logger.println(" done!!");
135+
logger.println("Finished extraction for UipCLI version: " + scopedVersion);
114136
}
137+
138+
cliConfiguration.updateSelectedCliVersionKey(run, scopedVersion);
115139
} catch (Exception e) {
116140
if(traceLevel.equals(TraceLevel.Verbose) || traceLevel.equals(TraceLevel.Error)) {
117141
e.printStackTrace(logger);
@@ -120,6 +144,36 @@ public void perform(
120144
}
121145
}
122146

147+
private void validateCliCompatibility(UiPathCliConfiguration.Configuration cliSelectedVersion, PrintStream logger, FilePath workspace) throws AbortException {
148+
Computer computer = workspace.toComputer();
149+
if (computer == null) {
150+
throw new AbortException("Unable to determine the operating system of the agent.");
151+
}
152+
153+
String osName = null;
154+
try {
155+
osName = computer.getSystemProperties().get("os.name").toString().toLowerCase();
156+
} catch (IOException e) {
157+
throw new RuntimeException(e);
158+
} catch (InterruptedException e) {
159+
throw new RuntimeException(e);
160+
}
161+
162+
logger.println("Detected OS: " + osName);
163+
164+
if (osName.contains("win")) {
165+
if (cliSelectedVersion.getPlatform() != UiPathCliConfiguration.CliPlatform.Windows) {
166+
throw new AbortException("Selected UiPath CLI version '" + cliSelectedVersion.getDisplayName() + "' cannot be executed on Windows agent.");
167+
}
168+
} else if (osName.contains("linux")) {
169+
if (cliSelectedVersion.getPlatform() != UiPathCliConfiguration.CliPlatform.Linux) {
170+
throw new AbortException("Selected UiPath CLI version '" + cliSelectedVersion.getDisplayName() + "' cannot be executed on Linux agent.");
171+
}
172+
} else {
173+
throw new AbortException("Running on incompatible operating system");
174+
}
175+
}
176+
123177
@DataBoundSetter
124178
public void setCliVersion(String cliVersion) {
125179
this.cliVersion = cliVersion;

src/main/java/com/uipath/uipathpackage/UiPathPack.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class UiPathPack extends Builder implements SimpleBuildStep {
6262
* Data bound constructor responsible for setting the values param values to state
6363
*
6464
* @param version Entry version
65-
* @param projectJsonPath Project Json Path
65+
* @param projectJsonPath Workspace Path (it can be path to either project or solution)
6666
* @param outputPath Output Path
6767
* @param traceLevel The trace logging level. One of the following values: None, Critical, Error, Warning, Information, Verbose. (default None)
6868
*/
@@ -125,7 +125,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
125125
workspace.child(envVars.expand(outputPath));
126126
expandedOutputPath.mkdirs();
127127

128-
FilePath expandedProjectJsonPath = projectJsonPath.contains("${WORKSPACE}") ?
128+
FilePath expandedWorkspacePath = projectJsonPath.contains("${WORKSPACE}") ?
129129
new FilePath(launcher.getChannel(), envVars.expand(projectJsonPath)) :
130130
workspace.child(envVars.expand(projectJsonPath));
131131

@@ -146,7 +146,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
146146
analyzeOptions.setPipelineCorrelationId(buildTag);
147147
analyzeOptions.setCliGetFlow(cliDetails.getGetFlow());
148148
}
149-
analyzeOptions.setProjectPath(expandedProjectJsonPath.getRemote());
149+
analyzeOptions.setProjectPath(expandedWorkspacePath.getRemote());
150150

151151
if (useOrchestrator) {
152152
analyzeOptions.setOrchestratorUrl(orchestratorAddress);
@@ -166,7 +166,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
166166
}
167167

168168
packOptions.setDestinationFolder(expandedOutputPath.getRemote());
169-
packOptions.setProjectPath(expandedProjectJsonPath.getRemote());
169+
packOptions.setProjectPath(expandedWorkspacePath.getRemote());
170170
packOptions.setOutputType(outputType);
171171
if (splitOutput != null && splitOutput) {
172172
packOptions.setSplitOutput(true);

src/main/java/com/uipath/uipathpackage/actions/AddEnvironmentVariablesAction.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
import java.util.Map;
77

88
public class AddEnvironmentVariablesAction extends InvisibleAction implements EnvironmentContributingAction {
9-
private final Map<String, String> addedEnvironmentVariables;
9+
private Map<String, String> addedEnvironmentVariables;
1010

11-
public AddEnvironmentVariablesAction(Map<String, String> addedEnvironmentVariables) {
11+
public void setAddedEnvironmentVariables(Map<String, String> addedEnvironmentVariables) {
1212
this.addedEnvironmentVariables = addedEnvironmentVariables;
1313
}
1414

1515
public Map<String, String> getAddedEnvironmentVariables() {
1616
return addedEnvironmentVariables;
1717
}
18-
}
18+
19+
public boolean HasEnvironmentVariablesToAdd() {
20+
return addedEnvironmentVariables != null && !addedEnvironmentVariables.isEmpty();
21+
}
22+
}

0 commit comments

Comments
 (0)