I want to track our GitHub deployments on Jira so our team could have better visibility of the work.
We can see branches, commits and pull requests in our issues, so both platforms seem to be connected.
Regarding deployments, GitHub says:
By default, when a workflow job references an environment, GitHub creates a deployment object to track the deployment.
Our project deploys to two environments: "QA" and "Production", so my .jira/config.yml contains
deployments:
environmentMapping:
staging:
- "QA" # Pushes to `development` trigger a deploy to QA
production:
- "Production" # Publishing releases trigger a deploy to Production
My branch, PR and commit read as follows:
Branch: feature/setup-gh-deployments_ABC-123
Commit:
```
feat: define environments for QA and production workflows
Implements: ABC-123
```
PR title: [ABC-123] Define environments for workflows
GitHub displayed my deployment. Jira showed nothing.
Then I read in the Jira docs:
To add deployments to your GitHub Actions workflow, you must create a deployment action in GitHub using the action chrnorm/deployment-action@releases/v1
The GitHub for Atlassian Marketplace app only listens to
deployment_statusevents. This means GitHub deployments will only be shown in Jira if they meet the following conditions:
Deployments are created using GitHub’s create deployment API or the
chrnorm/deployment-action@releases/v1action.After creating a deployment, you must call the create deployment status API or the
chrnorm/deployment-status@releases/v1action at least once to update the status of the deployment.
"Ah, you're not sending status events" I thought, so I modified the workflow file to push status updates:
on:
push:
branches:
- development
jobs:
deploy:
name: Deploy to QA
runs-on: ubuntu-latest
environment: QA
steps:
- name: Get Deployment ID
id: get-deployment
uses: actions/github-script@v7
with:
script: |
const deployments = await github.rest.repos.listDeployments({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
environment: 'QA'
});
core.setOutput('deployment_id', deployments.data[0].id);
- name: Checkout
uses: actions/checkout@v2
- name: Report deployment status update
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.get-deployment.outputs.deployment_id }},
state: 'in_progress',
description: 'Running preliminary steps',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
... preliminary steps...
- name: Report deployment status update
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.get-deployment.outputs.deployment_id }},
state: 'in_progress',
description: 'Building images',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
... build, tag, push ...
- name: Report deployment status update
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.get-deployment.outputs.deployment_id }},
state: 'in_progress',
description: 'Deploying to target',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
... deploy ...
- name: Report deployment success
if: success()
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.get-deployment.outputs.deployment_id }},
state: 'success',
environment_url: '${{ vars.ENVIRONMENT_URL }}',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
- name: Report deployment failure
if: failure()
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: ${{ steps.get-deployment.outputs.deployment_id }},
state: 'failure',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
});
Pushed my changes, deployment statuses are sent from the workflow and I can see them through GitHub API.
In the issue detail page, I see the commit, branch PR, but no deployments! Instead I see the following message:
Connect your deployment information
You need to be a site administrator to install apps on your Jira site. Contact your admin so they can install one of the apps below.
Hmm... our team did test this integration a couple of months ago but I can see they didn't test deployments from GitHub 🫤
All of that being said (and what you've written @Nicolás Stuardo) could indicate a config gap rather than a missing installation.
Your Jira admin could:
What your admin could also do is to reach out to Atlassian Support (raise a ticket) and add you as a request participant. The official support team can probably point you in the right direction on how to troubleshoot this 👀
Cheers,
Tobi
Hi Tobi
Me and our admin were recently reviewing our setup. It turns out our Atlassian app was installed so long ago that it was missing permissions. After granting them the Deployments tab began showing data.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.