mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(taskfile): add often used tasks
This commit is contained in:
102
taskfile/aws.yml
Normal file
102
taskfile/aws.yml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
cli:session-manager-plugin:install:
|
||||||
|
desc: install the session manager plugin for the aws cli
|
||||||
|
summary: |-
|
||||||
|
Install the session manager plugin for the AWS CLI.
|
||||||
|
platforms:
|
||||||
|
- darwin/arm64
|
||||||
|
interactive: true
|
||||||
|
cmds:
|
||||||
|
- >-
|
||||||
|
curl --continue-at '-'
|
||||||
|
--url 'https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac_arm64/session-manager-plugin.pkg'
|
||||||
|
--output 'session-manager-plugin.pkg'
|
||||||
|
- sudo installer -pkg 'session-manager-plugin.pkg' -target '/'
|
||||||
|
- sudo ln -fs '/usr/local/sessionmanagerplugin/bin/session-manager-plugin' '/usr/local/bin/session-manager-plugin'
|
||||||
|
status:
|
||||||
|
- test -r '/usr/local/sessionmanagerplugin/bin/session-manager-plugin'
|
||||||
|
- test -r '/usr/local/bin/session-manager-plugin'
|
||||||
|
|
||||||
|
ecr:login:
|
||||||
|
desc: login to an ecr
|
||||||
|
summary: |-
|
||||||
|
Login to an ECR.
|
||||||
|
|
||||||
|
Enables pulling and pushing images to it, as long as the AWS user has sufficient permissions.
|
||||||
|
internal: true
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- ECR_URL
|
||||||
|
cmd: aws ecr get-login-password | docker login --username 'AWS' --password-stdin '{{.ECR_URL}}'
|
||||||
|
|
||||||
|
ecs:service:check:can-execute:
|
||||||
|
desc: check one can execute commands in an ecs service's tasks
|
||||||
|
summary: |-
|
||||||
|
Check one can execute commands in an ECS service's tasks.
|
||||||
|
internal: true
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
- CLUSTER
|
||||||
|
- SERVICE_NAME
|
||||||
|
vars:
|
||||||
|
CLUSTER: '{{.CLUSTER}}'
|
||||||
|
cmd: >-
|
||||||
|
aws ecs list-tasks --cluster '{{.CLUSTER}}' --service-name '{{.SERVICE_NAME}}' --query 'taskArns' --output 'text'
|
||||||
|
| xargs aws ecs describe-tasks --cluster '{{.CLUSTER}}' --output 'yaml'
|
||||||
|
--query 'tasks[0] | {
|
||||||
|
"managedAgents": containers[].managedAgents[?@.name==`ExecuteCommandAgent`][],
|
||||||
|
"enableExecuteCommand": enableExecuteCommand
|
||||||
|
}'
|
||||||
|
--tasks
|
||||||
|
ecs:service:execute:
|
||||||
|
desc: execute a command in an ecs service's task
|
||||||
|
summary: |-
|
||||||
|
Execute a command in an ECS service's task.
|
||||||
|
internal: true
|
||||||
|
interactive: true
|
||||||
|
deps:
|
||||||
|
- cli:session-manager-plugin:install
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
- CLUSTER
|
||||||
|
- CONTAINER_NAME
|
||||||
|
- SERVICE_NAME
|
||||||
|
- COMMAND
|
||||||
|
vars:
|
||||||
|
CLUSTER: '{{.CLUSTER}}'
|
||||||
|
cmd: >-
|
||||||
|
aws ecs list-tasks --cluster '{{.CLUSTER}}' --service-name '{{.SERVICE_NAME}}' --query 'taskArns[0]' --output 'text'
|
||||||
|
| xargs -o -I '%%' aws ecs execute-command --interactive --command '{{.COMMAND}}' --cluster '{{.CLUSTER}}' --container '{{.CONTAINER_NAME}}' --task '%%'
|
||||||
|
ecs:service:get-shell:
|
||||||
|
desc: get a shell in an ecs service's task
|
||||||
|
summary: |-
|
||||||
|
Get a shell in an ECS service's task.
|
||||||
|
internal: true
|
||||||
|
interactive: true
|
||||||
|
cmd:
|
||||||
|
task: ecs:service:execute
|
||||||
|
vars:
|
||||||
|
COMMAND: bash
|
||||||
|
CONTAINER_NAME: '{{.CONTAINER_NAME}}'
|
||||||
|
SERVICE_NAME: '{{.SERVICE_NAME}}'
|
||||||
|
ecs:service:get-tasks-ips:
|
||||||
|
desc: get the ip addresses of an ecs service's tasks
|
||||||
|
summary: |-
|
||||||
|
Get the IP addresses of an ECS service's tasks.
|
||||||
|
internal: true
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
- CLUSTER
|
||||||
|
- SERVICE_NAME
|
||||||
|
vars:
|
||||||
|
CLUSTER: '{{.CLUSTER}}'
|
||||||
|
cmd: >-
|
||||||
|
aws ecs list-tasks --cluster '{{.CLUSTER}}' --service-name '{{.SERVICE_NAME}}' --query 'taskArns[0]' --output 'text'
|
||||||
|
| xargs -I '%%' aws ecs describe-tasks --cluster '{{.CLUSTER}}' --tasks '%%' --query "tasks[].attachments[].details[?(@.name=='privateIPv4Address')].value" --output 'text'
|
||||||
58
taskfile/pulumi.yml
Normal file
58
taskfile/pulumi.yml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
tasks:
|
||||||
|
pulumi:install:
|
||||||
|
desc: install packages and plugins for the current pulumi program or policy pack
|
||||||
|
summary: |-
|
||||||
|
Install packages and plugins for the current Pulumi program or policy pack.
|
||||||
|
cmd: pulumi install
|
||||||
|
preconditions:
|
||||||
|
- test -r 'Pulumi.yaml'
|
||||||
|
pulumi:preview:
|
||||||
|
desc: show a preview of updates to a pulumi stack's resources
|
||||||
|
summary: |-
|
||||||
|
Show a preview of updates to a Pulumi stack's resources.
|
||||||
|
aliases:
|
||||||
|
- pulumi:pre
|
||||||
|
interactive: true
|
||||||
|
deps:
|
||||||
|
- pulumi:install
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
cmd: pulumi pre
|
||||||
|
pulumi:refresh:
|
||||||
|
deps:
|
||||||
|
- pulumi:install
|
||||||
|
desc: refresh the resources in a pulumi stack
|
||||||
|
summary: |-
|
||||||
|
Refresh the resources in a Pulumi stack.
|
||||||
|
interactive: true
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
cmd: pulumi refresh
|
||||||
|
pulumi:stack:init:
|
||||||
|
desc: create an empty pulumi stack with the given name
|
||||||
|
summary: |-
|
||||||
|
Create an empty Pulumi stack with the given name, ready for updates.
|
||||||
|
interactive: true
|
||||||
|
deps:
|
||||||
|
- pulumi:install
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
cmd: pulumi stack init dev
|
||||||
|
pulumi:up:
|
||||||
|
desc: create or update the resources in a pulumi stack
|
||||||
|
summary: |-
|
||||||
|
Create or update the resources in a Pulumi stack.
|
||||||
|
aliases:
|
||||||
|
- pulumi:update
|
||||||
|
interactive: true
|
||||||
|
deps:
|
||||||
|
- pulumi:install
|
||||||
|
requires:
|
||||||
|
vars:
|
||||||
|
- AWS_PROFILE
|
||||||
|
cmd: pulumi up
|
||||||
Reference in New Issue
Block a user