Skip to content

Commit

Permalink
Release .tar.gz bundler functions
Browse files Browse the repository at this point in the history
Fix #5430
  • Loading branch information
eleftherias committed Feb 14, 2025
1 parent 56b0bf9 commit 807f52c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
17 changes: 8 additions & 9 deletions docs/docs/how-to/writing-rules-in-rego.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ following custom functions:
object, returning `true` if the query result is a true boolean value, andh
`false` otherwise.

- **file.archive(paths)**: _(experimental)_ Builds a `.tar.gz` format archive
containing all files under the given paths. Returns the archive contents as a
(binary) string.

_(experimental)_ In addition, when operating in a pull request context,
`base_file` versions of the `file` operations are available for accessing the
files in the base branch of the pull request. The `file` versions of the
operations operate on the head (proposed changes) versions of the files in a
pull request context.
- **file.archive(paths)**: Builds a `.tar.gz` format archive containing all
files under the given paths. Returns the archive contents as a (binary)
string.

In addition, when operating in a pull request context, `base_file` versions of
the `file` operations are available for accessing the files in the base branch
of the pull request. The `file` versions of the operations operate on the head
(proposed changes) versions of the files in a pull request context.

In addition, most of the
[standard OPA functions are available in the Minder runtime](https://www.openpolicyagent.org/docs/latest/policy-reference/#built-in-functions).
Expand Down
3 changes: 2 additions & 1 deletion internal/engine/eval/rego/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var MinderRegoLib = []func(res *interfaces.Result) func(*rego.Rego){
FileHTTPType,
FileRead,
FileWalk,
FileArchive,
BaseFileArchive,
ListGithubActions,
ParseYaml,
ParseToml,
Expand All @@ -54,7 +56,6 @@ var MinderRegoLib = []func(res *interfaces.Result) func(*rego.Rego){
// MinderRegoLibExperiments contains Minder-specific functions which
// should only be exposed when the given experiment is enabled.
var MinderRegoLibExperiments = map[flags.Experiment][]func(res *interfaces.Result) func(*rego.Rego){
flags.TarGzFunctions: {FileArchive, BaseFileArchive},
flags.GitPRDiffs: {
BaseFileExists,
BaseFileLs,
Expand Down
3 changes: 0 additions & 3 deletions internal/flags/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ const (
DataSources Experiment = "data_sources"
// GitPRDiffs enables the git ingester for pull requests.
GitPRDiffs Experiment = "git_pr_diffs"
// TarGzFunctions enables functions to produce tar.gz data in the rego
// evaluation environment.
TarGzFunctions Experiment = "tar_gz_functions"
// DependencyExtract enables functions to perform dependency extraction.
DependencyExtract Experiment = "dependency_extract"
)

0 comments on commit 807f52c

Please sign in to comment.