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

feat: Teams communication adapter #4968

Merged
merged 36 commits into from
Jul 9, 2024
Merged

Conversation

capaj
Copy link
Contributor

@capaj capaj commented Jun 13, 2024

Background

closes #4538

This is how it looks when you add/remove a channel:

image

This is how a schema change looks in teams

image

on FE I have added a link to the guide how to setup webhook in ms teams:
image

once you add your URL it goes like this:
image

Description

Mostly just added a new CommunicationAdapter and extended BE/FE code which was assuming we only have two adapters

Testing

if you want to test on your local, you can use my ms teams webhook:
https://jspac.webhook.office.com/webhookb2/d11d2f0d-7820-4684-b721-e0d8e9a94ab8@4b220568-ffe7-4204-a3c5-5c6bebc60ab9/IncomingWebhook/1a693644edbc449c8a1ce9306d9c13ef/4a134898-79cd-4a70-9405-abfecd2879f4

Checklist

  • Input validation
  • Output encoding
  • Authentication management
  • Session management
  • Access control
  • Cryptographic practices
  • Error handling and logging
  • Data protection
  • Communication security
  • System configuration
  • Database security
  • File management
  • Memory management
  • Testing

Copy link

changeset-bot bot commented Jun 13, 2024

⚠️ No Changeset found

Latest commit: 903c95a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jun 13, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-hive/apollo 0.33.2-alpha-20240613124220-0cbd28bb1f6fa9b2ee51715dfadb34aee39bbf3c npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Jun 13, 2024

📚 Storybook Deployment

The latest changes are available as preview in: https://32984a24.hive-storybook.pages.dev

Copy link
Contributor

github-actions bot commented Jun 13, 2024

🐋 This PR was built and pushed to the following Docker images (tag: 903c95ac790baa32272fa1d19477010bdc205043):

