-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (54 loc) · 1.88 KB
/
packer.yaml
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
name: Packer build
# prevent mutliple concurrent workflow executions to avoid hcloud resources interfering with each other
concurrency: hcloud
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build and save Docker image
run: |
docker build -t ghcr.io/enowars/bambictf:latest .
docker save --output /tmp/bambictf.tar ghcr.io/enowars/bambictf:latest
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: bambictf
path: /tmp/bambictf.tar
packer-build:
strategy:
# fail-fast needs to be disabled, otherwise packer processes may be ungracefully killed and leave stale builder VMs
fail-fast: false
matrix:
image: ["bambichecker", "bambielk", "bambiengine", "bambirouter", "bambivulnbox"]
runs-on: ubuntu-latest
needs: docker-build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: bambictf
path: /tmp
- name: Load Docker image
run: docker load --input /tmp/bambictf.tar
- name: start docker-compose setup
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
run: docker-compose up -d
- name: prepare ansible config
run: docker-compose exec -T bambictf sh -c 'cp ansible/config_bambi.yml.sample ansible/config_bambi.yml'
- name: generate config files
run: docker-compose exec -T bambictf sh -c 'cd configgen; poetry install; poetry run configgen --teams 4 --routers 2 --dns bambi.ovh'
- name: build packer image
run: docker-compose exec -T bambictf sh -c 'cd packer; packer build ${{ matrix.image }}.json'