Skip to content

Add ability to set top-level defaults for actions #36

@zack-is-cool

Description

@zack-is-cool

Given this example (below), I find myself having to set shell over and over for each cmd. In my current project I have this for each cmd which is 15 times (and growing). It would be a nice QoL to be able to set some kind of top level default configuration to keep my task actions a lil drier. Maybe this could apply to other features like maxRetries, maxTotalSeconds, mute. Additionally the defaults need to be overridable at each individual action.

    actions:
      - task: check-env
        with:
          env: ${ENV}
      - description: "Check if bootstrap for '$env' is clean"
        cmd: |
          set -exo pipefail
          # check if ./iac/env/${INPUT_ENV}/backends/bootstrap-backend.tfconfig exists
          if [ -f ./iac/env/${INPUT_ENV}/backends/bootstrap-backend.tfconfig ]; then
            echo "terraform s3 backend environment files for ${INPUT_ENV} already exists"
            exit 1
          fi
        shell:
          linux: bash
          darwin: bash
      - description: "Init the bootstrap module"
        task: terraform-init
        with:
          root_module: bootstrap
      - description: "Apply the bootstrap module in the specified environment"
        task: terraform-apply
        with:
          env: ${ENV}
          root_module: bootstrap
          var_files: '["common.terraform.tfvars", "bootstrap.terraform.tfvars"]'
      - description: "Migrate local backend to s3"
        cmd: |
          set -exo pipefail
          cd ./iac/bootstrap
          terraform init --reconfigure --force-copy --backend-config=../env/${INPUT_ENV}/backends/bootstrap-backend.tfconfig && \
            mv terraform.tfstate "terraform-tfstate.${INPUT_ENV}-local-backend-backup"
        shell:
          linux: bash
          darwin: bash

thx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions