Skip to content

Commit

Permalink
chore: Update OPA jll dependency
Browse files Browse the repository at this point in the history
Update OPA jll dependency to 0.61.
Minor change (new option) to the CLI because of that.
  • Loading branch information
tanmaykm committed Jan 29, 2024
1 parent ea327ed commit 2237083
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OpenPolicyAgent"
uuid = "8f257efb-743c-4ebc-8197-d291a1f743b4"
authors = ["JuliaHub Inc.", "Tanmay Mohapatra <[email protected]>"]
version = "0.2.0"
version = "0.3.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions specs/cli/opa.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
4 changes: 3 additions & 1 deletion src/cli/cli.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 2237083

Please sign in to comment.