rocketeers / rocketeer-slack

Slack notifications for Rocketeer
MIT License
29 stars 8 forks source link

[Develop Branch] Same notification (finished) being sent before and after deploy #7

Closed arenowebdev closed 10 years ago

arenowebdev commented 10 years ago

Log output:

$ php artisan deploy --stage=staging
production/0/staging    | Deploy (Deploys the website) [~49.42s]
production/0/staging    |-- Notify (Notify a third-party service) fired by deploy.after
production/0/staging    |-- Primer (Run local checks to ensure deploy can proceed)
production/0/staging    |-- CreateRelease (Creates a new release on the server) [~3.67s]
production/0/staging    |---- Deploy/Clone (Clones a fresh instance of the repository by SCM)
production/0/staging    |===> Cloning repository in "/var/www/project/staging/releases/20140822234000"
production/0/staging    |===> Initializing submodules if any
production/0/staging    |-- Dependencies (Installs or update the dependencies on server) [~41.46s]
production/0/staging    |---- Dependencies/Polyglot (Runs all of the above package managers if necessary)
production/0/staging    |---- Dependencies/Composer (Installs dependencies with Composer)
Setting permissions for /var/www/project/staging/releases/20140822234000/app/database/production.sqlite
Setting permissions for /var/www/project/staging/releases/20140822234000/app/storage
Setting permissions for /var/www/project/staging/releases/20140822234000/public
Sharing file /var/www/project/staging/releases/20140822234000/app/storage/logs
Sharing file /var/www/project/staging/releases/20140822234000/app/storage/sessions
production/0/staging    |=> Successfully deployed release 20140822234000
production/0/staging    |-- Notify (Notify a third-party service) fired by deploy.after [~0.9s]
production/0/staging    | Cleanup (Clean up old releases from the server) [~0.46s]
production/0/staging    |=> Removing 1 release from the server
Execution time: 52.9134s
arenowebdev commented 10 years ago

Pretty sure it is priority related in the rocketeer repo...shall I move the issue there?

https://github.com/rocketeers/rocketeer/blob/develop/src/Rocketeer/Plugins/AbstractNotifier.php

<?php
/*
 * This file is part of Rocketeer
 *
 * (c) Maxime Fabre <ehtnam6@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Rocketeer\Plugins;

use Rocketeer\Abstracts\AbstractPlugin;
use Rocketeer\Services\TasksHandler;
use Rocketeer\Tasks\Subtasks\Notify;

/**
 * A base class for notification services to extends
 */
abstract class AbstractNotifier extends AbstractPlugin
{
    /**
     * Register Tasks with Rocketeer
     *
     * @param \Rocketeer\Services\TasksHandler $queue
     *
     * @return void
     */
    public function onQueue(TasksHandler $queue)
    {
        // Create the task instance
        $notify = new Notify($this->app);
        $notify->setNotifier($this);

        // Since these have the same -10 priority, it gets fired
        // last in first for some reason...??
        $queue->addTaskListeners('deploy', 'before', [$notify], -10, true);
        $queue->addTaskListeners('deploy', 'after', [$notify], -10, true);
Anahkiasen commented 10 years ago

Can confirm this, just tested. Can you reopen this on the Rocketeer repository ? That's where the AbstractNotifier is

Anahkiasen commented 10 years ago

Fixed by rocketeers/rocketeer@c3c402eba755422cfa37e8497290a5e504085bbf