Enterprise · Jira and Jev AI
Jira setup
One Jira Automation flow and three status rules in FluxGate let a Jira status change request, approve and deploy a release.
Before you start
- A Jira Cloud sandbox with the project
CHK, the ticketCHK-142, and the workflow To Do, In Review, Approved, Done. The status names in your workflow must match the status rules you create below. If your workflow has noApprovedstatus, add one or type the name of the status you use. - A Jira API token for the Jira user that FluxGate comments as. This user needs the permissions Browse projects, Add comments and Link issues.
- A public HTTPS address that Jira Cloud can reach for the backend port 8080. On a laptop, use a tunnel (see below).
- The backend runs with
FLUXGATE_ENCRYPTION_KEYset. FluxGate needs it to store the Jira token. See Install and first boot. - Sign in as
adminSystem admin and select the team Checkout. Only a system admin or a Team Admin can open the Jira page.priyaandsamsee "Access Denied".
How the connection works
FluxGate does not poll Jira. Jira calls FluxGate when a ticket changes status, and FluxGate decides what that status means.
- A Jira Automation flow runs when a work item changes status. It sends a web request to the Events URL of your integration.
- FluxGate checks the secret in the
Authorizationheader and reads the ticket key, the new status and the labels of the ticket. - FluxGate runs its status rules from top to bottom. Each rule says: when a ticket reaches this status, do this action in these environments.
- Optionally, FluxGate writes the result back to the ticket as a comment and a link.
One integration covers one Jira project. Create one integration for each project.
Which environment does a ticket mean?
The Environment field tells FluxGate where to read the environment from. It is labels by default, so a label on the ticket names the environment. A label that equals the environment name (Production) works as it is. For any other word, add an alias. In this chapter the alias prod maps to Production. A ticket with no matching label does nothing, and the event log reads "No rule matched."
FluxGate acts only on features that are linked to the ticket. Jira end to end shows how to link one.
Status rules
A status rule has three parts: a Jira status, an action and an optional list of environments. The status matches without regard to case and spaces. The actions are:
| Action | What FluxGate does |
|---|---|
| Request | Asks for a deployment through the normal path, so your approval policy creates a pending request. It works on a stage that is not deployed, rejected, or rolled back. |
| Approve | Closes the pending request as approved by Jira. It works only in an environment listed under Jira approves in. |
| Deploy | Deploys a stage that is already approved. On any other stage it refuses, writes the reason to the log, and changes nothing. |
| Roll back | Reverses a deployment. |
This chapter uses three rules: In Review requests Production, Approved approves it, Done deploys it. Deploy never approves for you.
Trusted approvals
For the environments listed under Jira approves in, the Jira status you choose counts as the approval. No FluxGate approver votes. FluxGate does not map Jira users to FluxGate users. It records the ticket key, and the Jira user name when the event carries one.
The write-back token
Write-back lets FluxGate answer on the ticket. You give it the email of a Jira user and an API token. FluxGate encrypts the token with FLUXGATE_ENCRYPTION_KEY before it stores it, and it never shows the token again. If the key is missing, saving a token fails with encryption_key_missing. Changing the Jira base URL to another host later clears the token and turns write-back off.
The public Events URL and the tunnel
Jira Cloud calls the Events URL from the internet, so the URL needs a public https:// address. FluxGate shows the URL as your browser reaches the backend. On the demo stack that is http://localhost:8080/..., which Jira cannot reach. Run a tunnel to port 8080 and swap the host part of the URL for the tunnel address. Keep the path.
ngrok http --host-header=localhost 8080 --pooling-enabledngrok prints a forwarding address such as https://<name>.ngrok-free.dev. Only the path /api/v1/integrations/jira/<integration id>/events has to be reachable. Leave the tunnel running while you use the integration. Write-back goes the other way, from the backend to Jira over HTTPS, and needs no tunnel.
Create the integration
- Click Jira in the Settings group of the sidebar to open
/settings/jira. - Click New integration. The form New Jira integration opens.
- In Name, type
Juniper Jira. In Jira base URL (optional), type your Jira site address, for examplehttps://<your-site>.atlassian.net. Write-back needs this address later. - Click Create integration. The toast "Jira integration created" appears.
- The Connection card shows the Events URL with Copy URL, the header
Authorization: Bearer <secret>, and a one-time secret with Copy secret and I stored the secret. Click Copy URL and Copy secret. - Paste the URL into a text editor. Replace
http://localhost:8080with thehttps://address of your tunnel. Keep the path.
Create the Jira Automation flow
The names below are the ones Jira Cloud shows in a current site. An older site says project, rule and issue where a newer one says space, flow and work item.
- In Jira, open the settings of the
CHKspace and click Automation. - Click
Create flow, thenCreate from scratch. - Pick the trigger
Work item transitioned. LeaveFrom statusandTo statusempty, so every status change is sent. FluxGate's rules decide what each status means. - Add the action
Send web request. - In
Web request URL, paste the edited Events URL with the tunnel address. - Set
HTTP methodtoPOSTandWeb request bodytoIssue data (Jira format). - Tick the checkbox that delays later actions until the request has a response. A wrong secret then fails the run in the audit log of the flow.
- Under headers, add
Authorizationwith the valueBearer <secret>. TickHidden, so Jira keeps the secret out of the rule. - Name the flow
FluxGate releaseand clickSave and enable.
The web request
This is the finished request that the flow sends on every status change:
POST https://<tunnel host>/api/v1/integrations/jira/<integration id>/events
Authorization: Bearer <integration secret>
<Issue data (Jira format) of the ticket>FluxGate also accepts the header X-FluxGate-Jira-Secret: <integration secret> in place of Authorization. To check that the tunnel reaches the backend, send a request with no credentials:
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://<tunnel host>/api/v1/integrations/jira/<integration id>/events401The answer 401 proves the tunnel reaches FluxGate. It does not prove the integration id, because a wrong id answers 401 as well. The real proof is a test run: move a throwaway ticket, then look for Success in the flow's audit log and a new row in the Event log on the Jira page.
Set the environment mapping
- Scroll to the Settings card. Environment field already reads
labels. - Under Environment aliases, click Add alias. Type
prodas the Jira value and pickProductionas the environment. - Under Jira approves in, pick
Production. A warning appears: "In these environments a Jira status change approves without a FluxGate approver. Only add environments whose Jira workflow you trust to gate releases." - Click Save settings. The toast "Jira integration saved" appears.
Save the settings before you add the approve rule. The rules editor reads the saved integration. If Production is not saved under Jira approves in, the approve rule row shows "No environment in this rule trusts Jira, so this rule will be refused."
Add the status rules
- Scroll down to the Status rules card, below Native webhook secret. Click Add rule three times.
- Row 1: set Jira status 1 to
In Review, Action 1 to Request and Environments 1 toProduction. - Row 2: set Jira status 2 to
Approved, Action 2 to Approve and Environments 2 toProduction. - Row 3: set Jira status 3 to
Done, Action 3 to Deploy and Environments 3 toProduction. - Click Save rules. The message "Rules saved." appears.
Rules run from top to bottom. An empty environment list means every environment the ticket names. If there is no enabled approve rule, a deploy rule warns: "No enabled approve rule: deploy works only after a person approves the request in FluxGate."
Turn on write-back
- Scroll up to the Write-back card, above Native webhook secret. Switch on Enable write-back. Jira edition stays Jira Cloud.
- In Account email, type the address of the Jira user. In API token, paste the token.
- Switch on Post comments and Keep a FluxGate link on the issue.
- Click Save write-back, then Test connection. FluxGate reports success with a message such as
connected as <display name>.
The exact text of the comments and the link that FluxGate posts, and how Jira Cloud shows them, is covered in Jira end to end. Click Save write-back before Test connection: the test uses the saved settings. If the integration has no Jira base URL, the page asks you to set it first. A failed test reads Jira returned 401 or could not reach Jira: ....
Examples
The finished integration
| Part | Value |
|---|---|
| Name | Juniper Jira |
| Environment field | labels |
| Alias | prod maps to Production |
| Jira approves in | Production |
| Rule 1 | In Review, Request, Production |
| Rule 2 | Approved, Approve, Production |
| Rule 3 | Done, Deploy, Production |
| Write-back | On, with comments and a link |
Good to know
- The Native webhook secret card is the other route. Jira's built-in webhook can sign each request instead of sending the inbound secret. Click Generate, give the secret to the Secret field of a Jira Cloud webhook, and FluxGate checks the
X-Hub-Signatureheader. A webhook without a secret is rejected. This chapter uses the Automation flow, so leave Generate alone. - Jira Automation can lag by several seconds. FluxGate processes an event while Jira waits for the web request.
- The Jira flow audit log shows
SuccessandSuccessfully published web request. It does not print the answer of FluxGate. A refused rule answers normally, so it shows only in the FluxGate Event log. - Only a system admin or a Team Admin can open
/settings/jira.
Troubleshooting
Jira shows an HTML answer or the flow run fails
The free tier of ngrok can show a browser warning page. Add a second header to the web request: ngrok-skip-browser-warning with the value true.
The flow run fails with 401
The secret or the integration id in the URL is wrong. Check both. If you lost the secret, click Rotate secret on the Jira page and update the Authorization header in the flow.
The event log says "No rule matched."
The ticket has no label that names an environment, or the status has no rule. Add the label prod to the ticket and check the status names in the rules.
Saving the write-back token fails with encryption_key_missing
The backend runs without a valid FLUXGATE_ENCRYPTION_KEY. Set it as described in Install and first boot and recreate the backend.
Next
Link CHK-142 to express-checkout and drive a Production release from Jira in Jira end to end.