From 22370834af11e0faf644204a0abe120030425cd0 Mon Sep 17 00:00:00 2001 From: tan Date: Mon, 29 Jan 2024 10:30:49 +0530 Subject: [PATCH] chore: Update OPA jll dependency Update OPA jll dependency to 0.61. Minor change (new option) to the CLI because of that. --- Project.toml | 4 ++-- specs/cli/opa.json | 5 +++++ src/cli/cli.jl | 4 +++- test/runtests.jl | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 16337ec..3efd5e9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OpenPolicyAgent" uuid = "8f257efb-743c-4ebc-8197-d291a1f743b4" authors = ["JuliaHub Inc.", "Tanmay Mohapatra "] -version = "0.2.0" +version = "0.3.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" @@ -14,7 +14,7 @@ Dates = "1.6" OpenAPI = "0.1" TimeZones = "1" julia = "1.6" -OpenPolicyAgent_jll = "0.55" +OpenPolicyAgent_jll = "0.61" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/specs/cli/opa.json b/specs/cli/opa.json index 4d760a6..7fc6cc0 100644 --- a/specs/cli/opa.json +++ b/specs/cli/opa.json @@ -1277,6 +1277,11 @@ "name": "tls-private-key-file" } }, + { + "name": "--v1-compatible", + "description": "Opt-in to OPA features and behaviors that will be enabled by default in a future OPA v1.0 release", + "displayName": "v1-compatible" + }, { "name": "--verification-key", "description": "Set the secret (HMAC) or path of the PEM file containing the public key (RSA and ECDSA)", diff --git a/src/cli/cli.jl b/src/cli/cli.jl index 398b086..c315e46 100644 --- a/src/cli/cli.jl +++ b/src/cli/cli.jl @@ -416,12 +416,13 @@ Options: - tls_cert_file::AbstractString - Set path of TLS certificate file - tls_cert_refresh_period::AbstractString - Set certificate refresh period - tls_private_key_file::AbstractString - Set path of TLS private key file +- v1_compatible::Bool - Opt-in to OPA features and behaviors that will be enabled by default in a future OPA v1.0 release - verification_key::AbstractString - Set the secret (HMAC) or path of the PEM file containing the public key (RSA and ECDSA) - verification_key_id::AbstractString - Name assigned to the verification key used for bundle verification - watch::Bool - Watch command line files for changes - help::Bool - Help for run """ -function run(ctx::CommandLine, _args...; addr::Union{Nothing,AbstractString} = "[:8181]", authentication::Union{Nothing,AbstractString} = "off", authorization::Union{Nothing,AbstractString} = "off", bundle::Union{Nothing,Bool} = false, config_file::Union{Nothing,AbstractString} = nothing, diagnostic_addr::Union{Nothing,AbstractString} = nothing, exclude_files_verify::Union{Nothing,AbstractString} = nothing, format::Union{Nothing,AbstractString} = "pretty", h2c::Union{Nothing,Bool} = false, history::Union{Nothing,AbstractString} = nothing, ignore::Union{Nothing,AbstractString} = nothing, log_format::Union{Nothing,AbstractString} = "json", log_level::Union{Nothing,AbstractString} = "info", max_errors::Union{Nothing,AbstractString} = "10", min_tls_version::Union{Nothing,AbstractString} = "1.2", pprof::Union{Nothing,Bool} = false, ready_timeout::Union{Nothing,AbstractString} = "0", scope::Union{Nothing,AbstractString} = nothing, server::Union{Nothing,Bool} = false, set::Union{Nothing,AbstractString} = nothing, set_file::Union{Nothing,AbstractString} = nothing, shutdown_grace_period::Union{Nothing,AbstractString} = "10", shutdown_wait_period::Union{Nothing,AbstractString} = "0", signing_alg::Union{Nothing,AbstractString} = "RS256", skip_verify::Union{Nothing,Bool} = false, skip_version_check::Union{Nothing,Bool} = false, tls_ca_cert_file::Union{Nothing,AbstractString} = nothing, tls_cert_file::Union{Nothing,AbstractString} = nothing, tls_cert_refresh_period::Union{Nothing,AbstractString} = "0s", tls_private_key_file::Union{Nothing,AbstractString} = nothing, verification_key::Union{Nothing,AbstractString} = nothing, verification_key_id::Union{Nothing,AbstractString} = "default", watch::Union{Nothing,Bool} = false, help::Union{Nothing,Bool} = false, ) +function run(ctx::CommandLine, _args...; addr::Union{Nothing,AbstractString} = "[:8181]", authentication::Union{Nothing,AbstractString} = "off", authorization::Union{Nothing,AbstractString} = "off", bundle::Union{Nothing,Bool} = false, config_file::Union{Nothing,AbstractString} = nothing, diagnostic_addr::Union{Nothing,AbstractString} = nothing, exclude_files_verify::Union{Nothing,AbstractString} = nothing, format::Union{Nothing,AbstractString} = "pretty", h2c::Union{Nothing,Bool} = false, history::Union{Nothing,AbstractString} = nothing, ignore::Union{Nothing,AbstractString} = nothing, log_format::Union{Nothing,AbstractString} = "json", log_level::Union{Nothing,AbstractString} = "info", max_errors::Union{Nothing,AbstractString} = "10", min_tls_version::Union{Nothing,AbstractString} = "1.2", pprof::Union{Nothing,Bool} = false, ready_timeout::Union{Nothing,AbstractString} = "0", scope::Union{Nothing,AbstractString} = nothing, server::Union{Nothing,Bool} = false, set::Union{Nothing,AbstractString} = nothing, set_file::Union{Nothing,AbstractString} = nothing, shutdown_grace_period::Union{Nothing,AbstractString} = "10", shutdown_wait_period::Union{Nothing,AbstractString} = "0", signing_alg::Union{Nothing,AbstractString} = "RS256", skip_verify::Union{Nothing,Bool} = false, skip_version_check::Union{Nothing,Bool} = false, tls_ca_cert_file::Union{Nothing,AbstractString} = nothing, tls_cert_file::Union{Nothing,AbstractString} = nothing, tls_cert_refresh_period::Union{Nothing,AbstractString} = "0s", tls_private_key_file::Union{Nothing,AbstractString} = nothing, v1_compatible::Union{Nothing,Bool} = false, verification_key::Union{Nothing,AbstractString} = nothing, verification_key_id::Union{Nothing,AbstractString} = "default", watch::Union{Nothing,Bool} = false, help::Union{Nothing,Bool} = false, ) ctx.exec() do cmdstr cmd = [cmdstr, "run"] Base.isnothing(addr) || Base.push!(cmd, "--addr=$(addr)") @@ -454,6 +455,7 @@ function run(ctx::CommandLine, _args...; addr::Union{Nothing,AbstractString} = " Base.isnothing(tls_cert_file) || Base.push!(cmd, "--tls-cert-file=$(tls_cert_file)") Base.isnothing(tls_cert_refresh_period) || Base.push!(cmd, "--tls-cert-refresh-period=$(tls_cert_refresh_period)") Base.isnothing(tls_private_key_file) || Base.push!(cmd, "--tls-private-key-file=$(tls_private_key_file)") + !Base.isnothing(v1_compatible) && v1_compatible && Base.push!(cmd, "--v1-compatible") Base.isnothing(verification_key) || Base.push!(cmd, "--verification-key=$(verification_key)") Base.isnothing(verification_key_id) || Base.push!(cmd, "--verification-key-id=$(verification_key_id)") !Base.isnothing(watch) && watch && Base.push!(cmd, "--watch") diff --git a/test/runtests.jl b/test/runtests.jl index 7e6435a..35f7abe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -20,6 +20,9 @@ function test_version_help() pipelineopts = Dict(:stdout => iob_stdout, :stderr => iob_stderr) cmd = OpenPolicyAgent.CLI.CommandLine(; pipelineopts=pipelineopts) CLI.version(cmd) + if Sys.iswindows() + sleep(10) # Windows is slow to flush the buffers + end output = string(String(take!(iob_stdout)), String(take!(iob_stderr))) @test occursin(r"Version: \d+\.\d+\.\d+", output) @@ -28,6 +31,9 @@ function test_version_help() pipelineopts = Dict(:stdout => iob_stdout, :stderr => iob_stderr) cmd = OpenPolicyAgent.CLI.CommandLine(; pipelineopts=pipelineopts) CLI.help(cmd) + if Sys.iswindows() + sleep(10) # Windows is slow to flush the buffers + end output = string(String(take!(iob_stdout)), String(take!(iob_stderr))) if Sys.iswindows() @test occursin(r"Usage:\s+.*opa.exe \[command\]", output)