Clone the application into your local machine and install node modules.
git clone https://github.com/bitovi/jira-integrations.git
cd jira-integrations
npm i
The next step is to fill in your environment variables. You can use the .env.example
to create your .env
in your root folder
cp .env.example .env
Follow the steps below to get remaining environment variables:
- Open Jira developer console. https://developer.atlassian.com/console/myapps/
- Create your app and choose OAuth2.0, put in the app name and accept the terms.
- Click Permissions, add the Jira API scope then configure it to the following scopes:
- Jira
read:jira-work
write:jira-work
- Confluence
read:app-data:confluence
write:app-data:confluence
- Jira
- Click Authorization, input the callback url, as default for this application locally, use
http://localhost:3000/oauth-callback
and save. - Click Settings and scroll down to copy your
CLIENT_ID
andCLIENT_SECRET
. - The
CLIENT_JIRA_API_URL
ishttps://api.atlassian.com
.
Note: All environment variables that start with CLIENT
will be sent to the client side and exposed.
Open the terminal and run
npm run dev
Open your browser and navigate to http://localhost:3000/ to view the minified version of the app.
Navigate to http://localhost:3000/dev to view the unminified version of the app.
The Timeline Report is a Jira Application that also works as a standalone web app. The following steps will allow you to deploy your app to Jira through Atlassian Connect.
- Create an Atlassian dev environment where you will upload the application for testing.
- Enable development mode so you can upload an application directly.
- Follow the Atlassian instructions to Prepare for tunneling where you create an ngrok account and copy your Authtoken.
- Open a fourth terminal and set up the ngrok environment.
npm install -g ngrok
ngrok authtoken <Authtoken>
The following steps are repeatable as many times as needed to re-deploy and re-tunnel your local app.
- Start ngrok and point it to the local service port
ngrok http 3000
- After the tunnel starts, you need to create the
atlassian-connect.json
file by running the following command, replacing--name
with your name and--url
with the fully qualified url from ngrok.
npm run create:atlassian-connect -- --environment=local --name=<your-name-here> --url=<fully-qualified-ngrok-url>
- Add a
CLIENT_JIRA_APP_KEY
environment variable and set it equal to thekey
in the newly createdatlassian-connect.json
file.- ex:
CLIENT_JIRA_APP_KEY=bitovi.timeline-report.local.david
- ex:
- Open your Jira dev environment and click Apps from the top nav, then
Manage Your Apps
. If you have enabled development mode, you should see anUpload app
option next toBuild a new app
. ClickUpload app
. - Paste the secure domain into the text box, and add
/atlassian-connect.json
to the end (e.g.https://46f7-8-47-99-200.ngrok-free.app/atlassian-connect.json
). ClickUpload
. - The apps list should refresh and show
Timeline Report (Local <Your Name>)
as a User-installed app. From here, clickApps
in the top nav and you should see aYour Apps
heading withTimeline Report (Local <Your Name>)
as an option underneath. ClickTimeline Report (Local <Your Name>)
and you should see the Timeline Report app load in the window!
- The server folder contains a
server.js
which bootstraps an express application that renders the application - It has an endpoint that fetches the access token from Jira and refreshes the access token when expired.
- The
pages
folder contains the html files that are rendered. - The
public
folder contains the javascript files that are included in the html files. - The
jira-oidc-helpers
is a collection of modules with all the helpers required to interact with Jira and save your access and refresh tokens tolocalStorage
. - You will make changes to the
main-helper.js
files based on your use case. Everything you need to make your request has been layered injira-oidc-helpers
. - Call the
jiraFetch
helper with the url path you want from your main and handle the data how you see fit. e.g
const issue = await jiraHelper.jiraFetch(urlPath);