Hello,
I would like to use the Jira REST API (endpoint /rest/deployments/0.1/bulk
) to publish deployment information when deploying an application via a shell script.
For this, I am making a basic cURL request with the following format:
DEPLOYMENT_DATA=$(cat <<EOF
{
"deployments": [
{
"deploymentSequenceNumber": "$BUILD_NUMBER",
"updateSequenceNumber": 1,
"displayName": "Deployment of xxxx",
"url": "$ENV_URL",
"description": "Deployment to environment $ENV",
"lastUpdated": "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")",
"state": "successful",
"pipeline": {
"id": "$BUILD_TAG",
"displayName": "$JOB_NAME",
"url": "$BUILD_URL"
},
"environment": {
"id": "env-$ENV",
"displayName": "$ENV",
"type": "$ENVIRONMENT_TYPE"
},
"associations": [
{
"associationType": "issueIdOrKeys",
"values": [${JIRA_ISSUES//,/, }]
}
]
}
]
}
EOF
)
curl -i --request POST \
--url "https://api.atlassian.com/jira/deployments/0.1/cloud/${CLOUD_ID}/bulk" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $access_token" \
--data "$DEPLOYMENT_DATA"
The access token is successfully obtained from a previous call, using a client_id
and client_secret
for an application that I created at https://developer.atlassian.com/console/myapps/
. I have given it the following scopes:
"scope": "write:deployment-info:jira read:deployment-info:jira read:deployment:jira-software write:deployment:jira-software delete:deployment-info:jira"
The scopes are also visible when I make a call through SOAP-UI.
However, when I make my cURL call to create the deployment information, I receive the following error:
{"message":"The request failed: Provider 'OAuthClientId(value=xxxxxxx)' not installed in any installation context '[ari:cloud:jira::global/, ari:cloud:platform::card/, ari:cloud:jira:xxxxx:workspace/xxxxxx, ari:cloud:graph::workspace/xxxx]' for type 'DEPLOYMENT_INFO'"}
It seems that the provider is not recognized in any installation context for ‘DEPLOYMENT_INFO’, despite having set up all the necessary permissions that I could find.
Could you help me understand what this error means? Are there specific steps or configurations I might have missed to ensure the app has the correct access context for deployment publishing?