Docker Bake metadata
{
"app": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/bo72l6oo92ljom8qp5vtdqmsu",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:376427ad195cf83ba786b19e41fac77638a3435feb1ff548b55179c0135e07cc",
    "size": 685
  },
  "containerimage.digest": "sha256:376427ad195cf83ba786b19e41fac77638a3435feb1ff548b55179c0135e07cc",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/app:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/app:TeamsCommunicationAdapter"
},
"composition-federation-2": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/m9uw6r6res2e9a5tuiw0d90o3",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:22d5eb4a3c0d485a394dd4154c8d4f46d6f8d89d1439c363c40318214d2a7814",
    "size": 685
  },
  "containerimage.digest": "sha256:22d5eb4a3c0d485a394dd4154c8d4f46d6f8d89d1439c363c40318214d2a7814",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/composition-federation-2:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/composition-federation-2:TeamsCommunicationAdapter"
},
"emails": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/fxot1rvj971x00p4g6bly18x2",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:5a6274a281b4b6e85e978edaf465a300174032cf54d0fe4d43e3f2b8b1e45c89",
    "size": 685
  },
  "containerimage.digest": "sha256:5a6274a281b4b6e85e978edaf465a300174032cf54d0fe4d43e3f2b8b1e45c89",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/emails:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/emails:TeamsCommunicationAdapter"
},
"policy": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/ge08d4sgep2nfzf848rbdrjlv",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:7ea0a2342e757c54620fbbd18d1a23f1e8f1fc6d958ca9fb6a36891abef37c47",
    "size": 685
  },
  "containerimage.digest": "sha256:7ea0a2342e757c54620fbbd18d1a23f1e8f1fc6d958ca9fb6a36891abef37c47",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/policy:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/policy:TeamsCommunicationAdapter"
},
"rate-limit": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/s5pu5kkoff74qxymuqpc5w2yo",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:a51b2807cfa802204fad6ea124931f5b7b44c134d374aed43a09ba6f390589ad",
    "size": 685
  },
  "containerimage.digest": "sha256:a51b2807cfa802204fad6ea124931f5b7b44c134d374aed43a09ba6f390589ad",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/rate-limit:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/rate-limit:TeamsCommunicationAdapter"
},
"schema": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/e4fo0i54qp8tquwgp1xlrelcy",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:2f93f230838ed84497c766be809969016fba093b6d88697ae1b396458880c90e",
    "size": 685
  },
  "containerimage.digest": "sha256:2f93f230838ed84497c766be809969016fba093b6d88697ae1b396458880c90e",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/schema:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/schema:TeamsCommunicationAdapter"
},
"server": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/fzxo71hix0l40cyt90yw60vrt",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:5fd14321281f32b584567333ca94d3a59fb9806ee7645a0a1a154f838b3d9542",
    "size": 685
  },
  "containerimage.digest": "sha256:5fd14321281f32b584567333ca94d3a59fb9806ee7645a0a1a154f838b3d9542",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/server:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/server:TeamsCommunicationAdapter"
},
"storage": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/yjqel54yyzekoh3o9egipgy7m",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:c61076a96e19a16dd3dab7787ec759b95321c7d071d05e41ec558c577d1fd51a",
    "size": 685
  },
  "containerimage.digest": "sha256:c61076a96e19a16dd3dab7787ec759b95321c7d071d05e41ec558c577d1fd51a",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/storage:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/storage:TeamsCommunicationAdapter"
},
"stripe-billing": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/16i6zu7afl15bg685vhsn53vd",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:0093c3b0a1424cd2a50e9be05e4fff8e39f8333c6a524793f210b3f8de58767b",
    "size": 685
  },
  "containerimage.digest": "sha256:0093c3b0a1424cd2a50e9be05e4fff8e39f8333c6a524793f210b3f8de58767b",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/stripe-billing:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/stripe-billing:TeamsCommunicationAdapter"
},
"tokens": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/xeijlo02vo8ckx35g1cdhshb5",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:b2baa6df73a232c77d392608d170dc8f22aba193433d6bec136bb3da1f27b72c",
    "size": 685
  },
  "containerimage.digest": "sha256:b2baa6df73a232c77d392608d170dc8f22aba193433d6bec136bb3da1f27b72c",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/tokens:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/tokens:TeamsCommunicationAdapter"
},
"usage": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/pgpcj9lybl2537o5tmywawqxx",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:989fc54723a0c09bd360d8c7aa4530b2e94f92654740d10ebbf2406b78d2241e",
    "size": 685
  },
  "containerimage.digest": "sha256:989fc54723a0c09bd360d8c7aa4530b2e94f92654740d10ebbf2406b78d2241e",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/usage:TeamsCommunicationAdapter"
},
"usage-estimator": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/y6vo932p9e5a9bqlyy31j04c4",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:a52f4c4367f130fb9098554bbd2828789277d4be4b917cc464cdca192743d4cf",
    "size": 685
  },
  "containerimage.digest": "sha256:a52f4c4367f130fb9098554bbd2828789277d4be4b917cc464cdca192743d4cf",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage-estimator:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/usage-estimator:TeamsCommunicationAdapter"
},
"usage-ingestor": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/59300pu9v0tqdeftt5xbm4uc2",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:17d5d29d5af4a8cf6228f2fe8433eca737da46992cf42013b3c5c376333be44d",
    "size": 685
  },
  "containerimage.digest": "sha256:17d5d29d5af4a8cf6228f2fe8433eca737da46992cf42013b3c5c376333be44d",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/usage-ingestor:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/usage-ingestor:TeamsCommunicationAdapter"
},
"webhooks": {
  "buildx.build.ref": "builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac/builder-8c27cc26-e6c6-4935-9c66-afc61d7fb2ac0/isy9ems5bmxqgpojmxyx1ift0",
  "containerimage.descriptor": {
    "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
    "digest": "sha256:e7e747609532fba4c357eb96bbef6998529a278f9e35b31c0b65fbc001fb017f",
    "size": 685
  },
  "containerimage.digest": "sha256:e7e747609532fba4c357eb96bbef6998529a278f9e35b31c0b65fbc001fb017f",
  "image.name": "ghcr.io/kamilkisiela/graphql-hive/webhooks:903c95ac790baa32272fa1d19477010bdc205043,ghcr.io/kamilkisiela/graphql-hive/webhooks:TeamsCommunicationAdapter"
}
}

@capaj capaj force-pushed the TeamsCommunicationAdapter branch from c632416 to 905c655 Compare June 13, 2024 12:26
@capaj
Copy link
Contributor Author

capaj commented Jun 13, 2024

I added list rendering in the markdown message
image

@capaj capaj requested a review from kamilkisiela June 13, 2024 12:29
@capaj capaj marked this pull request as ready for review June 13, 2024 12:29
@capaj capaj added the enhancement New feature or request that adds new things or value to Hive label Jun 13, 2024
@capaj capaj changed the title Teams communication adapter feat: Teams communication adapter Jun 13, 2024
Copy link
Owner

