riotkit-org / riotkit-do

RKD - RiotKit DO. Task executor - balance between Makefile and Gradle. Written in Python. Powerful tool for every DevOps. Automates production tasks as well as local development tasks
Apache License 2.0
10 stars 2 forks source link

Extendable base tasks #66

Open blackandred opened 3 years ago

blackandred commented 3 years ago
  1. Add a possibility to extend tasks in YAML, in Python just extend class inside Makefile as usual.
  2. Add visibility attribute to TaskDeclaration, so the :task task can hide internal "intermediate" tasks - add optional switch "--private" in :tasks to see such tasks
  3. Add configure() inside TaskInterface and in YAML, that would be a Python code executed right after constructor. Create a "configuration" stage for tasks and execute it before argparse. It's a place without Context access, just the class object to set attributes, settings.
  4. Add inside() Python method and YAML element. It should be invoked by execute() method and supported by task. Depending on the task it could be a bash/php/other language code executed inside docker container, Python code executed in context of a Task or everything else - Task that is extended decides about the implementation.
tasks:
    :test:in-docker:
            extends: rkd.standardlib.BaseInDocker
            visibility: private
            # executes, right after task is constructed, before argparse and execution
            configure: |
                this: rkd.standardlib.BaseInDocker
                this.set_argument('--image', 'alpine:3.12') # argparse arguments
                this.set_image('alpine:3.12')               # internal arguments/variables
            # executes when task is executed. Handled and supported inside of execute() method of a task. Not all tasks may implement this.
            inside: |
                ps aux
                uname -a