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 task notify-matrix #1171

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

sherine-k
Copy link

Changes

This notify-marix Task sends messages to a Matrix room on its corresponding endpoint.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Follows the authoring recommendations
  • Includes docs (if user facing)
  • Includes tests (for new tasks or changed functionality)
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Commit messages follow commit message best practices
  • Has a kind label. You can add one by adding a comment on this PR that
    contains /kind <type>. Valid types are bug, cleanup, design, documentation,
    feature, flake, misc, question, tep
  • Complies with Catalog Organization TEP, see example. Note An issue has been filed to automate this validation
    • File path follows <kind>/<name>/<version>/name.yaml

    • Has README.md at <kind>/<name>/<version>/README.md

    • Has mandatory metadata.labels - app.kubernetes.io/version the same as the <version> of the resource

    • Has mandatory metadata.annotations tekton.dev/pipelines.minVersion

    • mandatory spec.description follows the convention

        ```
      
        spec:
          description: >-
            one line summary of the resource
      
            Paragraph(s) to describe the resource.
        ```
      

See the contribution guide for more details.

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 12, 2023
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign vdemeester after the PR has been reviewed.
You can assign the PR to them by writing /assign @vdemeester in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 12, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sherine-k / name: Sherine Khoury (a61a717)

@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 12, 2023
@tekton-robot
Copy link

Hi @sherine-k. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 12, 2023
@tekton-robot
Copy link

Catlin Output
FILE: task/notify-matrix/0.1/notify-matrix.yaml
HINT : Task: tekton.dev/v1beta1 - name: "notify-matrix" is missing a readable display name annotation("tekton.dev/displayName")
Catlin script lint Output
WARN : step: notify-matrix is not using #!/usr/bin/env 
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In notify-matrix-post line 2:
if [[ -z "$(params.room)" || -z "$(params.endpoint)" ]]; then
   ^-- SC3010: In POSIX sh, [[ ]] is undefined.


In notify-matrix-post line 5:
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token=$TOKEN
                                                                   ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
                                                                                                                              ^----------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                         ^------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                                                                         ^----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token="$TOKEN"

For more information:
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.
  https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...

@tekton-robot
Copy link

Catlin Output
FILE: task/notify-matrix/0.1/notify-matrix.yaml
HINT : Task: tekton.dev/v1beta1 - name: "notify-matrix" is missing a readable display name annotation("tekton.dev/displayName")
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In notify-matrix-post line 2:
if [[ -z "$(params.room)" || -z "$(params.endpoint)" ]]; then
   ^-- SC3010: In POSIX sh, [[ ]] is undefined.


In notify-matrix-post line 5:
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token=$TOKEN
                                                                   ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
                                                                                                                              ^----------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                         ^------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                                                                         ^----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token="$TOKEN"

For more information:
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.
  https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...

@tekton-robot
Copy link

Catlin Output
FILE: task/notify-matrix/0.1/notify-matrix.yaml
HINT : Task: tekton.dev/v1beta1 - name: "notify-matrix" is missing a readable display name annotation("tekton.dev/displayName")
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s bash] failed:

In notify-matrix-post line 5:
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token=$TOKEN
                                                                   ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
                                                                                                                              ^----------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                         ^------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                                                                         ^----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token="$TOKEN"

For more information:
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...

@tekton-robot
Copy link

Catlin Output
FILE: task/notify-matrix/0.1/notify-matrix.yaml
HINT : Task: tekton.dev/v1beta1 - name: "notify-matrix" is missing a readable display name annotation("tekton.dev/displayName")
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s bash] failed:

In notify-matrix-post line 5:
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data '{"msgtype":"m.text", "body":"$(params.message)"}' https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token="$TOKEN"
                                                                   ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
                                                                                                                              ^----------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                         ^------------^ SC2046: Quote this to prevent word splitting.

For more information:
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
  https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...

@tekton-robot
Copy link

Catlin Output
FILE: task/notify-matrix/0.1/notify-matrix.yaml
HINT : Task: tekton.dev/v1beta1 - name: "notify-matrix" is missing a readable display name annotation("tekton.dev/displayName")
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s bash] failed:

In notify-matrix-post line 5:
  /usr/bin/curl -X POST -H 'Content-type: application/json' --data "{\"msgtype\":\"m.text\", \"body\":\"$(params.message)\"}" https://$(params.endpoint)/_matrix/client/r0/rooms/$(params.room)/send/m.room.message?access_token="$TOKEN"
                                                                                                                                      ^----------------^ SC2046: Quote this to prevent word splitting.
                                                                                                                                                                                 ^------------^ SC2046: Quote this to prevent word splitting.

For more information:
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...

@sherine-k sherine-k force-pushed the matrix-notify branch 2 times, most recently from 321d1c7 to b93eaaf Compare June 13, 2023 13:45
@sherine-k
Copy link
Author

/test all

@tekton-robot
Copy link

@sherine-k: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test all

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@keskad
Copy link

keskad commented Jun 14, 2023

Wow! Matrix support sounds awesome! I guess it would not support encrypted rooms due to Matrix nature (key sharing & keeping etc.), but unencrypted rooms for CI/CD notifications is a big step 🎉

3. **`endpoint`**: URI of the matrix server to connect and send the message from
4. **`message`**: the message to be sent

## Setting up the `matrix-secret`
Copy link

Choose a reason for hiding this comment

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

It would be cool to have a recipe on how to retrieve an access token - e.g. an example with a curl to execute in local shell in order to have a secret that could be added into kind: Secret

Copy link
Author

Choose a reason for hiding this comment

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

sure! I'll update the Readme

This PR adds a new task, `notify-matrix` which sends messages to a [Matrix](https://matrix.org/) room on its corresponding endpoint.
@tekton-robot
Copy link

The following users are mentioned in OWNERS file(s) but are untrusted for the following reasons. One way to make the user trusted is to add them as members of the tektoncd org. You can then trigger verification by writing /verify-owners in a comment.

  • sherine-k
    • User is not a member of the org. User is not a collaborator. Satisfy at least one of these conditions to make the user trusted.
    • task/notify-matrix/OWNERS

@sherine-k
Copy link
Author

Hi @keskad , I've updated the readme.
I'm not sure what is expected in the owners file. Would you be able to assist?
Thanks!

@sherine-k sherine-k changed the title WIP: Add task notify-matrix Add task notify-matrix Jul 4, 2023
@sherine-k
Copy link
Author

/unhold

@tekton-robot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 2, 2023
@sherine-k
Copy link
Author

/remove-lifecycle stale
@keskad , based on your previous comment, I've updated the readme.
I'm not sure what is expected in the owners file. Would you be able to assist?
Thanks!

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants