Skip to content

Commit

Permalink
chore(ci): allow callers to use an empty sudo (when sudo is not avail…
Browse files Browse the repository at this point in the history
…able).

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP committed Feb 15, 2024
1 parent bdf5a57 commit e92b433
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ jobs:
test-falcoctl: 'true'
test-k8saudit: 'true'
show-all: 'true'
sudo: ''
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ To better suit the CI usage, a [Github composite action](https://docs.github.com
# Whether to upload all tests in action-summary.
# Default: 'false'.
show-all: 'true'
# Specify a sudo command. Put it empty when sudo is not available.
# Default: 'sudo'
sudo: 'sudo'
```


Expand Down
16 changes: 10 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
description: 'Whether to upload all tests summary, not just failed.'
required: false
default: 'false'
sudo:
description: 'Specify a sudo command. Put it empty when sudo is not available.'
required: false
default: 'sudo'

outputs:
report:
Expand Down Expand Up @@ -58,16 +62,16 @@ runs:
if: ${{ inputs.static == 'false' }}
shell: bash
run: |
sudo mkdir -p /usr/share/falco/plugins
sudo falcoctl artifact install k8saudit-rules
sudo falcoctl artifact install cloudtrail-rules
${{ inputs.sudo }} mkdir -p /usr/share/falco/plugins
${{ inputs.sudo }} falcoctl artifact install k8saudit-rules
${{ inputs.sudo }} falcoctl artifact install cloudtrail-rules
- name: Install dependencies for falco-driver-loader tests
if: ${{ inputs.arch == 'x86_64' }}
shell: bash
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential clang make llvm gcc dkms linux-headers-$(uname -r)
${{ inputs.sudo }} apt update -y
${{ inputs.sudo }} apt install -y --no-install-recommends build-essential clang make llvm gcc dkms linux-headers-$(uname -r)
- name: Install dependencies for falco-driver-loader tests
if: ${{ inputs.arch == 'aarch64' }}
Expand All @@ -91,7 +95,7 @@ runs:
./build/k8saudit.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
fi
if ${{ inputs.test-drivers && 'true' || 'false' }}; then
sudo ./build/falco-driver-loader.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
${{ inputs.sudo }} ./build/falco-driver-loader.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
fi
fi
cat ./report.txt | go-junit-report -set-exit-code > report.xml
Expand Down

0 comments on commit e92b433

Please sign in to comment.