GitLab CiCD Package and Deploy

Did someone implement an Ci-Cd solution to package and deploy package from GitLab?

I manage to do the package part but not the deploy.

I’m using this page as starting point (Scripts)

I always have this error:

The Orchestrator command URL/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage failed with status code InternalServerError.

(gitlab.URL/-/jobs/41149#L25)
Server response: {“message”:“An error has occurred.”,“errorCode”:0,“resourceIds”:null}

(gitlab.URL/-/jobs/41149#L26)8/4/2022 11:53:43 AM
Unable to deploy project. Exit code 1

Can you let us know if this Python script (created in Python 3.10) is working for you?

import requests
import json


url = " https://cloud.uipath.com/identity_/connect/token"

payload_token='grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=OR.Execution&client_secret=YOUR_CLIENT_SECRET'
headers_token = {'Content-Type': 'application/x-www-form-urlencoded'}

response = requests.request("POST", url, headers=headers_token, data=payload_token)

token_response_text = response.text

token_dict = json.loads(token_response_text)

token = token_dict.get('access_token')

url_upload_package = " https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME/orchestrator_/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage"

payload={}
files=[
('file',('UiPath.System.Activities.21.10.3.nupkg',open('C:\\Marian\\UiPath.System.Activities.21.10.3.nupkg','rb'),'application/octet-stream')),
  ('file',('UiPath.Excel.Activities.2.11.4.nupkg',open('C:\\Marian\\UiPath.Excel.Activities.2.11.4.nupkg','rb'),'application/octet-stream')),
  ('file',('UiPath.Excel.Activities.2.11.4.nupkg',open('C:\\Marian\\UiPath.Mail.Activities.1.12.3.nupkg','rb'),'application/octet-stream'))]
headers = {
  'accept': 'application/json',
  'Authorization': 'Bearer ' + token}

response = requests.request("POST", url_upload_package, headers=headers, data=payload, files=files)


pretty_response = json.dumps(response.json(), indent=4)
print(pretty_response)

If this python script works, then look at UiPath-DevOps-Scripts/UiPathDeploy.ps1 at main · UiPath-Services/UiPath-DevOps-Scripts · GitHub and try to readapt the PowerShell script to match the Python script.

Hi have onpremiss Orchestrator.

I’m testing something similar on Postman.

If I define the folder to upload the package I recieve:

“User does not have any of these permissions: Packages.Create to perform this feed action” even with all the permission.

When I left the folder empty just return a generic error:
“An error has occurred.”,

I will create a case with UiPhat to analyze it.

Thanks

User does not have any of these permissions: Packages.Create to perform this feed action” even with all the permission.

Solution:

Create a Tenant custom role and add all Permissions to the Packages entity (especially the Packages.Create)

Then add this custom tenant role to the impacted user/robot. Double check if the impacted user/robot it is having this tenant role (at tenant level and at folder level).

Also, double-check where you are uploading the package (in a host or in a specific tenant).