Flagsmith / flagsmith-jira-integration

Jira integration for Flagsmith
https://docs.flagsmith.com/integrations/project-management/jira
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Document the most concise set of instructions for self hosting #4

Open dabeeeenster opened 11 months ago

dabeeeenster commented 11 months ago

People self hosting Flagsmith will need to push their own Forge application with the approriate whitelisted domains.

We should add concise documentation on how to achieve this, starting from:

nishant-shah-social commented 3 months ago

@dabeeeenster @riceyrice I can help with documenting this as I am currently trying to setup the forge app for our jira organization. I made following changes in the codebase before deploying and installing the app:-

With these changes I tried deploying the forge app into our jira site. The installation was successful. I then configured the jira app providing our api token, which was also successful. Then I tried to map one of our jira projects to a flagsmith project via jira project settings. While trying to do so I received an error saying There was an error in the jira api response Further I tried debugging the app via forge debug, and saw this error:-

DEBUG   13:01:25.873  8a315e5e-0a78-426f-ab8f-bd8955df554f  {
  "errors": {},
  "errorMessages": [
    "The property flagsmith.project does not exist."
  ],
  "httpStatusCode": {
    "empty": false,
    "present": true
  }
}

If you have any pointers for me around how to fix this, I would highly appreciate it. Once fixed, I can document all the steps I had to perform to get it working so that others can benefit.

riceyrice commented 2 months ago

Hi @nishant-shah-social sorry for the delayed response. It looks like you've changed all the necessary places for connecting self-hosted Flagsmith to what I assume is self-hosted Jira? If deploying to SaaS Jira I'd expect you to also need to change the app ID in manifest.yaml - or did you also do that?

The error you're seeing seems like a bug in the Jira integration, though I'm surprised nobody else has seen this. It should not error if the property hasn't been set yet. I can't find anywhere in the code that would output the exact error message you provide. Perhaps something has changed in SaaS Jira, or are you deploying to some other Jira?

I think the relevant code is here if you want to try to add some more debugging: https://github.com/Flagsmith/flagsmith-jira-integration/blob/3a5f8e84480bd64062357f8ddf8b06b9864e95a0/flagsmith-jira-app/src/jira.ts#L92-L94

Ultimately this passes through to a checkResponse function call which should handle a 404 response. If Jira is returning something else, it will output Unexpected Jira API response: followed by the HTTP status of the response. I would expect this to be a 404 if the property doesn't exist, but maybe something has changed: https://github.com/Flagsmith/flagsmith-jira-integration/blob/3a5f8e84480bd64062357f8ddf8b06b9864e95a0/flagsmith-jira-app/src/jira.ts#L43

Hope that helps!

nishant-shah-social commented 2 months ago

Thanks for responding @riceyrice ! We are using Cloud Jira. Yes, I did change the appId as well in the manifest.yaml to a sample app I created. Sorry, I missed mentioning about it. I will try to debug this further in the code.

Regards, Nishant Shah

nishant-shah-social commented 1 month ago

@riceyrice I found the problem and we managed to fix it and install+ configure the app successfully. We required these headers to be present for the PUT call to be successful here

headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    }

I tried raising a PR but somehow I wasn't able to create a branch and push my commit.

Thanks, Nishant Shah

matthewelwell commented 1 month ago

Hi @nishant-shah-social,

Thanks for letting us know, that's very helpful!

In order to create a PR you'll need to fork the repo and submit it that way, we'd love to receive it if you're happy to do that.

Thanks, Matt

nishant-shah-social commented 1 month ago

Sure @matthewelwell I have created a PR Thanks!