shipit icon indicating copy to clipboard operation
shipit copied to clipboard

Feature request: Disallow, allow, and warn settings for tasks based on environment

Open Truemedia opened this issue 9 years ago • 1 comments

Hi there, Recently on a different ship sub project called ship-db where the purpose of it is to sync databases across environments I have the following scenario.

The plugin has database push and pull functionality, and I only want to allow the push task to be run on a local and staging environment, and pull on all environments.

To do this currently I would have to write my own logic to intercept the task call and write a function to deal with the request but I think this kind of functionality may be more ideal as core settings.

The discussion start here (https://github.com/timkelty/shipit-db/issues/12), and the author and several other people agree. I would be willing to contribute, and like the concept of allowTasks, disallowTasks, and warnTasks as extra settings to add under default and environments.

Maybe something like this?

module.exports = function (shipit) {
  shipit.initConfig({
    staging: {
      allowTasks: ['db:pull'],
      warnTasks: ['db:push']
    },
    production: {
      allowTasks: ['db:pull']
      disallowTasks: ['db:push']
    }
  });
};

Could only enable this functionality if any of the three arrays are populated for either default or that environment.

Truemedia avatar Mar 14 '16 20:03 Truemedia

@Truemedia I see the idea, we can do it in the next version.

gregberge avatar Aug 14 '17 08:08 gregberge