-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detailed run control with entrypoint script (#1)
- Loading branch information
1 parent
0d338bc
commit 297920d
Showing
3 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM ubuntu:18.04 | ||
RUN apt-get update && apt-get install -y curl | ||
RUN curl -L -o /opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 | ||
RUN chmod 755 /opa | ||
RUN /opa version | ||
COPY entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
name: OPA Test | ||
description: Run Open Policy Agent tests | ||
author: Petro Protsakh | ||
name: "OPA Test" | ||
description: "Run Open Policy Agent tests" | ||
author: "Petro Protsakh" | ||
branding: | ||
icon: check-square | ||
color: green | ||
inputs: | ||
tests: | ||
description: Rego file or directory path where to discover tests. Defaults to repository root. | ||
description: "Rego file or directory path where to discover tests. Defaults to repository root." | ||
required: false | ||
default: ./ | ||
options: | ||
description: "Additional OPA command line flags. Example: `--verbose --timeout 3`. See `opa test --help` for more." | ||
required: false | ||
runs: | ||
using: docker | ||
image: docker://openpolicyagent/opa:latest | ||
args: | ||
- test | ||
- ${{ inputs.tests }} | ||
- -v | ||
image: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
printf "\n\n" | ||
echo "# Open Policy Agent" | ||
/opa version | ||
printf "\n\n" | ||
|
||
IFS=';' | ||
mapfile -t lines < <(echo "$INPUT_TESTS" | grep -v "^$") | ||
|
||
e_code=0 | ||
for line in "${lines[@]}"; do | ||
read -r -a args <<< "$line" | ||
cmd="/opa test ${args[*]} $INPUT_OPTIONS" | ||
echo " 🚀 Running: $cmd" | ||
printf "\n" | ||
eval "$cmd" || e_code=1 | ||
printf "\n\n" | ||
done | ||
|
||
exit $e_code |