Skip to content

takaishi/batron

Repository files navigation

batron

batron is a deployment tool for AWS Batch inpired by ecspresso.

Install

go install github.com/takaishi/batron/cmd/batron

Usage

% batron --help
Usage: batron <command> [flags]

Flags:
  -h, --help       Show context-sensitive help.
      --version    show version

Commands:
  render [flags]
    Render job definition

  deploy [flags]
    Deploy job definition

  deregister [flags]
    Deregister old job definitions

  submit-job --job-definition=STRING --job-queue=STRING --job-name=STRING [flags]
    Submit a job to AWS Batch

Run "batron <command> --help" for more information on a command.

At first, you need to create a config file.

{
  job_definition: 'job-def.jsonnet'
}

Then, you can create a job definition file. It is request body of RegisterJobDefinition API ( https://docs.aws.amazon.com/batch/latest/APIReference/API_RegisterJobDefinition.html ).

local imageTag = std.extVar('imageTag');

{
  jobDefinitionName: "hoge-job",
  type: "container",
  platformCapabilities: ["FARGATE"],
  retryStrategy: {
    attempts: 3,
    evaluateOnExit: [
      { onStatusReason: "Essential container in task exited", action: "RETRY" },
      { onReason: "*", action: "EXIT" }
    ]
  },
  ecsProperties: {
    taskProperties: [
     {
       containers: [
         {
           image: std.format('image:%s', [imageTag]),
           command: [],
           resourceRequirements: [
             {
               type: "VCPU",
               value: "2"
             },
             {
               type: "MEMORY",
               value: "4096"
             }
           ],
         }
       ]
     }
   ]
 }
}

You can deploy a job definition by the following command.

batron deploy --config ./path/to//batron.jsonnet --ext-str=imageTag=${IMAGE_TAG} 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •