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

Feature: YAML - snippets support #51

Closed blackandred closed 3 years ago

blackandred commented 4 years ago

Scenario: As a task developer I would like to share the code snippets regardless of language. So I should be able to define a snippet that could be reusable in task steps.

Example:

version: org.riotkit.rkd/yaml/v1
imports: []

env_file:
    - ../.env

snippets:
    "@pre-keys": |
        ps aux

tasks:
    :docker:up:
        become: root
        description: Runs a dockerized environment
        steps: |
            docker rm -f s3pb_db_1
            docker-compose -p s3pb -f .infrastructure/docker/docker-compose.yml up -d --force-recreate

    :create:keys:
        description: Create JWT encryption keys
        steps:
            - "#!snippet @pre-keys"
            - mkdir -p config/jwt
            - openssl genpkey -out config/jwt/private.pem -aes256 -pass pass:$JWT_PASSPHRASE -algorithm rsa -pkeyopt rsa_keygen_bits:4096
            - openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout -passin pass:$JWT_PASSPHRASE
blackandred commented 4 years ago

To consider. YAML also has a native syntax for that. Need to consider benefits of a custom implementation.

blackandred commented 3 years ago

Finally - won't do, use YAML native syntax.