Artifacts/file upload from Azure DevOps (VSTS) to the Perfecto repository using cURL
To upload APK/IPA/AnyOther/APKS/Zip files in Azure DevOps(VSTS), you can build artifacts (.apk/.ipa/other/.apks/.zip files) by using the cURL plugin to upload to the repository of private, enterprise, and public Perfecto clouds.
Follow the below steps to create a job task for uploading files to the Perfecto repository from the Azure DevOps Build/specific folder.
- Add an Agent job to add the cURL Upload Files plugin.
- Select the Upload task.
- Choose a specific file path or build path wherever deployment is done by a project pipeline in Azure DevOps. In this example, we are choosing the path to an APK file,
$(System.DefaultWorkingDirectory)/_Demo/resources/ExpenseAppVer1.4.apk
. -
As Authentication Method, select Service connection (used in this example) or UserName and Password, according to your needs, and provide the relevant information.
-
Under Service Connection, if needed, click Manage and create a Perfecto Service Connection, as done in this example (for more information on creating the service connection, see Perfecto service connection in Azure DevOps (VSTS) projects).
You can also use project settings to create a service connection by using the Perfecto private/enterprise cloud and credentials.
- After creating the connection, select the name of the Perfecto service connection from the drop-down list.
-
Provide the cURL command for uploading the file using the Upload File (Legacy) API, which will work for Perfecto private clouds, as follows:
services/repositories/media/PRIVATE:script/ExpenseAppVer1.4.apk?operation=upload&securityToken=eyJhb..._aNRoew
In this example, we upload an APK file to the "PRIVATE:script" path in the Perfecto repository. You can configure the same path in your automation framework to select and apk/ipa file.
- Use
-X POST
arguments that can be passed to the command mentioned above. Under Control Options, select the Enable check box to select the task in execution time.
-
Add an Agent Job to add the Command Line plugin.
-
Select the second version of the command line plugin/task.
-
Run the cURL command as per the Perfecto File Upload API and with the required parameters.
Following is a sample command for your reference.
Copycurl "https://<YourCloudName>-public.app.perfectomobile.com/repository/api/v1/artifacts"
-H "Perfecto-Authorization: <YourPerfectoSecurityToken>"
-H "Content-Type: multipart/form-data"
-F "requestPart={\"artifactLocator\":\"PRIVATE:script/ExpenseAppAzureVer1.0.apk\",\"artifactType\":\"ANDROID\",\"override\":true}"
-F "inputStream="$(System.DefaultWorkingDirectory)”/Perfecto_DevOps_CD_CT_ProcessDemo-Android-CI/drop/app/build/outputs/apk/debug/app-debug.apk”where:
-
<YourCloudName>
is the name of your Perfecto cloud. -
<YourPerfectoSecurityToke>
is the security token you generated through the Perfecto UI. -
artifactLocator
is the proper path to your Perfecto repository location (this may be to PRIVATE or PUBLIC). -
inputStream
is the proper path of the file (APK/IPA/ZIP/APKS/etc) in Azure DevOps. In this example,$(System.DefaultWorkingDirectory)
is pointing to the Azure DevOps working directory.
The agent is executed and the file is uploaded to the location in the public tenant cloud repository.
-
See also