Skip to content

Commit

Permalink
feat: pass governance file for analyze [AUOPS-3285] (#172)
Browse files Browse the repository at this point in the history
* feat: pass governance file for analyze [AUOPS-3285]

* fix: ignoreLibraryDeployConflict should be backwards compatible
  • Loading branch information
al3xanndru authored Jul 16, 2024
1 parent 2d6804e commit 4b00b0b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
17 changes: 17 additions & 0 deletions src/main/java/com/uipath/uipathpackage/UiPathPack.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class UiPathPack extends Builder implements SimpleBuildStep {
private String orchestratorTenant;
private SelectEntry credentials;
private final TraceLevel traceLevel;
private String governanceFilePath;

/**
* Data bound constructor responsible for setting the values param values to state
Expand Down Expand Up @@ -85,6 +86,7 @@ public UiPathPack(SelectEntry version, String projectJsonPath, String outputPath
this.orchestratorTenant = "";
this.credentials = null;
this.runWorkflowAnalysis = false;
this.governanceFilePath = null;
}

/**
Expand Down Expand Up @@ -129,6 +131,12 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul

if (runWorkflowAnalysis) {
AnalyzeOptions analyzeOptions = new AnalyzeOptions();
if (governanceFilePath != null && !governanceFilePath.isEmpty()) {
FilePath expandedGovernanceFilePath = governanceFilePath.contains("${WORKSPACE}") ?
new FilePath(launcher.getChannel(), envVars.expand(governanceFilePath)) :
workspace.child(envVars.expand(governanceFilePath));
analyzeOptions.setGovernanceFilePath(expandedGovernanceFilePath.getRemote());
}
if (disableBuiltInNugetFeeds != null && disableBuiltInNugetFeeds) {
analyzeOptions.setDisableBuiltInNugetFeeds(true);
}
Expand Down Expand Up @@ -220,6 +228,11 @@ public void setUseOrchestrator(boolean useOrchestrator) {
}
}

@DataBoundSetter
public void setGovernanceFilePath(String governanceFilePath) {
this.governanceFilePath = governanceFilePath;
}

@DataBoundSetter
public void setOutputType(String outputType) {
this.outputType = outputType;
Expand Down Expand Up @@ -379,6 +392,10 @@ public boolean getRunWorkflowAnalysis() {
return runWorkflowAnalysis;
}

public String getGovernanceFilePath() {
return governanceFilePath;
}

/**
* Provides the repository url
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

public class AnalyzeOptions extends CommonOptions {
private String projectPath;
private String analyzerTraceLevel = "Verbose";
private String analyzerTraceLevel;
private boolean stopOnRuleViolation = true;
private boolean treatWarningsAsErrors = false;
private String ignoredRules = "";
private Boolean disableBuiltInNugetFeeds;
private String governanceFilePath;

public boolean isDisableBuiltInNugetFeeds() {
return disableBuiltInNugetFeeds;
Expand Down Expand Up @@ -55,4 +56,12 @@ public String getIgnoredRules() {
public void setIgnoredRules(String ignoredRules) {
this.ignoredRules = ignoredRules;
}

public String getGovernanceFilePath() {
return governanceFilePath;
}

public void setGovernanceFilePath(String governanceFilePath) {
this.governanceFilePath = governanceFilePath;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class DeployOptions extends CommonOptions {
private List<String> environments;
private List<String> entryPointPaths;
private boolean createProcess;
private boolean ignoreLibraryDeployConflict;
private Boolean ignoreLibraryDeployConflict = null;

public String getPackagesPath() {
return packagesPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
<f:entry title="${%RunWorkflowAnalysis}" field="runWorkflowAnalysis">
<f:checkbox default="false"/>
</f:entry>
<f:entry title="${%GovernanceFilePath}" field="governanceFilePath">
<f:textbox default=""/>
</f:entry>
<f:optionalBlock title="${%PackageMetadata}" field="showMetadata" checked="${instance.showMetadata}" inline="true">
<f:entry field="repositoryUrl" title="${%RepositoryUrl}">
<f:textbox/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ ProjectUrl=Automation Hub Idea URL
ReleaseNotes=Release notes
UseOrchestrator=Use Orchestrator feed when packaging libraries
TraceLevel=Trace logging level
GovernanceFilePath=Governance file path
7 changes: 5 additions & 2 deletions stage.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ stages:
#### UiPathInstallPlatform E2E tests ###
- jobName: 'InstallPrePackagedCLI'
configurationName: 'JenkinsE2ETests/UiPathInstallPlatform/InstallPrePackagedCLI'
dependsOnJob: 'DeployEntryPointPaths'
dependsOnJob: 'IgnoreLibraryDeployConflict'
- jobName: 'InstallDownloadedCLI'
configurationName: 'JenkinsE2ETests/UiPathInstallPlatform/InstallDownloadedCLI'
dependsOnJob: 'InstallPrePackagedCLI'
Expand Down Expand Up @@ -73,10 +73,13 @@ stages:
- jobName: 'PackShouldNotLookUpInBuiltInFeeds'
configurationName: 'JenkinsE2ETests/UiPathPack/PackShouldNotLookUpInBuiltInFeeds'
dependsOnJob: 'PackWithRepositoryMetadata'
- jobName: 'AnalyzeShouldUseGovernanceFile'
configurationName: 'JenkinsE2ETests/UiPathPack/AnalyzeShouldUseGovernanceFile'
dependsOnJob: 'PackShouldNotLookUpInBuiltInFeeds'
#### UiPathRunJob E2E tests ###
- jobName: 'RunJobFailsWhenORJobFails'
configurationName: 'JenkinsE2ETests/UiPathRunJob/RunJobFailsWhenORJobFails'
dependsOnJob: 'PackShouldNotLookUpInBuiltInFeeds'
dependsOnJob: 'AnalyzeShouldUseGovernanceFile'
- jobName: 'RunJobOnMultipleLicenseTypes'
configurationName: 'JenkinsE2ETests/UiPathRunJob/RunJobOnMultipleLicenseTypes'
dependsOnJob: 'RunJobFailsWhenORJobFails'
Expand Down

0 comments on commit 4b00b0b

Please sign in to comment.