I'm trying to create a release definition by using Azure DevOps REST API. I've created a json file which has configuration details for the request. I'm getting the below error, while creating the release definition.
{
"$id": "1",
"innerException": null,
"message": "Workflow of deploy job 'Run on the agent' in release pipeline stage 'development' is invalid. Add valid tasks and try again.",
"typeName": "Microsoft.VisualStudio.Services.ReleaseManagement.Data.Exceptions.InvalidRequestException, Microsoft.VisualStudio.Services.ReleaseManagement2.Data",
"typeKey": "InvalidRequestException",
"errorCode": 0,
"eventId": 3000
}
I'm using the below request body to create a new release definition in Azure cloud.
{
"name": "myreleasedefn1",
"artifacts": [{
"type": "DockerHub",
"alias": "_dockerusername_mydockerimage",
"definitionReference": {
"connection": {
"id": "dd986f4a-123k-45d5-b8e6-fc4fds23rce",
"name": "dockerservice"
},
"defaultVersionType": {
"id": "selectDuringReleaseCreationType",
"name": "Specify at the time of release creation"
},
"definition": {
"id": "dockerusername/mydockerimage",
"name": "dockerusername/mydockerimage"
},
"namespaces": {
"id": "dockerusername",
"name": "dockerusername"
}
},
"isPrimary": true,
"isRetained": false
}],
"releaseNameFormat": "Release-$(rev:r)",
"environments": [{
"name": "development",
"rank": 1,
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 10
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": "beforeGates"
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 12
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": "afterSuccessfulGates"
}
},
"deployPhases": [{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": "none"
},
"agentSpecification": {
"identifier": "ubuntu-16.04"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {
"downloadInputs": []
},
"queueId": 9,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {}
},
"rank": 1,
"phaseType": "agentBasedDeployment",
"name": "Run on the agent",
"workflowTasks": [{
"version": "4.*",
"name": "Deploy Azure App Service",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"ConnectionType": "AzureRM",
"WebAppKind": "webAppContainer",
"WebAppName": "azureappservice1",
"DeployToSlotOrASEFlag": "false",
"ResourceGroupName": "",
"SlotName": "production",
"DockerNamespace": "dockerusername",
"DockerRepository": "mydockerimage",
"DockerImageTag": "10"
}
}]
}]
}]
}
It would be very helpful if you share an example template for the same request. Please help!!!