-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (87 loc) · 3.43 KB
/
check_dcs.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
name: Check dcs
on:
push:
branches:
- master
paths:
- 'services/dcs/**'
- 'checkers/dcs/**'
- 'sploits/dcs/**'
workflow_dispatch:
inputs:
cleanup_before_deploy:
description: 'Stops and fully removes service (with volumes!) before deploying again. Type "yes" to do it.'
required: false
default: "no"
jobs:
check_service_dcs:
name: Check service dcs
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Run prebuilt hook
run: if [ -f services/dcs/before_image_build.sh ]; then (cd ./services/dcs && ./before_image_build.sh); fi
- name: Setup dcs
run: (cd ./services/dcs && docker-compose pull && docker-compose build && docker-compose up --build -d)
check_checker_dcs:
name: Check checker dcs
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Run prebuilt hook
run: if [ -f services/dcs/before_image_build.sh ]; then (cd ./services/dcs && ./before_image_build.sh); fi
- name: Setup dcs
run: (cd ./services/dcs && docker-compose pull && docker-compose build && docker-compose up --build -d)
- name: Sleep some time. Wait service ready
run: sleep 30
- name: Prepare python for checker
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Setup checker libraries
run: if [ -f checkers/dcs/requirements.txt ]; then python -m pip install -r checkers/dcs/requirements.txt; fi
- name: Test checker on service
run: (cd ./checkers/dcs && ./dcs.checker.py TEST 127.0.0.1)
check_sploit_dcs:
name: Check sploit dcs
runs-on: ubuntu-20.04
if: ${{ true }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Run prebuilt hook
run: if [ -f services/dcs/before_image_build.sh ]; then (cd ./services/dcs && ./before_image_build.sh); fi
- name: Setup dcs
run: (cd ./services/dcs && docker-compose pull && docker-compose build && docker-compose up --build -d)
- name: Sleep some time. Wait service ready
run: sleep 30
- name: Prepare python for checker
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Setup checker libraries
run: if [ -f checkers/dcs/requirements.txt ]; then python -m pip install -r checkers/dcs/requirements.txt; fi
- name: Setup sploit libraries
run: if [ -f sploits/dcs/requirements.txt ]; then python -m pip install -r sploits/dcs/requirements.txt; fi
- name: Test sploit on service
run: (./tools/check-sploit.py dcs)
update_dcs:
name: Deploy service using ansible to first teams
needs: [check_service_dcs, check_checker_dcs, check_sploit_dcs]
runs-on: self-hosted
if: ${{ false }} # disable on game just in case
steps:
#- name: install ansible
# run: sudo apt-get install -y ansible
- name: Checkout repo
uses: actions/checkout@v2
- name: change permission for ssh key
run: chmod 0600 ./teams/for_devs.ssh_key
- name: Run prebuilt hook
run: if [ -f services/dcs/before_image_build.sh ]; then (cd ./services/dcs && sudo ./before_image_build.sh); fi
- name: update checkers
run: cd ./ansible && ansible-playbook cs-checkers.yml
- name: deploy dcs
run: cd ./ansible && ansible-playbook --extra-vars cleanup_service=${{ github.event.inputs.cleanup_before_deploy }} -t dcs -l dcs deploy-services.yml