Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templates for Stride #100

Closed
jacobjohnston opened this issue Apr 11, 2018 · 17 comments
Closed

Add templates for Stride #100

jacobjohnston opened this issue Apr 11, 2018 · 17 comments

Comments

@jacobjohnston
Copy link

It looks like you're already working on a customizable header to allow Stride's API token authorization, but it'd be really nice if you provided us with some nice Stride templates at the same time :-)

@netwolfuk
Copy link
Member

woot! Issue number 100. Lucky you.

Yeah. I had started working on custom headers, and also a project to allow sharing of templates. But then forgot to push to github before I left for six weeks travelling for work.

The plan for that project is to be able to share your templates with other users via a pull request. I have made some small tweaks to the API and written an export script (an early version was pushed). I have started on the import script, but it's not ready yet. obviously I didn't get to work on that whilst away either due to lack of a push :-(

Whilst away I did do some work on the testing ticket #79 but I'm back now (albiet a bit jet-lagged), so will dig out the branch for #95 and rebase that on top.

I might get some time on the weekend to progress it, but the code is pretty yuck at the integration point, so I am needing to do some cleanup there.

@netwolfuk
Copy link
Member

netwolfuk commented Apr 12, 2018

I have a template working. It's very simple at the moment, as I don't really know what the Stride API is capable of. I have also not added any branch aware messaging.

image

@netwolfuk
Copy link
Member

If you see a nice looking Stride message, can you add screenshot of it, and I could try to replicate it.

@netwolfuk
Copy link
Member

This is useful for building payloads:
https://developer.atlassian.com/cloud/stride/apis/document/playground/

@jacobjohnston
Copy link
Author

I think the "Panel" node type seems appropriate for these sorts of notifications. However, for whatever reason, it doesn't look like Stride has implemented the "error" or "success" panel types in the Stride client yet (even though they are supported according to the documentation). However, the warning, info, and note types are implemented.

Here's what that looks like in the room:
image

Here's the JSON I'm sending the Stride API:

{
    "body": { "version":1,"type":"doc","content":[{
              "type": "panel",
              "attrs": {
                "panelType": "info"
              },
              "content": [
                {
                  "type": "heading",
                  "attrs": {
                    "level": 3
                  },
                  "content": [
                    {
                      "type": "text",
                      "text": "Build Succeeded"
                    }
                  ]
                },
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "Project Name: ",
                      "marks": [
                        {
                          "type": "strong"
                        }
                      ]
                    },
                    {
                      "type": "text",
                      "text": "${projectName}"
                    }
                  ]
                },
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "Build Name: ",
                      "marks": [
                        {
                          "type": "strong"
                        }
                      ]
                    },
                    {
                      "type": "text",
                      "text": "${buildName}"
                    }
                  ]
                },
                {
                  "type": "paragraph",
                  "content": [
                    {
                      "type": "text",
                      "text": "Triggered By: ",
                      "marks": [
                        {
                          "type": "strong"
                        }
                      ]
                    },
                    {
                      "type": "text",
                      "text": "${triggeredBy}"
                    }
                  ]
                }
              ]
            }
        ]
    }
}

@netwolfuk
Copy link
Member

Thanks. I will play with that over the weekend if I get chance.

@netwolfuk
Copy link
Member

Here is a first go at a simple stride template. Not a box model, but certainly something we can build on.
Instructions for installing templates from that repo are here:
You're welcome to enhance it or copy it to build your box one. Then you can export it and share it on the that repo. You can edit it in the UI as per the WebHook-Templates-:-Web-UI page.

The test version I just posted on the other ticket works for import/export via the REST API, and has support for Bearer auth, and Headers.

I imagine a full version of the box one would have content more like this one I did for slack:
image
It might not look the same, but could have similar content.

@netwolfuk
Copy link
Member

Can you have more than one column in the Stride box?

@jacobjohnston
Copy link
Author

I don't think you can have columns. There is a table type (that may even work inside a panel), but it looks like client support for the table is bad. That said, I think the simple template you have that utilizes an emoji works just fine. I'm using that now, with the only modification being the addition of the Project Name (and link).

image

@netwolfuk
Copy link
Member

Cool. That's a nice addition. Do you want to export it and submit a pull request or attach it to this issue?

@jacobjohnston
Copy link
Author

jacobjohnston commented Apr 17, 2018

I've attached the templates here. I'd have preferred an Export, but I can't get curl to work against your REST API on my server due to some weird https/certificate issue I haven't been able to figure out yet - so I had to copy them manually. It'll be nice when there is UI support for importing/exporting templates.

The minor modifications I made:

  • Added the project name (and a link)
  • Put a space between "Build" and "#"
  • Changed the emoji used in failed from ⚠️ to :failed:

StrideTemplate.zip

@netwolfuk
Copy link
Member

Curl -k tells it to ignore cert checking.

@netwolfuk
Copy link
Member

Added issue #101. Will be on milestone 1.2

@netwolfuk
Copy link
Member

netwolfuk commented Apr 17, 2018

Created issue tcplugins/tcWebHooksTemplates#1 to allow setting of -k in import/export scripts.

Also updated the curl example in the readme to include -k

@netwolfuk
Copy link
Member

I have pushed your changes and a few other bits to the tcplugins/tcWebHooksTemplates repo .

Updated stride template.
Thanks to @jacobjohnston for formatting updates.

Format changes

  • Added the project name (and a link)
  • Put a space between "Build" and "#"
  • Changed the emoji used in failed from warning to :failed:

Meta data changes

  • Change description to include "Atlassian"
  • Set rank to 100 (rather than 1)
  • Added tooltip text
  • Removed support for "Responsibility Changed", since it was not
    working.
  • Updated description in readme.md

@jacobjohnston
Copy link
Author

Great! By the way, you may want to update your description in the TeamCity plugin repository to mention the sorts of things you have templates for. I was searching for phrases like "TeamCity Stride" for a couple of months with no luck - it took me a while to find your plugin because I wasn't necessarily thinking of using webhooks (even though it seems obvious in hindsight). I think there will be a lot of people searching for this solution for Stride now that their HipChat systems are being deprecated.

@netwolfuk
Copy link
Member

Ah. Yeah. That's a good point. I'll do that and then write a blog post about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants