Git Product home page Git Product logo

mattermost-community / mattermost-plugin-circleci Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 8.0 2.97 MB

Mattermost Plugin for CircleCI SaaS. Get notifications, trigger workflows, set env-vars directly from Mattermost

Home Page: https://circleci.com/developer/orbs/orb/nathanaelhoun/mattermost-plugin-notify

License: Apache License 2.0

Makefile 7.06% Go 92.94%
chatops circleci devops-tools hacktoberfest mattermost mattermost-plugin

mattermost-plugin-circleci's People

Contributors

albatrosef avatar cwarnermm avatar darklord19 avatar hanzei avatar heisdinesh avatar justinegeffen avatar nathanaelhoun avatar pradeepmurugesan avatar spirosoik avatar toninis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mattermost-plugin-circleci's Issues

More than the expected nr of notifications when using parallelism.

Describe the bug
When running a job in parallel, you get a notification for each executor, rather than one notification for the entire job.

To reproduce

  1. Set up parallelism in circle.
  2. Configure the mattermost circleci plugin according to the documentation.
  3. Add - mattermost-plugin-notify/status: to the end of the steps part of a job, as described in the orb documentation.
  4. Run a job on Circle
  5. Get a notification for each executor in the parallel job

Expected behavior
Get one notification that informs whether the entire job failed or succeeded.

Code refactoring

need to refactor code to make it more readable and intuitive to browse through. Better if we get done with this ASAP because refactor will mess up commit history

Warn when an environment variable will be overwritten

Is your feature request related to a problem? Please describe.

When setting an environnment variable that already exists, the old value is delete without warning.
image

Describe the solution you'd like

The plugin should ask to validate / ask to delete the old variable before setting a new value

Adjust translation for missing workflow ID validation

If a user tries to get data about a workflow and does not specify a workflow ID, the response says Please precise the ID of the workflow We should adjust the translation to Please specify the ID of the workflow

Steps:

  1. Type /circleci workflow rerun
  2. Send without an ID
    image

Meet the requirements for adding a community plugin to the Marketplace

Checklist to track progress. Documentation

Product Requirements

(Checked by a Product Manager)

  • The plugin is published under an Open Source license.
  • The source code is available in a public git repository.
  • There is a public issue or bug tracker for the plugin, which is linked in the plugin documentation and linked via support_url in the manifest.
  • The plugin provides detailed usage documentation with at least one screenshot of the plugin in action, list of features, and a development guide. This is typically a README file or a landing page on the web. The link to the documentation is set as homepage_url in the manifest. A great example is the README of the GitHub plugin.
  • For the current release and future releases, a changelog must be published. The link to the current release notes has to be recorded in the release_notes_url property of the plugin.json manifest. For example GitHub releases can be used to publish the changelog.
  • The plugin has to be out of Beta and be released with at least v1.0.0.
  • All configuration is accessible via the Mattermost UI.
  • The plugin ID defined in the manifest must not collide with the ID of an existing plugin in the Plugin Marketplace. It should follow the documentation’s suggested naming convention.

Technical Requirements

(Checked by developers of the Toolkit or the Integrations team)

  • The plugin works for 60k concurrent connections and in a high-availability deployment. Note: There are currently no publicly-available tools to verify these properties. As such, they are checked during code review by a developer.
  • The plugin logs important events on appropriate log levels to allow System Admins to troubleshoot issues.

Security Requirements

(Checked by a member of the Security team)

  • Security reviews do not reveal any exploitable vulnerabilities in the plugin.
  • The plugin provides an email address or a username on the Community Server used to report vulnerabilities in the future.

Functional Requirements

(Checked by a QA tester)

  • The plugin must set a min_server_version in the manifest.
  • The plugin must work on all Mattermost versions greater than or equal to the min_server_version.

Incorrect Webhook URL

Describe the bug

