Strider-CD / strider-webhooks

Fire webhooks reporting build status
6 stars 9 forks source link

Error after uninstall: Plugin not found #10

Open emcniece opened 8 years ago

emcniece commented 8 years ago

Tried uninstalling via UI "uninstall" button, and now tests/builds fail with a message:

Plugin required but not found: webhooks

Error log:

2016-02-04T23:14:25.790Z - info: job.prepare - strider.json not found, skipping config merge
2016-02-04T23:14:25.792Z - info: [runner:simple-runner] Queued new job. Project: company/repo Job ID: 56b3db51fe1714ea56105788
2016-02-04T23:14:25.811Z - info: [runner:simple-runner] Job started. Project: company/repo Job ID: 56b3db51fe1714ea56105788
2016-02-04T23:14:25.812Z - info: [runner:simple-runner] Error: Plugin not found webhooks Project: company/repo Job ID: 56b3db51fe1714ea56105788
2016-02-04T23:14:25.812Z - warn: Plugin not found webhooks
2016-02-04T23:14:25.813Z - info: [runner:simple-runner] Job done with error. Project: company/repo Job ID: 56b3db51fe1714ea56105788

Issue persists after restarting strider service, as well as system reboot.

emcniece commented 8 years ago

The problem was that the plugin was uninstalled before it was deactivated in the project configuration page. Here's a sample project, note the null config on the "webhooks" plugin subdoc:

> db.projects.find().pretty()
{
    "_id" : ObjectId("56afeeb32c67b7560e33013d"),
    "name" : "company/repo",
    "display_name" : "company/repo",
    "display_url" : "https://github.com/company/repo",
    "creator" : ObjectId("56afed9398f30d2f0ebda90e"),
    "provider" : {
        "id" : "github",
        "account" : "13321207",
        "repo_id" : "31740187",
        "config" : {
            "secret" : "8f92ea46aca38a319fc4159fdc27105fdbc22c74f7971121870a29a8fa0a8d90",
            "auth" : {
                "type" : "https"
            },
            "repo" : "repo",
            "owner" : "company",
            "url" : "git://github.com/company/repo.git"
        }
    },
    "branches" : [
        {
            "name" : "master",
            "_id" : ObjectId("56afeeb32c67b7560e33013f"),
            "runner" : {
                "id" : "simple-runner",
                "config" : {
                    "pty" : false
                }
            },
            "plugins" : [
                {
                    "id" : "node",
                    "enabled" : true,
                    "config" : {
                        "globals" : [ ],
                        "test" : "npm test",
                        "caching" : "loose",
                        "runtime" : "whatever",
                        "fork" : "Node.js"
                    },
                    "_id" : ObjectId("56b3c279ac9fbb8d54434c57"),
                    "showStatus" : true
                },
                {
                    "id" : "custom",
                    "enabled" : true,
                    "config" : {
                        "environment" : "# put your shell code here\n\n\n",
                        "prepare" : "bower install --allow-root\nexport DISPLAY=:1\n",
                        "test" : "# put your shell code here\nexport DISPLAY=:1",
                        "deploy" : "cd playbooks;\n/usr/bin/script.sh -l -vvvv;\n",
                        "cleanup" : "# put your shell code here\n",
                        "shell" : "Bash"
                    },
                    "_id" : ObjectId("56b3c279ac9fbb8d54434c56"),
                    "showStatus" : true
                },
                {
                    "id" : "slack",
                    "enabled" : true,
                    "config" : {
                        "webhookURL" : "slackUrl",
                        "deploy_fail_message" : ":boom: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Deploy exited with a non-zero status!> :: <%= trigger.message.trim() %>",
                        "deploy_pass_message" : ":ship: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Deploy was successful> :: <%= trigger.message.trim() %>",
                        "test_fail_message" : ":exclamation: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Tests are failing> :: <%= trigger.message.trim() %>",
                        "test_pass_message" : ":white_check_mark: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Tests are passing> :: <%= trigger.message.trim() %>",
                        "icon_url" : "http://site.ca/ext/slack/bot_avatar",
                        "username" : "<%= project.name %>",
                        "channel" : "#channel"
                    },
                    "_id" : ObjectId("56b3c279ac9fbb8d54434c55"),
                    "showStatus" : true
                },
                {
                    "id" : "github-status",
                    "enabled" : true,
                    "_id" : ObjectId("56b3c279ac9fbb8d54434c54"),
                    "showStatus" : true
                },
                {
                    "config" : [
                        null
                    ],
                    "id" : "webhooks",
                    "enabled" : true,
                    "_id" : ObjectId("56b3c279ac9fbb8d54434c53"),
                    "showStatus" : true
                }
            ],
            "deploy_on_green" : true,
            "mirror_master" : false,
            "active" : true
        },
        {
            "name" : "production",
            "privkey" : "-----BEGIN RSA PRIVATE KEY-----",
            "pubkey" : "ssh-rsa AAAA",
            "runner" : {
                "id" : "simple-runner",
                "config" : {
                    "pty" : false
                }
            },
            "plugins" : [
                {
                    "id" : "node",
                    "enabled" : true,
                    "config" : {
                        "fork" : "Node.js",
                        "runtime" : "whatever",
                        "caching" : "loose",
                        "test" : "npm test",
                        "globals" : [ ]
                    },
                    "_id" : ObjectId("56afeeb32c67b7560e330140"),
                    "showStatus" : true
                },
                {
                    "config" : {
                        "environment" : "# put your shell code here",
                        "prepare" : "# put your shell code here\nbower install --allow-root\nexport DISPLAY=:1\n\n",
                        "test" : "# put your shell code here\nexport DISPLAY=:1\n\n\n",
                        "deploy" : "cd playbooks;\n/usr/bin/script.sh -vvvv;\n\n",
                        "cleanup" : "# put your shell code here\n",
                        "shell" : "Bash"
                    },
                    "id" : "custom",
                    "enabled" : true,
                    "_id" : ObjectId("56aff12fb130b7c007dd3848"),
                    "showStatus" : true
                },
                {
                    "config" : {
                        "deploy_fail_message" : ":boom: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Deploy exited with a non-zero status!> :: <%= trigger.message.trim() %>",
                        "deploy_pass_message" : ":ship: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Deploy was successful> :: <%= trigger.message.trim() %>",
                        "test_fail_message" : ":exclamation: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Tests are failing> :: <%= trigger.message.trim() %>",
                        "test_pass_message" : ":white_check_mark: (<%= ref.branch %>) :: <<%= process.env.strider_server_name %>/<%= project.name %>/job/<%= _id %>|Tests are passing> :: <%= trigger.message.trim() %>",
                        "icon_url" : "http://site.ca/ext/slack/bot_avatar",
                        "username" : "<%= project.name %>",
                        "channel" : "#channel",
                        "webhookURL" : "slackhook"
                    },
                    "id" : "slack",
                    "enabled" : true,
                    "_id" : ObjectId("56aff12fb130b7c007dd3847"),
                    "showStatus" : true
                }
            ],
            "deploy_on_green" : true,
            "mirror_master" : false,
            "active" : true
        }
    ],
    "prefetch_config" : true,
    "public" : false,
    "__v" : 26
}

The solution (aside from users doing things in the proper order) is to remove any active configs from the project during uninstall. I'm not familiar with plugin creation for Strider - is there a hook for the uninstall process?

knownasilya commented 8 years ago

Ran into this today as well, although unsure if there is a plugin uninstall hook; doubt it.