-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTaskfile.yml
114 lines (92 loc) · 3.4 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
version: '3'
tasks:
test:
deps: [test-unit, test-int]
test-unit:
cmds:
- dotnet test --filter "FullyQualifiedName~test.unit"
test-int:
deps: [build-exec-short-image, build-exec-long-image, build-proc-image]
cmds:
- |
. ./bin/setenv.sh
dotnet test --filter "FullyQualifiedName~test.int"
docker-compose -f test/pwnctl.core.test.int/docker-compose.ecs-local.yml down
build-api:
cmds:
- dotnet clean src/pwnctl.api/pwnctl.api.csproj
- dotnet build src/pwnctl.api/pwnctl.api.csproj -c Release
build-cli:
cmds:
- dotnet publish src/pwnctl.cli/pwnctl.cli.csproj -c Release
build-exec-short-image:
cmds:
- |
ecrUri=$(aws ecr describe-repositories | jq -r '.repositories[] | select( .repositoryName == "pwnctl-exec-short") | .repositoryUri')
docker build --ssh default=$SSH_AUTH_SOCK src/core/ -f src/core/pwnctl.exec/shortlived/Dockerfile -t ${ecrUri}:latest
build-exec-long-image:
cmds:
- |
ecrUri=$(aws ecr describe-repositories | jq -r '.repositories[] | select( .repositoryName == "pwnctl-exec-long") | .repositoryUri')
docker build --ssh default=$SSH_AUTH_SOCK src/core/ -f src/core/pwnctl.exec/longlived/Dockerfile -t ${ecrUri}:latest
build-proc-image:
cmds:
- |
ecrUri=$(aws ecr describe-repositories | jq -r '.repositories[] | select( .repositoryName == "pwnctl-proc") | .repositoryUri')
docker build src/core/ -f src/core/pwnctl.proc/Dockerfile -t ${ecrUri}:latest
build-all:
deps: [build-cli, build-api, build-exec-short-image, build-exec-long-image, build-proc-image]
install-cli:
deps: [build-cli]
cmds:
- chmod +x src/pwnctl.cli/bin/Release/net7.0/linux-x64/publish/pwnctl.cli
- mv src/pwnctl.cli/bin/Release/net7.0/linux-x64/publish/pwnctl.cli ~/.local/bin/pwnctl
- mkdir -p ~/.config/pwnctl/
- chown `whoami` ~/.config/pwnctl/
- mv src/pwnctl.cli/bin/Release/net7.0/linux-x64/publish/config.ini ~/.config/pwnctl/
setup-ci:
cmds:
#- ./bin/setup-gha-secrets.sh
- terraform -chdir=infra/modules/ci apply -auto-approve
deploy:
deps: [build-api, setup-ci]
cmds:
- ./bin/deploy.sh
deploy2vps:
deps: [build-api, setup-ci]
cmds:
- ./bin/deploy_vps.sh
destroy:
cmds:
- ./bin/teardown.sh
destroy-ci:
cmds:
- terraform -chdir=infra/modules/ci destroy
debug:
deps: [build-exec-short-image, build-exec-long-image, build-proc-image]
cmds:
- |
. ./bin/setenv.sh
docker-compose -f test/pwnctl.core.test.int/docker-compose.ecs-local.yml up
get-exec-logs:
cmds:
- awslogs get -s 1440m -G --timestamp /aws/ecs/exec
get-proc-logs:
cmds:
- awslogs get -s 1440m -G --timestamp /aws/ecs/proc
get-api-logs:
cmds:
- |
functionName=$(aws lambda list-functions | jq -r '.Functions[] | select( .FunctionName | startswith("pwnctl_api") ) | .FunctionName')
awslogs get -s 1440m -G --timestamp /aws/lambda/$functionName
clean:
cmds:
- find {src,test} -type d -name bin -exec rm -rf {} +
- find {src,test} -type d -name obj -exec rm -rf {} +
deploy-jumpbox:
cmds:
- terraform -chdir=infra/modules/jumpbox init
- terraform -chdir=infra/modules/jumpbox apply -auto-approve
destroy-jumpbox:
cmds:
- terraform -chdir=infra/modules/jumpbox destroy -auto-approve