@kamilkisiela kamilkisiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update docs? We need to communicate how to create such webhook endpoint, what is it etc.
https://the-guild.dev/graphql/hive/docs/management/projects#alert-channels

We also need to communicate this change by creating a product update.

@capaj capaj force-pushed the TeamsCommunicationAdapter branch from 662b9ac to 2ba1762 Compare June 14, 2024 09:10
Copy link
Contributor

github-actions bot commented Jun 14, 2024

💻 Website Preview

The latest changes are available as preview in: https://25f4fbb3.hive-landing-page.pages.dev

@capaj
Copy link
Contributor Author

capaj commented Jun 14, 2024

We also need to communicate this change by creating a product update.

how do we create those? Where?

@kamilkisiela
Copy link
Owner

@capaj
https://github.com/kamilkisiela/graphql-hive/tree/main/packages/web/docs/src/pages/product-updates

@capaj capaj force-pushed the TeamsCommunicationAdapter branch from 0e8b5ec to 4a3d6fb Compare June 15, 2024 07:58
@capaj capaj force-pushed the TeamsCommunicationAdapter branch 2 times, most recently from bfddcd7 to edbecd2 Compare June 17, 2024 08:06
@capaj capaj force-pushed the TeamsCommunicationAdapter branch 2 times, most recently from c416c87 to 65d9daa Compare June 19, 2024 09:27
@capaj
Copy link
Contributor Author

capaj commented Jun 19, 2024

@kamilkisiela should be ready for second PR round

package.json Outdated Show resolved Hide resolved

We added support for configuring MS Teams webhooks to receive alerts and notifications from Hive.

![MS Teams Webhook dialog](/changelog/2024-06-14-ms-teams-webhooks-alerts/project-msteams-alert.png)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a picture that shows the remaining app in the background, so it is not just one big modal covering the full-screen width. Similar to https://the-guild.dev/graphql/hive/product-updates/2024-04-09-approval-comment

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jul 1, 2024

image

this looks a bit broken, this is how it looks for slack channels:

image

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jul 1, 2024

I tried to push the schema.graphql in the Hive root, and it seems that there are so many schema changes that the payload is rejected by the ms teams API. Could we in such a case truncate the number of changes and append info that the list is truncated and all details can be found within the web app?

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some feedback

@capaj
Copy link
Contributor Author

capaj commented Jul 1, 2024

that table definitely needs some truncating. I have very wide monitor, for me it looked much better.

The maximum payload size for an incoming webhook message in Microsoft Teams is 28 KB. This includes the entire JSON payload, not just the Markdown content. Will add truncation there for max length of 27KB to be safe

@capaj capaj force-pushed the TeamsCommunicationAdapter branch 2 times, most recently from a504aff to eaa0bdd Compare July 2, 2024 10:25
@capaj capaj force-pushed the TeamsCommunicationAdapter branch from eaa0bdd to d07cc6b Compare July 2, 2024 12:53
@capaj
Copy link
Contributor Author

capaj commented Jul 4, 2024

table styles should be fixed now:
image

Here is how 900 px wide is rendered:
image

@capaj
Copy link
Contributor Author

capaj commented Jul 4, 2024

on CI lint is failing:

[warn] packages/web/app/src/components/project/alerts/channels-table.tsx
[warn] packages/web/app/src/components/ui/card.tsx
[warn] packages/web/app/src/components/v2/tag.tsx

locally when running lint I get no issues, just some deprecation warning
image

I did touch those files, but I cannot see anything that could be a problem. I tried running pnpm lint:fix but that did not fix anything.
Can you try to run it on your machine @n1ru4l or @kamilkisiela ?

@capaj
Copy link
Contributor Author

capaj commented Jul 4, 2024

Apart from that eslint weirdness everything is green, so I am requesting review

@capaj capaj requested a review from n1ru4l July 4, 2024 09:56
@theguild-bot theguild-bot temporarily deployed to development July 4, 2024 10:30 Inactive
@kamilkisiela kamilkisiela enabled auto-merge (squash) July 9, 2024 14:54
@kamilkisiela kamilkisiela enabled auto-merge (squash) July 9, 2024 15:14
@kamilkisiela kamilkisiela merged commit e74722d into main Jul 9, 2024
25 checks passed
@kamilkisiela kamilkisiela deleted the TeamsCommunicationAdapter branch July 9, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request that adds new things or value to Hive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support MS Teams as a first-class notification/alert target
5 participants