mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
build: Fix wrong windows bundle tar files path separator (#5478)
Fix #5473. Signed-off-by: shm12 <shm.bia@gmail.com>
This commit is contained in:
@@ -3,13 +3,31 @@ set -eo pipefail
|
||||
OPA_EXEC="$1"
|
||||
TARGET="$2"
|
||||
|
||||
opa() {
|
||||
github_actions_group() {
|
||||
local args="$*"
|
||||
echo "::group::$args"
|
||||
$OPA_EXEC $args
|
||||
$args
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
opa() {
|
||||
local args="$*"
|
||||
github_actions_group $OPA_EXEC $args
|
||||
}
|
||||
|
||||
# assert_contains checks if the actual string contains the expected string.
|
||||
assert_contains() {
|
||||
local expected="$1"
|
||||
local actual="$2"
|
||||
if [[ "$actual" != *"$expected"* ]]; then
|
||||
echo "Expected '$expected' but got '$actual'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
opa version
|
||||
opa eval -t $TARGET 'time.now_ns()'
|
||||
opa eval --format pretty --bundle test/cli/smoke/golden-bundle.tar.gz --input test/cli/smoke/input.json data.test.result --fail
|
||||
@@ -20,3 +38,7 @@ opa build --optimize 1 --output o1.tar.gz test/cli/smoke/data.yaml test/cli/smok
|
||||
echo '{"yay": "bar"}' | opa eval --format pretty --bundle o1.tar.gz -I data.test.result --fail
|
||||
opa build --optimize 2 --output o2.tar.gz test/cli/smoke/data.yaml test/cli/smoke/test.rego
|
||||
echo '{"yay": "bar"}' | opa eval --format pretty --bundle o2.tar.gz -I data.test.result --fail
|
||||
|
||||
# Tar paths
|
||||
opa build --output o3.tar.gz test/cli/smoke
|
||||
github_actions_group assert_contains '/test/cli/smoke/test.rego' "$(tar -tf o3.tar.gz /test/cli/smoke/test.rego)"
|
||||
|
||||
+4
-2
@@ -12,6 +12,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -453,9 +454,10 @@ func (c *Compiler) initBundle() error {
|
||||
sort.Strings(modules)
|
||||
|
||||
for _, module := range modules {
|
||||
path := filepath.ToSlash(load.Files.Modules[module].Name)
|
||||
result.Modules = append(result.Modules, bundle.ModuleFile{
|
||||
URL: load.Files.Modules[module].Name,
|
||||
Path: load.Files.Modules[module].Name,
|
||||
URL: path,
|
||||
Path: path,
|
||||
Parsed: load.Files.Modules[module].Parsed,
|
||||
Raw: load.Files.Modules[module].Raw,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user