diff --git a/demos/entitlements/build.sh b/demos/entitlements/build.sh index b0b544b..41b221c 100644 --- a/demos/entitlements/build.sh +++ b/demos/entitlements/build.sh @@ -3,8 +3,13 @@ set -eu workspace=$(cd "$(dirname "$0")" && pwd -P) { cd "$workspace" || exit - files=$(ls -1 *.rego | grep -v _test.rego | xargs) - opa build -t wasm -e entitlements $files + files=() + for file in *.rego; do + if [[ $file != *_test.rego ]]; then + files+=("$file") + fi + done + opa build -t wasm -e entitlements "${files[@]}" tar -xf bundle.tar.gz "/policy.wasm" mv policy.wasm ../node-wasm/ rm bundle.tar.gz diff --git a/demos/entitlements/rules/purchaseManagement.yaml b/demos/entitlements/rules/purchaseManagement.yaml index d60e843..dd1b43f 100644 --- a/demos/entitlements/rules/purchaseManagement.yaml +++ b/demos/entitlements/rules/purchaseManagement.yaml @@ -2,4 +2,3 @@ purchaseManagment: product: money_available: min: 1 - \ No newline at end of file diff --git a/demos/entitlements/utils.rego b/demos/entitlements/utils.rego index b46ce4c..b568c14 100644 --- a/demos/entitlements/utils.rego +++ b/demos/entitlements/utils.rego @@ -1,4 +1,3 @@ package entitlements fullVersion(product) = concat(".", [product.version, product.sub_version]) - diff --git a/scripts/regoFmt.sh b/scripts/regoFmt.sh index eacb4f2..029a34e 100755 --- a/scripts/regoFmt.sh +++ b/scripts/regoFmt.sh @@ -6,5 +6,5 @@ workspace=$(cd "$(dirname "$0")" && pwd -P) cd "$workspace"/../ || exit echo "Rego Fmting" # shellcheck disable=SC2046 - docker run --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"${opa_version}" fmt -w $(find . -type f -name '*.rego' ! -path '*/node_modules/*' ! -path '*/.go-cache/*') + docker run --platform linux/amd64 --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"${opa_version}" fmt -w $(find . -type f -name '*.rego' ! -path '*/node_modules/*' ! -path '*/.go-cache/*') } diff --git a/scripts/regoLint.sh b/scripts/regoLint.sh index 3366b32..d74a03a 100755 --- a/scripts/regoLint.sh +++ b/scripts/regoLint.sh @@ -6,7 +6,7 @@ workspace=$(cd "$(dirname "$0")" && pwd -P) cd "$workspace"/../ || exit echo "Rego Linting" # shellcheck disable=SC2046 - unfmts=$(docker run --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"$opa_version" fmt -l $(find . -type f -name '*.rego' ! -path '*/node_modules/*' ! -path '*/.go-cache/*')) + unfmts=$(docker run --platform linux/amd64 --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"$opa_version" fmt -l $(find . -type f -name '*.rego' ! -path '*/node_modules/*' ! -path '*/.go-cache/*')) if [ "$unfmts" != "" ]; then echo "Found unforamt rego files:" echo "$unfmts" diff --git a/scripts/regoTest.sh b/scripts/regoTest.sh index 3964de1..2b4706c 100755 --- a/scripts/regoTest.sh +++ b/scripts/regoTest.sh @@ -5,5 +5,5 @@ workspace=$(cd "$(dirname "$0")" && pwd -P) opa_version="${1:-latest}" cd "$workspace"/../ || exit echo "Rego Testing" - docker run --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"$opa_version" test -c --threshold 100 quick-start + docker run --platform linux/amd64 --rm -v "$(pwd)":/code -w /code openpolicyagent/opa:"$opa_version" test -c --threshold 100 quick-start } diff --git a/scripts/yamlLint.sh b/scripts/yamlLint.sh index 473bb0d..697ac2b 100755 --- a/scripts/yamlLint.sh +++ b/scripts/yamlLint.sh @@ -5,5 +5,5 @@ workspace=$(cd "$(dirname "$0")" && pwd -P) cd "$workspace"/../ || exit echo "Yaml Linting" # shellcheck disable=SC2046 - docker run --rm -v "$(pwd)":/workdir giantswarm/yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" $(find . -type f \( -name '*.yaml' -or -name '*.yml' \) ! -path '*/.github/*' ! -path '*/.go-cache/*') + docker run --platform linux/amd64 --rm -v "$(pwd)":/workdir giantswarm/yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" $(find . -type f \( -name '*.yaml' -or -name '*.yml' \) ! -path '*/.github/*' ! -path '*/.go-cache/*') }