Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: added a composite action. #74

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Falco kernel tests Repository](https://github.com/falcosecurity/evolution/blob/main/repos/badges/falco-infra-blue.svg)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#infra-scope)
[![Incubating](https://img.shields.io/badge/status-incubating-orange?style=for-the-badge)](https://github.com/falcosecurity/evolution/blob/main/REPOSITORIES.md#incubating)
![Architectures](https://img.shields.io/badge/ARCHS-x86__64%7Caarch64-blueviolet?style=for-the-badge)

[![Latest release](https://img.shields.io/github/v/release/falcosecurity/kernel-testing?style=for-the-badge)](https://github.com/falcosecurity/kernel-testing/releases/latest)

# Falco drivers tests

Expand Down
98 changes: 98 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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_$architecture artifact'
required: false
default: 'false'

outputs:
ansible_output:
description: "Uploaded ansible output artifact name"
value: ${{ steps.upload.outputs.ansible }}
matrix_output:
description: "Uploaded matrix artifact name"
value: ${{ steps.upload.outputs.matrix }}

runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: falcosecurity/kernel-testing
ref: ${{ env.ACTION_REF }}
env:
ACTION_REF: ${{ github.action_ref }}

- name: Store architecture variable
id: var
run: echo "architecture=$(uname -m)" >> $GITHUB_OUTPUT

- name: Generate vars yaml
working-directory: ./ansible-playbooks
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: ./ansible-playbooks
run: |
ansible-playbook bootstrap.yml --extra-vars "@vars.yml"

- name: Common setup
working-directory: ./ansible-playbooks
run: |
ansible-playbook common.yml --extra-vars "@vars.yml"

- name: Prepare github repos
working-directory: ./ansible-playbooks
run: |
ansible-playbook git-repos.yml --extra-vars "@vars.yml"

- name: Run scap-open tests
working-directory: ./ansible-playbooks
run: |
ansible-playbook scap-open.yml --extra-vars "@vars.yml" || :

- name: Tar output files
run: |
tar -cvf ansible_output.tar ~/ansible_output_${{ github.run_id }}

- name: Build matrix_gen and generate matrix
if: inputs.build_matrix == 'true'
working-directory: ./matrix_gen
env:
GOPATH: /root/go
GOCACHE: /root/.cache/go-build
run: |
go build .
./matrix_gen --root-folder ~/ansible_output_${{ github.run_id }} --output-file matrix.md

- name: Set output
id: outputs
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: ./ansible-playbooks
run: |
ansible-playbook clean-up.yml --extra-vars "@vars.yml" || :
Loading