Skip to content

request: ability to define tasks with manifest.yml files #4101

Open
@zackdotcomputer

Description

Current State

Currently, if a user wants to perform an action like a db migration where you:

  • Require the roles, privileges, and secrets of the application's main service(s)
  • Need to run code or scripts separate from your jobs or services - e.g. management code you don't want to ship in a production image or which needs to run once before deploying
  • Want to clean up the resources used for the action after completion

Then the intended flows appears to be either

Using tasks:

  1. Use copilot task run --generate-cmd ... to create a template command from their service's manifest (which may be thousands of characters long depending on the number of secrets - my project's output is nearly 7k characters)
  2. Manually override the correct points of the generated command - most likely the dockerfile flag in this case, though possibly also the command flag.
  3. Copy the generated-and-modified command back into your shell and execute.

Using jobs:

  1. Define a job manifest with copilot job init
  2. Set the job's schedule to none
  3. Deploy the job with copilot job deploy
  4. Run the job with copilot job run
  5. Destroy the job resources with copilot job delete

Proposal

I propose that a more ideal flow would be a job-like manifest that can be executed in a one-off manner like a task. This could work in the following way:

  1. Define a manifest.yml file (perhaps with copilot task init or copilot job init depending on which concept the team thinks this more closely aligns to). It should have the same variables and secrets as the service but a different type to indicate its one-off nature, such as "Transient Job" or "Task". (Relatedly - this could be further enhanced if [Feature Request] Ability to extend other manifests #3850 were implemented as the task manifest could extend the service manifest and inherit directly the secrets.)
  2. Run with a variation of copilot task run -a application -e environment taskname (or maybe -t taskname to indicate that a task manifest is being used? I would suggest -n taskname but that flag is already taken by the task group name.)

This has the advantage of keeping the task definition living in a structured yml format rather than as a shell command that must either be regenerated live or preserved in a script file, while preserving the tidiness and control that you get from the task concept.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area/taskIssues about taskstype/featureIssues that are new feature requests.type/requestIssues that are created by customers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions