-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaction.yml
91 lines (80 loc) · 3.01 KB
/
action.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
name: 'kernel-testing'
description: 'Ansible playbooks to provision firecracker VMs and run Falco kernel tests.'
inputs:
libsversion:
description: 'libs version to be tested, eg: master'
required: false
default: 'master'
libsrepo:
description: 'libs repo to be tested, eg: falcosecurity/libs'
required: false
default: 'falcosecurity/libs'
build_matrix:
description: 'Whether to generate matrixes as matrix artifact'
required: false
default: 'false'
outputs:
ansible_output:
description: "Uploaded ansible output artifact name"
value: ${{ steps.store-outputs.outputs.ansible }}
matrix_output:
description: "Uploaded matrix artifact name"
value: ${{ steps.store-outputs.outputs.matrix }}
runs:
using: "composite"
steps:
- name: Generate vars yaml
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: |
cat > vars.yml <<EOF
run_id: "id-${{ github.run_id }}"
output_dir: "~/ansible_output_${{ github.run_id }}"
tag: "$ACTION_REF"
repos:
libs: {name: "falcosecurity-libs", repo: "https://github.com/${{ inputs.libsrepo }}.git", version: "${{ inputs.libsversion }}"}
EOF
env:
ACTION_REF: ${{ github.action_ref }}
- name: Bootstrap VMs
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: ansible-playbook bootstrap.yml --extra-vars "@vars.yml"
- name: Common setup
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: ansible-playbook common.yml --extra-vars "@vars.yml"
- name: Prepare github repos
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: ansible-playbook git-repos.yml --extra-vars "@vars.yml"
- name: Run scap-open tests
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: |
ansible-playbook scap-open.yml --extra-vars "@vars.yml" || :
- name: Tar output files
shell: bash
run: tar -cvf $GITHUB_ACTION_PATH/ansible_output.tar ~/ansible_output_${{ github.run_id }}
- name: Build matrix_gen and generate matrix
if: inputs.build_matrix == 'true'
working-directory: ${{ github.action_path }}/matrix_gen
env:
GOPATH: /root/go
GOCACHE: /root/.cache/go-build
shell: bash
run: |
go build .
./matrix_gen --root-folder ~/ansible_output_${{ github.run_id }} --output-file matrix.md
- name: Set output
id: store-outputs
shell: bash
run: |
echo "ansible=${{ github.action_path }}/ansible_output.tar" >> $GITHUB_OUTPUT
echo "matrix=${{ github.action_path }}/matrix_gen/matrix.md" >> $GITHUB_OUTPUT
- name: Cleanup
if: always()
working-directory: ${{ github.action_path }}/ansible-playbooks
shell: bash
run: |
ansible-playbook clean-up.yml --extra-vars "@vars.yml" || :