To Reproduce

  1. `/circleci subscription subscribe
  2. The URL is https://mattermost-url.url/plugins/com.github.nathanaelhoun.plugin-circleci//hooks/*************** with two slashes before hooks

Expected behavior

Should be https://mattermost-url.url/plugins/com.github.nathanaelhoun.plugin-circleci/hooks/***************

Prevent plugin from starting when At Rest Encryption Key is not set

It is currently possible to run the plugin when At Rest Encryption Key is not set.

I'm not sure we should allow this. If a user attempts to connect to their GitHub account in this case they will see Internal error when storing your token
Logs show

{"level":"dpanic","ts":1616790113.21193,"caller":"[email protected]/sugar.go:191","msg":"Ignored key without a value.","plugin_id":"com.github.mattermost.plugin-circleci","ignored":"crypto/aes: invalid key size 0\ncould not create a cipher block, check key\ngithub.com/mattermost/mattermost-plugin-circleci/server/store.encrypt\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/store/utils.go:34\ngithub.com/mattermost/mattermost-plugin-circleci/server/store.(*Store).StoreTokenForUser\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/store/kv_store.go:37\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).executeAccountConnect\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/account.go:154\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).executeAccount\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/account.go:56\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).ExecuteCommand\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/command.go:222\ngithub.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ExecuteCommand\n\t/Users/dylanhaussermann/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/plugin/client_rpc_generated.go:114\nreflect.Value.call\n\t/usr/local/go/src/reflect/value.go:476\nreflect.Value.Call\n\t/usr/local/go/src/reflect/value.go:337\nnet/rpc.(*service).call\n\t/usr/local/go/src/net/rpc/server.go:377\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1371\nError occurred while encrypting access token\ngithub.com/mattermost/mattermost-plugin-circleci/server/store.(*Store).StoreTokenForUser\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/store/kv_store.go:39\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).executeAccountConnect\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/account.go:154\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).executeAccount\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/account.go:56\ngithub.com/mattermost/mattermost-plugin-circleci/server/plugin.(*Plugin).ExecuteCommand\n\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-circleci/server/plugin/command.go:222\ngithub.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ExecuteCommand\n\t/Users/dylanhaussermann/go/pkg/mod/github.com/mattermost/mattermost-server/[email protected]/plugin/client_rpc_generated.go:114\nreflect.Value.call\n\t/usr/local/go/src/reflect/value.go:476\nreflect.Value.Call\n\t/usr/local/go/src/reflect/value.go:337\nnet/rpc.(*service).call\n\t/usr/local/go/src/net/rpc/server.go:377\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"}
{"level":"error","ts":1616790113.2118974,"caller":"mlog/sugar.go:25","msg":"Error when storing token","plugin_id":"com.github.mattermost.plugin-circleci"}

0/5 we may want to just prevent the startup of the plugin in this case

Check the generated webhook secret

Sometimes, the webhook secret contains a / character. This make the router to be confused, and the webhooks never arrive.
We should check the webhook secret value before validation
image

Plugin Intake Checklist

Mark as done after each step completed

As the individual doing plugin intake, you will need the following privileges.

  • Github repository admin access. You will see the Settings option tab if access has been granted. (next to Pull requests, Actions, Releases)
  • Mattermost Channel admin access. This will allow editing the channel header

The following options require Mattermost admin privileges. If you don't have these (likely) ask management

  • Mattermost sysadmin access.
    • Needed for creating new public channels
    • Needed for /jira subscribe if applicable

How To Transfer Repo to the Mattermost Org

  • Transfer the repo to a member with Mattermost GitHub Organization admin access
  • They will need to then transfer from their personal account to the Mattermost Organization
  • Ask them to add you as repo admin to finish the intake process

Repository Setup - Settings

  • Options (Make sure the following are the only selected items)

    • Features:
    • Wikis
    • Restrict editing to users in teams with push access only
    • Issues
      • Projects
    • Data services
    • Security alerts
    • Merge Button:
    • Allow squash merging
    • Automatically delete head branches
  • Setup GitHub 1st Project

  • Collaborators (Manage Access)

    • Add the following
      • mattermost/core-build-engineers
      • mattermost/core-committers
      • mattermost/core-developers
      • mattermost/core-pms
      • mattermost/integrations
      • mattermost/qa-core-team
      • mattermost/tech-writers
  • Branches

Branch protection Rules: master should already be available. Click edit next to master and verify the following defaults

  • Branch name pattern: master

    • Applies to 1 branch: master
  • Protecting matching branches

  • Require pull request reviews before merging: required approving reviews :2

    • Dismiss stale pull request approvals when new commits are pushed
  • Require review from Code Owners

  • Require status checks to pass before merging

  • Webhooks

Install GitHub Apps

  • CircleCi Checks
  • Dependabot Preview

README.md

  • add circleci badge
  • add codecov badge
  • add go report badge

If these don't exist, create Tickets for each (these are available in the Demo page)

  • Add HW to Readme
  • Slash commands documented
  • Images added
  • Installation / Configuration section added

Repository checks

Each of the following might require new commits and PRs against master.

  • go mod tidy
  • version
  • All tests passing
  • npm audit fix
  • npm-check -E -u to view the changes interactively
  • npm-check -E -y to update without interactive
    • check in package-lock.json and package.json
  • grep for original repo references in all files

Mattermost Channels Setup

  • Plugin: <plugin_name> - setup new plugin channel
    • Add plugin author and some other integration team members
    • Github subscribe
      • /github subscribe mattermost/mattermost-plugin-solar-lottery pulls,issues,creates
    • Header: [HW] | [repo] | [circle-ci] | PM: | Dev:

Actual text for header - replace all instances of <plugin_repo>, <pm-name>, <dev-name>

[GitHub](https://github.com/mattermost/<plugin_repo>) | [Help Wanted](https://github.com/mattermost/<plugin_repo>/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3A%22up+for+grabs%22+label%3A%22help+wanted%22+sort%3Aupdated-desc) | [![CircleCI](https://circleci.com/gh/mattermost/<plugin-repo-namme>.svg?style=shield)](https://circleci.com/gh/mattermost/<plugin-repo) | PM: @<pm-name> | Dev: @<dev-name>
  • GitHub subscribe in ~Plugin Heartbeat channel
    • /github subscribe mattermost/mattermost-plugin-solar-lottery pulls

The Rest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.