Skip to content

Commit

Permalink
JIRAv2 initial PR (#36)
Browse files Browse the repository at this point in the history
* Refactored the JIRA plugin to support more events

* Removed Enabled config setting

* PR feedback

* PR feedback from @hanzei

* Added back webhook tests, updated for MD

* coverage

* Added back formatting as Slack attachments

* Add atlassian connect functionality

* Updated plugin.json

* merged the minimal webapp from hackathon

* Updated .gitignore

* wip Merged plugin.go from hackathon

* wip oauth failures

* wip oauth2 with a static clientid seems to work

* wip /jira connect seems to work

* wip trying JWT webhook setup

* wiop

* wip

* wip connect auth and the beginning of issue

* Added webapp from hackathon

* Create JIRA Issue is showing up

* wip create issue with semi-fakeuser mapping

* JWT verification in user-config page

* moved JWT verification into auth.go

* WIP WIP WIP in the middle of something

* wip flow works, need to add encryption

* User mapping works

* added /jira-disconnect

* Fix websocket event handling for connect and add disconnect

* WIP fixed websocket initialization

* WIP - TODO encrypt Atl account ID in config

* Secured the auth flow, passing mm_token and jwt to the final endpoint

* Restored legacy webhook support

* Process mentions in Webhooks, rearrange files

* Point Gopkg.toml at mattermost-server/master for now

* Adding comments for posts mentioning JIRA issues

* Some error logging

* Cleanup

* 5.8 compatibility: replace GetBundlePath with old-style config hacking

* go test cleanup

* Removed unused files

* Fixed MM-15004, no lnger requires admin to connect user

* wip prefixing and instances - appears to work with connect

* MM-15003 Prefix KV keys with the JIRA instance ID

- Reworked the kv store functions to use the JIRA BaseURL as a part of the
key.
- Other cleanup

* Added JIRA Server and OAuth1

- Added back OAuth1 functionality
- Added `type JIRAInstance` and moved a lot of instance-specific data
  there
- Added "cloud" and "server" instance types, for now with switches
- Added `/jira add server url` command to add JIRA Server instances

* wip style/naming

* JIRA Server auth appears to work

* Cosmetic PR feedback, fixed atlassian-connect.json

* Fixed a crash if no current JIRAInsttance exists

* GetJIRAClient refactor

* GetJIRACLient appears to work

* CreateIssue works in server and cloud

* Added (encoded) URL to Atlassian-connect.json `key` value (e.g. `"mattermost-https-e1ba36fb-ngrok-io"`), making it unique per Mattermost instance. Now can add multiple Mattermost instances to the same JIRA Cloud instance
* Removed caching of the project keys in anticipation of the new cache
* Webapp CreateIssue: use f.schema.system rather than f.key to identify field keys, this works with JIRA Server and Cloud versions.
* Webapp: CreateIssue renderFields: initialize `description` to an empty value to avoid JS errors

* PR feedback: ephf -> responsef

* Cleanup, /jira command improvements

- added `/jira help`
- added instance numbers to `/jira instance list`, ability to do
 `/jira instance select {number}`
- style: refactored command.go
- style: http naming, and using constants for all routes
- style: updated webapp to match
- style: eliminated unused oauth2.code

* Fixed 2 typos in 1 URL

* WIP prep to having a revoke button on the confirm page

- fixed a typo in `/jira instance listt` output
- removed unused routeOAuth1Connect and related code
- renamed StoreOAuth1RequestToken to StoreOneTimeSecret and such

* PR feedback (style), expire OTS

* PR feedback: Do not change original posts

- Do not change the original posts when creating issues
- require MM server 5.6 to build
- Style, error handling

* Fixed "Connect to JIRA" URL in post menu item

* PR feedback: added explicit Gopkg.toml deps

* PR feedback: style and error handling

* PR feedback: more style

* Fix tests.

* Fix linting.

* Removed notify() from webhooks for now, to pass the tests

* Uncommented the tests @cristopher took out

* Uncommented the test I missed

* Minor fixes
  • Loading branch information
levb authored and crspeller committed May 21, 2019
1 parent e6e3057 commit ed0083b
Show file tree
Hide file tree
Showing 57 changed files with 11,732 additions and 589 deletions.
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/coverage.txt
/plugin.exe
/mattermost-jira-plugin.tar.gz
/dist
/vendor

dist
bin
vendor

# Mac
.DS_Store
.DS_Store
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ ifneq ($(HAS_SERVER),)
cd server && env GOOS=linux GOARCH=amd64 $(GO) build -o dist/plugin-linux-amd64;
cd server && env GOOS=darwin GOARCH=amd64 $(GO) build -o dist/plugin-darwin-amd64;
cd server && env GOOS=windows GOARCH=amd64 $(GO) build -o dist/plugin-windows-amd64.exe;
cd server && cp -r templates dist/templates
endif

# webapp/.npminstall ensures NPM dependencies are installed without having to run this all the time
Expand Down
21 changes: 14 additions & 7 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
{
"id": "jira",
"name": "Jira",
"description": "Receives webhook events from JIRA and makes Mattermost posts for them.",
"version": "1.1.1",
"name": "JIRA",
"description": "Atlassian JIRA plugin for Mattermost.",
"version": "2.0.0",
"server": {
"executables": {
"linux-amd64": "server/dist/plugin-linux-amd64",
"darwin-amd64": "server/dist/plugin-darwin-amd64",
"windows-amd64": "server/dist/plugin-windows-amd64.exe"
},
"executable": ""
}
},
"webapp": {
"bundle_path": "webapp/dist/main.js"
},
"settings_schema": {
"header": "",
"footer": "Use this webhook URL to set up the JIRA integration. See [documentation](https://about.mattermost.com/default-jira-plugin) to learn more.\n\n`https://SITEURL/plugins/jira/webhook?secret=WEBHOOKSECRET&team=TEAMURL&channel=CHANNELURL`",
"settings": [{
"key": "UserName",
"display_name": "User",
"type": "username",
"help_text": "Select the username that this integration is attached to."
}, {
"key": "JiraServerURL",
"display_name": "JIRA Server URL",
"type": "text",
"help_text": "URL of the JIRA Server to connect to, e.g. \"https://jira.internal.my-company-name.com\""
}, {
"key": "Secret",
"display_name": "Secret",
"type": "generated",
"help_text": "This secret is used to authenticate to Mattermost.",
"regenerate_help_text": "Regenerates the secret for the webhook URL endpoint. Regenerating the secret invalidates your existing JIRA integrations."
}]
}],
"footer": "Use this webhook URL to set up the JIRA integration. See [documentation](https://about.mattermost.com/default-jira-plugin) to learn more.\n\n`https://SITEURL/plugins/jira/webhook?secret=WEBHOOKSECRET&team=TEAMURL&channel=CHANNELURL`"
}
}
3 changes: 2 additions & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage.txt
vendor
.depensure
dist
dist
.*.swp
Loading

0 comments on commit ed0083b

Please sign in to comment.