-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to analyze and package studio projects
Integrated uipathcli with UiPath Studio to build, package and analyze studio projects. Added two new plugin commands: - `uipath studio package analyze` - `uipath studio package pack` Implementation: - Created infrastructure to download external plugins like the uipcli. The studio commands download the uipcli to the user cache dir and use it for packaging any studio project. Depending on the targetFramework the uipathcli either downloads the tool chain for building and packaging cross-platform or windows Studio projects. - Added `ExecCmd` abstraction which is used to start processes and can easily be faked in unit tests in order to validate the behavior with different exit codes - Refactored the existing browser launcher to use the `ExecCmd` abstraction - Extended the progress bar rendering to allow displaying a simple bar without any percentage or bytes indicator so that the build process can be visualized without knowing the total time in advance. - Increment the uipathcli version to 2.0. There are no backwards-incompatible changes. The major version increase only indicates that an important new feature has been added. Examples: `uipath studio package analyze --source plugin/studio/projects/crossplatform` ``` analyzing... |██████████ | ``` ``` { "error": null, "status": "Succeeded", "violations": [ ... ] } ``` `uipath studio package pack --source plugin/studio/projects/crossplatform --destination . --debug` ``` uipcli Information: 0 : Packing project(s) at path plugin\studio\projects\crossplatform\project.json... uipcli Information: 0 : Orchestrator information is not provided, hence, orchestrator feeds will not be used. uipcli Information: 0 : Proceeding with the local feeds... uipcli Information: 0 : Detected schema version 4.0 ... uipcli Information: 0 : Packaged project MyProcess v1.0.2 saved to MyProcess.1.0.2.nupkg. ``` ``` { "description": "Blank Process", "error": null, "name": "MyProcess", "output": "MyProcess.1.0.2.nupkg", "projectId": "9011ee47-8dd4-4726-8850-299bd6ef057c", "status": "Succeeded", "version": "1.0.2" } ``` The following snippet allows users to package a local UiPath studio project, upload the package, create a release and run a job: ``` uipath studio package pack --source plugin/studio/projects/crossplatform --destination . --package-version 1.0.0 uipath orchestrator processes upload-package --file MyProcess.1.0.0.nupkg $folderId = uipath orchestrator folders get --query "value[0].Id" $releaseKey = uipath orchestrator releases post --folder-id $folderId --name "MyProcess" --process-key "MyProcess" --process-version "1.0.0" --query "Key" --output text $jobId = uipath orchestrator jobs start-jobs --folder-id $folderId --start-info "ReleaseKey=$releaseKey" --query "value[0].Id" --output text uipath orchestrator jobs get-by-id --folder-id $folderId --key $jobId ```
- Loading branch information
Showing
49 changed files
with
2,341 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,36 @@ | ||
package auth | ||
|
||
// BrowserLauncher interface for opening browser windows. | ||
type BrowserLauncher interface { | ||
Open(url string) error | ||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/UiPath/uipathcli/utils" | ||
) | ||
|
||
// BrowserLauncher tries to open the default browser on the local system. | ||
type BrowserLauncher struct { | ||
Exec utils.ExecProcess | ||
} | ||
|
||
func (l BrowserLauncher) Open(url string) error { | ||
cmd := l.openBrowser(url) | ||
err := cmd.Start() | ||
if err != nil { | ||
return err | ||
} | ||
done := make(chan error) | ||
go func() { | ||
done <- cmd.Wait() | ||
}() | ||
|
||
select { | ||
case err := <-done: | ||
return err | ||
case <-time.After(5 * time.Second): | ||
return fmt.Errorf("Timed out waiting for browser to start") | ||
} | ||
} | ||
|
||
func NewBrowserLauncher() *BrowserLauncher { | ||
return &BrowserLauncher{utils.NewExecProcess()} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build darwin | ||
|
||
package auth | ||
|
||
import ( | ||
"github.com/UiPath/uipathcli/utils" | ||
) | ||
|
||
func (l BrowserLauncher) openBrowser(url string) utils.ExecCmd { | ||
return l.Exec.Command("open", url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build linux | ||
|
||
package auth | ||
|
||
import ( | ||
"github.com/UiPath/uipathcli/utils" | ||
) | ||
|
||
func (l BrowserLauncher) openBrowser(url string) utils.ExecCmd { | ||
return l.Exec.Command("xdg-open", url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build windows | ||
|
||
package auth | ||
|
||
import ( | ||
"github.com/UiPath/uipathcli/utils" | ||
) | ||
|
||
func (l BrowserLauncher) openBrowser(url string) utils.ExecCmd { | ||
return l.Exec.Command("rundll32", "url.dll,FileProtocolHandler", url) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: UiPath Studio | ||
description: UiPath Studio | ||
version: v1 | ||
servers: | ||
- url: https://cloud.uipath.com/{organization}/studio_/backend | ||
description: The production url | ||
variables: | ||
organization: | ||
description: The organization name (or id) | ||
default: my-org | ||
paths: | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.