From 2cd9f364a715942515561f640913a7f16ab5bf58 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 12:37:25 -0700 Subject: [PATCH 01/14] feat: introduce configurable timeouts for all git and system execution commands --- README.md | 2 ++ gitops/exec/exec.go | 30 +++++++++++++++++++ gitops/git/git.go | 68 +++++++++++++++++++++++++----------------- gitops/git/git_test.go | 49 ++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 78652577..fe8eae1e 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,8 @@ The `--release_branch` specifies the value of the ***release_branch_prefix*** at To handle potential race conditions (e.g., if a deployment branch is merged and deleted on the remote server while the tool is running), the `--push_retry_max` flag can be set (defaults to `2`). It will retry cloning/checking out the repository, manifest rendering, committing, and pushing up to the configured limit if the git push fails because of a mismatch (e.g. branch deleted or updated on remote). +The `--git_timeout` flag can be used to configure a timeout for Git operations (defaults to `5m`). If any Git operation (like clone, checkout, fetch, commit, or push) exceeds this duration, the execution will fail immediately. + The `create_gitops_prs` tool will query all `gitops` targets which have set the ***deploy_branch*** attribute (see [k8s_deploy](#k8s_deploy)) and the ***release_branch_prefix*** attribute value that matches the `release_branch` parameter. In case you need to specify a custom Bazel flag during the pull request process, you can add one `--bazel_flag` such as `--bazel_flag --config=ci` or multiple such as `--bazel_flag --config=ci --bazel_flag --color=no`. diff --git a/gitops/exec/exec.go b/gitops/exec/exec.go index 3be02e50..087589b7 100644 --- a/gitops/exec/exec.go +++ b/gitops/exec/exec.go @@ -12,9 +12,11 @@ governing permissions and limitations under the License. package exec import ( + "context" "log" "os/exec" "strings" + "time" ) // Ex is a shortcut for executing the command in specified dir @@ -29,6 +31,25 @@ func Ex(dir, name string, arg ...string) (output string, err error) { return string(b), err } +// ExWithTimeout executes a command in a specified directory with a given timeout. +func ExWithTimeout(timeout time.Duration, dir, name string, arg ...string) (output string, err error) { + log.Println("executing:", name, strings.Join(arg, " ")) + var cmd *exec.Cmd + if timeout > 0 { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + cmd = exec.CommandContext(ctx, name, arg...) + } else { + cmd = exec.Command(name, arg...) + } + if dir != "" { + cmd.Dir = dir + } + b, err := cmd.CombinedOutput() + log.Printf("%s", string(b)) + return string(b), err +} + // Mustex executes the command name arg... in directory dir // it will exit with fatal error if execution was not successful func Mustex(dir, name string, arg ...string) string { @@ -37,5 +58,14 @@ func Mustex(dir, name string, arg ...string) string { log.Fatalf("ERROR: %s", err) } return ret +} +// MustexWithTimeout executes the command name arg... in directory dir with a timeout. +// it will exit with fatal error if execution was not successful. +func MustexWithTimeout(timeout time.Duration, dir, name string, arg ...string) string { + ret, err := ExWithTimeout(timeout, dir, name, arg...) + if err != nil { + log.Fatalf("ERROR: %s", err) + } + return ret } diff --git a/gitops/git/git.go b/gitops/git/git.go index dae4b9c3..c29b6c3b 100644 --- a/gitops/git/git.go +++ b/gitops/git/git.go @@ -13,16 +13,21 @@ package git import ( "bufio" + "context" + "flag" "fmt" "log" "os" oe "os/exec" "path/filepath" "strings" + "time" "github.com/fasterci/rules_gitops/gitops/exec" ) +var Timeout = flag.Duration("git_timeout", 5*time.Minute, "Timeout for git operations") + // Clone clones a repository. Pass the full repository name, such as // "https://aleksey.pesternikov@bitbucket.tubemogul.info/scm/tm/repo.git" as the repo. // Cloned directory will be clean of local changes with primaryBranch branch checked out. @@ -39,16 +44,16 @@ func Clone(repo, dir, mirrorDir, primaryBranch, gitopsPath string) (*Repo, error args = append(args, "--reference", mirrorDir) } args = append(args, repo, dir) - exec.Mustex("", "git", args...) + exec.MustexWithTimeout(*Timeout, "", "git", args...) // Enable sparse-checkout when restricting to a subdir if !isRootPath(gitopsPath) { - exec.Mustex(dir, "git", "config", "--local", "core.sparsecheckout", "true") + exec.MustexWithTimeout(*Timeout, dir, "git", "config", "--local", "core.sparsecheckout", "true") genPath := fmt.Sprintf("%s/\n", gitopsPath) if err := os.WriteFile(filepath.Join(dir, ".git/info/sparse-checkout"), []byte(genPath), 0644); err != nil { return nil, fmt.Errorf("unable to create .git/info/sparse-checkout: %w", err) } } - exec.Mustex(dir, "git", "checkout", primaryBranch) + exec.MustexWithTimeout(*Timeout, dir, "git", "checkout", primaryBranch) return &Repo{ Dir: dir, @@ -69,10 +74,10 @@ func CloneOrCheckout(repo, dir, mirrorDir, primaryBranch, gitopsPath, branchPref args = append(args, "--reference", mirrorDir) } args = append(args, repo, dir) - exec.Mustex("", "git", args...) + exec.MustexWithTimeout(*Timeout, "", "git", args...) // Enable sparse-checkout when restricting to a subdir if !isRootPath(gitopsPath) { - exec.Mustex(dir, "git", "config", "--local", "core.sparsecheckout", "true") + exec.MustexWithTimeout(*Timeout, dir, "git", "config", "--local", "core.sparsecheckout", "true") genPath := fmt.Sprintf("%s/\n", gitopsPath) if err := os.WriteFile(filepath.Join(dir, ".git/info/sparse-checkout"), []byte(genPath), 0644); err != nil { return nil, fmt.Errorf("unable to create .git/info/sparse-checkout: %w", err) @@ -80,13 +85,13 @@ func CloneOrCheckout(repo, dir, mirrorDir, primaryBranch, gitopsPath, branchPref } } else { //existing repo - exec.Mustex(dir, "git", "remote", "set-url", "origin", repo) - exec.Mustex(dir, "git", "reset", "--hard") + exec.MustexWithTimeout(*Timeout, dir, "git", "remote", "set-url", "origin", repo) + exec.MustexWithTimeout(*Timeout, dir, "git", "reset", "--hard") } - exec.Mustex(dir, "git", "checkout", "-f", primaryBranch) + exec.MustexWithTimeout(*Timeout, dir, "git", "checkout", "-f", primaryBranch) if !newRepo { - exec.Mustex(dir, "git", "fetch", "origin", "--prune") - exec.Mustex(dir, "git", "reset", "--hard", "origin/"+primaryBranch) + exec.MustexWithTimeout(*Timeout, dir, "git", "fetch", "origin", "--prune") + exec.MustexWithTimeout(*Timeout, dir, "git", "reset", "--hard", "origin/"+primaryBranch) DeleteLocalBranches(dir, branchPrefix) } @@ -98,7 +103,7 @@ func CloneOrCheckout(repo, dir, mirrorDir, primaryBranch, gitopsPath, branchPref // DeleteLocalBranches removes local branches by prefix. func DeleteLocalBranches(dir, branchprefix string) { - branches := exec.Mustex(dir, "git", "for-each-ref", "--format", "%(refname)", "refs/heads/"+branchprefix) + branches := exec.MustexWithTimeout(*Timeout, dir, "git", "for-each-ref", "--format", "%(refname)", "refs/heads/"+branchprefix) // returned format: // refs/heads/deploy/dev // refs/heads/deploy/prod @@ -108,7 +113,7 @@ func DeleteLocalBranches(dir, branchprefix string) { ref := strings.TrimSpace(line) if strings.HasPrefix(ref, "refs/heads/"+branchprefix) { ref = strings.TrimPrefix(ref, "refs/heads/") - exec.Mustex(dir, "git", "branch", "-D", ref) + exec.MustexWithTimeout(*Timeout, dir, "git", "branch", "-D", ref) } } @@ -131,17 +136,17 @@ func (r *Repo) Clean() error { // Fetch branches from the remote repository based on a specified pattern. // The branches will be be added to the list tracked remote branches ready to be pushed. func (r *Repo) Fetch(pattern string) { - exec.Mustex(r.Dir, "git", "remote", "set-branches", "--add", r.RemoteName, pattern) - exec.Mustex(r.Dir, "git", "fetch", "--force", "--filter=blob:none", "--no-tags", r.RemoteName) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "remote", "set-branches", "--add", r.RemoteName, pattern) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "fetch", "--force", "--filter=blob:none", "--no-tags", r.RemoteName) } // SwitchToBranch switch the repo to specified branch and checkout primaryBranch files over it. // if branch does not exist it will be created func (r *Repo) SwitchToBranch(branch, primaryBranch string) (new bool) { - if _, err := exec.Ex(r.Dir, "git", "checkout", branch); err != nil { + if _, err := exec.ExWithTimeout(*Timeout, r.Dir, "git", "checkout", branch); err != nil { // error checking out, create new - exec.Mustex(r.Dir, "git", "branch", branch, primaryBranch) - exec.Mustex(r.Dir, "git", "checkout", branch) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "branch", branch, primaryBranch) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "checkout", branch) return true } return false @@ -149,14 +154,14 @@ func (r *Repo) SwitchToBranch(branch, primaryBranch string) (new bool) { // RecreateBranch discards a branch content and reset it from primaryBranch. func (r *Repo) RecreateBranch(branch, primaryBranch string) { - exec.Mustex(r.Dir, "git", "checkout", primaryBranch) - exec.Mustex(r.Dir, "git", "branch", "-f", branch, primaryBranch) - exec.Mustex(r.Dir, "git", "checkout", branch) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "checkout", primaryBranch) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "branch", "-f", branch, primaryBranch) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "checkout", branch) } // GetLastCommitMessage fetches the commit message from the most recent change of the branch func (r *Repo) GetLastCommitMessage() (msg string) { - msg, err := exec.Ex(r.Dir, "git", "log", "-1", "--pretty=%B") + msg, err := exec.ExWithTimeout(*Timeout, r.Dir, "git", "log", "-1", "--pretty=%B") if err != nil { return "" } @@ -166,25 +171,25 @@ func (r *Repo) GetLastCommitMessage() (msg string) { // Commit all changes to the current branch. returns true if there were any changes func (r *Repo) Commit(message, gitopsPath string) bool { if isRootPath(gitopsPath) { - exec.Mustex(r.Dir, "git", "add", ".") + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "add", ".") } else { - exec.Mustex(r.Dir, "git", "add", gitopsPath) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "add", gitopsPath) } if r.IsClean() { return false } - exec.Mustex(r.Dir, "git", "commit", "-a", "-m", message) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "commit", "-a", "-m", message) return true } // RestoreFile restores the specified file in the repository to its original state func (r *Repo) RestoreFile(fileName string) { - exec.Mustex(r.Dir, "git", "checkout", "--", fileName) + exec.MustexWithTimeout(*Timeout, r.Dir, "git", "checkout", "--", fileName) } // GetChangedFiles returns a list of files that have been changed in the repository func (r *Repo) GetChangedFiles() []string { - s, err := exec.Ex(r.Dir, "git", "diff", "--name-only") + s, err := exec.ExWithTimeout(*Timeout, r.Dir, "git", "diff", "--name-only") if err != nil { log.Fatalf("ERROR: %s", err) } @@ -201,7 +206,14 @@ func (r *Repo) GetChangedFiles() []string { // IsClean returns true if there is no local changes (nothing to commit) func (r *Repo) IsClean() bool { - cmd := oe.Command("git", "status", "--porcelain") + var cmd *oe.Cmd + if *Timeout > 0 { + ctx, cancel := context.WithTimeout(context.Background(), *Timeout) + defer cancel() + cmd = oe.CommandContext(ctx, "git", "status", "--porcelain") + } else { + cmd = oe.Command("git", "status", "--porcelain") + } cmd.Dir = r.Dir b, err := cmd.CombinedOutput() if err != nil { @@ -214,7 +226,7 @@ func (r *Repo) IsClean() bool { // all changes should be already commited func (r *Repo) Push(branches []string) error { args := append([]string{"push", r.RemoteName, "--force-with-lease", "--set-upstream"}, branches...) - _, err := exec.Ex(r.Dir, "git", args...) + _, err := exec.ExWithTimeout(*Timeout, r.Dir, "git", args...) return err } diff --git a/gitops/git/git_test.go b/gitops/git/git_test.go index c2c4dc7a..3effd699 100644 --- a/gitops/git/git_test.go +++ b/gitops/git/git_test.go @@ -6,8 +6,10 @@ import ( "path/filepath" "strings" "testing" + "time" "github.com/fasterci/rules_gitops/gitops/commitmsg" + "github.com/fasterci/rules_gitops/gitops/exec" ) func mustRun(t *testing.T, dir string, name string, args ...string) string { @@ -533,4 +535,51 @@ func TestPushForceWithLeaseOnDeletedBranch(t *testing.T) { }) } +func TestGitTimeout(t *testing.T) { + // 1. Verify exec.ExWithTimeout fails with extremely short timeout + _, err := exec.ExWithTimeout(1*time.Microsecond, "", "git", "version") + if err == nil { + t.Fatal("expected command to fail due to timeout, but got no error") + } + if !strings.Contains(err.Error(), "killed") && !strings.Contains(err.Error(), "deadline exceeded") && !strings.Contains(err.Error(), "canceled") { + t.Errorf("expected timeout/killed/deadline exceeded error, got: %v", err) + } + + // 2. Verify git.Repo.Push fails and returns error when Timeout is exceeded + files := map[string]string{ + "cloud/app.yaml": "image: app:v1", + } + remoteDir := createMockRemote(t, files) + defer os.RemoveAll(remoteDir) + + localDir, err := os.MkdirTemp("", "push-timeout-*") + if err != nil { + t.Fatalf("failed to create temp clone dir: %v", err) + } + defer os.RemoveAll(localDir) + + repo, err := Clone(remoteDir, localDir, "", "master", "cloud") + if err != nil { + t.Fatalf("failed to clone: %v", err) + } + configureGitUser(t, localDir) + + // Save original timeout and restore it afterwards + origTimeout := *Timeout + defer func() { + *Timeout = origTimeout + }() + + // Set timeout to 1 microsecond - guaranteed to time out on push + *Timeout = 1 * time.Microsecond + + err = repo.Push([]string{"master"}) + if err == nil { + t.Fatal("expected push to fail due to timeout, but it succeeded") + } + if !strings.Contains(err.Error(), "killed") && !strings.Contains(err.Error(), "deadline exceeded") && !strings.Contains(err.Error(), "canceled") { + t.Errorf("expected push to fail with timeout/killed/deadline exceeded error, got: %v", err) + } +} + From 2b5137d8f15a810438890965a0753fcffff78d8e Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 15:58:46 -0700 Subject: [PATCH 02/14] cquery binary output --- gitops/git/BUILD.bazel | 12 ++++- gitops/prer/create_gitops_prs.go | 81 ++++++++++++++++++++++---------- gitops/prer/prer_test.sh | 31 ++++++++++++ 3 files changed, 99 insertions(+), 25 deletions(-) create mode 100755 gitops/prer/prer_test.sh diff --git a/gitops/git/BUILD.bazel b/gitops/git/BUILD.bazel index 63cd59f6..2d495ba6 100644 --- a/gitops/git/BUILD.bazel +++ b/gitops/git/BUILD.bazel @@ -8,7 +8,7 @@ # OF ANY KIND, either express or implied. See the License for the specific language # governing permissions and limitations under the License. -load("@rules_go//go:def.bzl", "go_library") +load("@rules_go//go:def.bzl", "go_library", "go_test") licenses(["notice"]) # Apache 2.0 @@ -28,3 +28,13 @@ alias( actual = ":git", visibility = ["//visibility:public"], ) + +go_test( + name = "git_test", + srcs = ["git_test.go"], + embed = [":git"], + deps = [ + "//gitops/commitmsg", + "//gitops/exec", + ], +) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index 19daaedb..54d9fea8 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -18,6 +18,7 @@ import ( "log" "os" oe "os/exec" + "path/filepath" "strings" "sync" @@ -73,6 +74,7 @@ var ( gitopsRuleName SliceFlags gitopsRuleAttr SliceFlags dryRun = flag.Bool("dry_run", false, "Do not create PRs, just print what would be done") + dryPush = flag.Bool("dry_push", false, "Do not push, just print what would be done") resolvedPushes SliceFlags resolvedBinaries SliceFlags pushRetryMax = flag.Int("push_retry_max", 2, "maximum number of push retries on race conditions") @@ -109,6 +111,30 @@ func bazelQuery(query string) *analysis.CqueryResult { return qr } +func bazelQueryPaths(query string) []string { + log.Println("Executing bazel cquery ", query) + cmd := oe.Command(*bazelCmd, "cquery", "--implicit_deps=false", query, "--output=starlark", `--starlark:expr=target.files.to_list()[0].path if target.files.to_list() else ''`) + stderr, err := cmd.StderrPipe() + if err != nil { + log.Fatal(err) + } + go func() { + io.Copy(os.Stderr, stderr) + }() + out, err := cmd.Output() + if err != nil { + log.Fatal(err) + } + var paths []string + for _, line := range strings.Split(string(out), "\n") { + line = strings.TrimSpace(line) + if line != "" { + paths = append(paths, line) + } + } + return paths +} + func main() { flag.Parse() if *workspace != "" { @@ -261,42 +287,49 @@ func main() { } query := strings.Join(qv, " union ") - qr := bazelQuery(query) - targetsCh := make(chan string) + paths := bazelQueryPaths(query) + pathsCh := make(chan string) var wg sync.WaitGroup wg.Add(*pushParallelism) for i := 0; i < *pushParallelism; i++ { go func() { defer wg.Done() - for target := range targetsCh { - bin := bazel.TargetToExecutable(target) - fi, err := os.Stat(bin) - if err == nil && fi.Mode().IsRegular() { - exec.Mustex("", bin) - } else { - log.Println("target", target, "is not a file, running as a command") - - args := []string{"run"} - - if len(bazelFlags) > 0 { - for _, bazelFlag := range bazelFlags { - bazelFlagArgs := strings.Split(bazelFlag, " ") - - args = append(args, bazelFlagArgs...) + for path := range pathsCh { + executed := false + absPath, err := filepath.Abs(path) + if err == nil { + runfilesDir := absPath + ".runfiles" + if fi, err := os.Stat(runfilesDir); err == nil && fi.IsDir() { + workspaceDir := filepath.Join(runfilesDir, "_main") + if fi, err := os.Stat(workspaceDir); err != nil || !fi.IsDir() { + workspaceDir = filepath.Join(runfilesDir, "rules_gitops") + } + if fi, err := os.Stat(workspaceDir); err == nil && fi.IsDir() { + log.Printf("Executing %s in %s", absPath, workspaceDir) + if !*dryPush { + exec.Mustex(workspaceDir, absPath) + } else { + log.Printf("Skipping execution of %s in %s (dry run)", absPath, workspaceDir) + } + executed = true } } - - args = append(args, target) - - exec.Mustex("", *bazelCmd, args...) + } + if !executed { + fi, err := os.Stat(path) + if err == nil && fi.Mode().IsRegular() { + exec.Mustex("", path) + } else { + log.Fatalf("push binary path %s is not a regular file, cannot run it", path) + } } } }() } - for _, t := range qr.Results { - targetsCh <- t.Target.Rule.GetName() + for _, p := range paths { + pathsCh <- p } - close(targetsCh) + close(pathsCh) wg.Wait() } diff --git a/gitops/prer/prer_test.sh b/gitops/prer/prer_test.sh new file mode 100755 index 00000000..cd7fddbd --- /dev/null +++ b/gitops/prer/prer_test.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -e + +# Make sure we are running from the repository root +WORKSPACE_ROOT=$(git rev-parse --show-toplevel) +cd "$WORKSPACE_ROOT" +echo "Workspace root is $WORKSPACE_ROOT" + +# Build the create_gitops_prs tool first to make sure it's up to date +bazel build //gitops/prer:create_gitops_prs + +# Find the built binary +if [ -x "bazel-bin/gitops/prer/create_gitops_prs_/create_gitops_prs" ]; then + PRER_BIN="bazel-bin/gitops/prer/create_gitops_prs_/create_gitops_prs" +elif [ -x "bazel-bin/gitops/prer/create_gitops_prs" ]; then + PRER_BIN="bazel-bin/gitops/prer/create_gitops_prs" +else + echo "create_gitops_prs binary not found or not executable" + exit 1 +fi + +echo "Running create_gitops_prs in dry run mode..." +"./$PRER_BIN" \ + --workspace="$WORKSPACE_ROOT" \ + --git_repo="$WORKSPACE_ROOT" \ + --release_branch="gitops_test_release_branch" \ + --gitops_pr_into="main" \ + --target="//gitops/testing/..." \ + --dry_run \ + --dry_push + From 04246a62d5d0355fa7f8106a57734619338f46d1 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 16:13:30 -0700 Subject: [PATCH 03/14] test: add validation for gitops targets and push binaries to prer_test.sh --- gitops/prer/prer_test.sh | 48 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/gitops/prer/prer_test.sh b/gitops/prer/prer_test.sh index cd7fddbd..fbc94fb7 100755 --- a/gitops/prer/prer_test.sh +++ b/gitops/prer/prer_test.sh @@ -19,6 +19,10 @@ else exit 1 fi +# Capture output +OUTPUT_FILE=$(mktemp) +trap 'rm -f "$OUTPUT_FILE"' EXIT + echo "Running create_gitops_prs in dry run mode..." "./$PRER_BIN" \ --workspace="$WORKSPACE_ROOT" \ @@ -27,5 +31,45 @@ echo "Running create_gitops_prs in dry run mode..." --gitops_pr_into="main" \ --target="//gitops/testing/..." \ --dry_run \ - --dry_push - + --dry_push > "$OUTPUT_FILE" 2>&1 + +cat "$OUTPUT_FILE" + +# Define expected gitops targets +EXPECTED_TARGETS=( + "//gitops/testing:external_image_label.gitops" + "//gitops/testing:label.gitops" + "//gitops/testing:legacy_alias.gitops" + "//gitops/testing:legacy_label.gitops" + "//gitops/testing:legacy_renamed_alias.gitops" +) + +# Define expected push binaries (relative paths under workspace bazel-out/.../bin) +EXPECTED_PUSH_BINARIES=( + "gitops/testing/external_image_docker_io.push" + "gitops/testing/push_skylib_kustomize_tests_image_docker_io.push.sh" + "gitops/testing/pushed_image_docker_io.push" + "gitops/testing/push_pushed_image.sh" +) + +echo "Verifying gitops targets..." +for target in "${EXPECTED_TARGETS[@]}"; do + if ! grep -q "target $target" "$OUTPUT_FILE"; then + echo "ERROR: Expected gitops target '$target' not found in output" >&2 + exit 1 + fi +done + +echo "Verifying push binaries..." +for push_bin in "${EXPECTED_PUSH_BINARIES[@]}"; do + escaped_workspace=$(echo "$WORKSPACE_ROOT" | sed 's/\./\\./g') + escaped_bin=$(echo "$push_bin" | sed 's/\./\\./g') + pattern="Skipping execution of $escaped_workspace/bazel-out/[^/]+/bin/$escaped_bin in " + if ! grep -Eq "$pattern" "$OUTPUT_FILE"; then + echo "ERROR: Expected push binary '$push_bin' was not executed/skipped in output" >&2 + exit 1 + fi +done + +echo "Verification successful!" + From 3ca5b08ecf295dd84947d6d1122b9d26b5458b1b Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 16:45:24 -0700 Subject: [PATCH 04/14] refactor: replace protobuf-based bazel cquery with starlark json output to extract gitops metadata --- gitops/prer/create_gitops_prs.go | 79 ++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index 54d9fea8..d081723b 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -12,6 +12,7 @@ governing permissions and limitations under the License. package main import ( + "encoding/json" "flag" "fmt" "io" @@ -22,8 +23,6 @@ import ( "strings" "sync" - "github.com/fasterci/rules_gitops/gitops/analysis" - "github.com/fasterci/rules_gitops/gitops/bazel" "github.com/fasterci/rules_gitops/gitops/commitmsg" "github.com/fasterci/rules_gitops/gitops/exec" "github.com/fasterci/rules_gitops/gitops/git" @@ -31,7 +30,6 @@ import ( "github.com/fasterci/rules_gitops/gitops/git/github" "github.com/fasterci/rules_gitops/gitops/git/gitlab" "golang.org/x/sync/errgroup" - "google.golang.org/protobuf/proto" ) func init() { @@ -90,9 +88,26 @@ func init() { flag.StringVar(&gitopsdir, "gitopsdir", "", "do not use temporary directory for gitops, use this directory instead") } -func bazelQuery(query string) *analysis.CqueryResult { +type GitopsTarget struct { + Target string `json:"target"` + Binary string `json:"executable"` + DeploymentBranch string `json:"deployment_branch"` +} + +func cleanTarget(target string) string { + if strings.HasPrefix(target, "@@//") { + return target[2:] + } + if strings.HasPrefix(target, "@//") { + return target[1:] + } + return target +} + +func bazelQueryTargets(query string) []GitopsTarget { log.Println("Executing bazel cquery ", query) - cmd := oe.Command(*bazelCmd, "cquery", query, "--output=proto") + starlarkExpr := `json.encode(struct(deployment_branch = getattr(providers(target)['//gitops:provider.bzl%GitopsArtifactsInfo'], 'deployment_branch', '') if '//gitops:provider.bzl%GitopsArtifactsInfo' in providers(target) else '', target = str(target.label), executable = providers(target)['DefaultInfo'].files_to_run.executable.path if providers(target)['DefaultInfo'].files_to_run.executable else ''))` + cmd := oe.Command(*bazelCmd, "cquery", "--implicit_deps=false", query, "--output=starlark", "--starlark:expr="+starlarkExpr) stderr, err := cmd.StderrPipe() if err != nil { log.Fatal(err) @@ -100,15 +115,23 @@ func bazelQuery(query string) *analysis.CqueryResult { go func() { io.Copy(os.Stderr, stderr) }() - buildproto, err := cmd.Output() + out, err := cmd.Output() if err != nil { log.Fatal(err) } - qr := &analysis.CqueryResult{} - if err := proto.Unmarshal(buildproto, qr); err != nil { - log.Fatal(err) + var targets []GitopsTarget + for _, line := range strings.Split(string(out), "\n") { + line = strings.TrimSpace(line) + if line == "" { + continue + } + var gt GitopsTarget + if err := json.Unmarshal([]byte(line), >); err != nil { + log.Fatalf("failed to unmarshal JSON line %q: %v", line, err) + } + targets = append(targets, gt) } - return qr + return targets } func bazelQueryPaths(query string) []string { @@ -158,27 +181,24 @@ func main() { log.Fatalf("unknown vcs host: %s", *gitHost) } - releaseTrains := make(map[string][]string) + releaseTrains := make(map[string][]GitopsTarget) if len(resolvedBinaries) > 0 { for _, rb := range resolvedBinaries { releaseTrain, bin, found := strings.Cut(rb, ":") if !found { log.Fatalf("resolved_binaries: invalid resolved_binary format: %s", rb) } - releaseTrains[releaseTrain] = append(releaseTrains[releaseTrain], bin) + releaseTrains[releaseTrain] = append(releaseTrains[releaseTrain], GitopsTarget{Target: bin, Binary: bin}) } } else { - q := fmt.Sprintf("attr(deployment_branch, \".+\", attr(release_branch_prefix, \"%s\", kind(gitops, %s)))", *releaseBranch, *target) - qr := bazelQuery(q) - for _, t := range qr.Results { - var releaseTrain string - for _, a := range t.Target.GetRule().GetAttribute() { - if a.GetName() == "deployment_branch" { - releaseTrain = a.GetStringValue() - } - } - releaseTrains[releaseTrain] = append(releaseTrains[releaseTrain], t.Target.Rule.GetName()) + results := bazelQueryTargets(q) + if *dryRun { + log.Printf("Found Targets: %v", results) + } + for _, t := range results { + targetName := cleanTarget(t.Target) + releaseTrains[t.DeploymentBranch] = append(releaseTrains[t.DeploymentBranch], GitopsTarget{Target: targetName, Binary: t.Binary, DeploymentBranch: t.DeploymentBranch}) } if (len(releaseTrains)) == 0 { log.Println("No matching targets found") @@ -189,7 +209,7 @@ func main() { for train, targets := range releaseTrains { fmt.Println(train) for _, t := range targets { - fmt.Println(" ", t) + fmt.Println(" ", t.Target) } } @@ -224,7 +244,7 @@ func main() { msg := workdir.GetLastCommitMessage() targetset := make(map[string]bool) for _, t := range targets { - targetset[t] = true + targetset[t.Target] = true } oldtargets := commitmsg.ExtractTargets(msg) for _, t := range oldtargets { @@ -235,14 +255,15 @@ func main() { } } } + var targetNames []string for _, target := range targets { - log.Println("train", train, "target", target) - bin := bazel.TargetToExecutable(target) - exec.Mustex("", bin, "--nopush", "--deployment_root", gitopsdir) + log.Println("train", train, "target", target.Target) + exec.Mustex("", target.Binary, "--nopush", "--deployment_root", gitopsdir) + targetNames = append(targetNames, target.Target) } - if workdir.Commit(fmt.Sprintf("GitOps for release branch %s from %s commit %s\n%s", *releaseBranch, *branchName, *gitCommit, commitmsg.Generate(targets)), *gitopsPath) { + if workdir.Commit(fmt.Sprintf("GitOps for release branch %s from %s commit %s\n%s", *releaseBranch, *branchName, *gitCommit, commitmsg.Generate(targetNames)), *gitopsPath) { log.Println("branch", branch, "has changes, push is required") - updatedGitopsTargets = append(updatedGitopsTargets, targets...) + updatedGitopsTargets = append(updatedGitopsTargets, targetNames...) updatedGitopsBranches = append(updatedGitopsBranches, branch) } } From 7d647751f6925e89032aa4dc71039ab986eea53b Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 16:51:18 -0700 Subject: [PATCH 05/14] refactor: remove unused Bazel analysis and Blaze query proto definitions and test code --- BUILD.bazel | 4 - MODULE.bazel | 14 - MODULE.bazel.lock | 8 +- gitops/analysis/BUILD.bazel | 49 - gitops/analysis/analysis.pb.go | 950 ---------- gitops/analysis/analysis.proto | 200 -- gitops/bazel/BUILD.bazel | 32 - gitops/bazel/bazeltargets.go | 57 - gitops/bazel/bazeltargets_test.go | 47 - gitops/blaze_query/BUILD.bazel | 52 - gitops/blaze_query/build.proto | 517 ----- gitops/blaze_query/build_query.pb.go | 2586 -------------------------- gitops/prer/BUILD.bazel | 3 - go.mod | 2 +- starlark/BUILD.bazel | 0 starlark/proto.bzl | 85 - 16 files changed, 3 insertions(+), 4603 deletions(-) delete mode 100644 gitops/analysis/BUILD.bazel delete mode 100644 gitops/analysis/analysis.pb.go delete mode 100644 gitops/analysis/analysis.proto delete mode 100644 gitops/bazel/BUILD.bazel delete mode 100644 gitops/bazel/bazeltargets.go delete mode 100644 gitops/bazel/bazeltargets_test.go delete mode 100644 gitops/blaze_query/BUILD.bazel delete mode 100644 gitops/blaze_query/build.proto delete mode 100644 gitops/blaze_query/build_query.pb.go delete mode 100644 starlark/BUILD.bazel delete mode 100644 starlark/proto.bzl diff --git a/BUILD.bazel b/BUILD.bazel index 8f391fdc..4b654c30 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -10,12 +10,8 @@ # gazelle:build_tags darwin,linux # gazelle:exclude examples e2e -# gazelle:proto disable_global # gazelle:go_naming_convention import_alias -# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/blaze_query //gitops/blaze_query:blaze_query -# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/analysis //gitops/analysis:analysis - load("@buildifier_prebuilt//:rules.bzl", "buildifier") load("@gazelle//:def.bzl", "gazelle") diff --git a/MODULE.bazel b/MODULE.bazel index cdad157a..79935bec 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -29,7 +29,6 @@ use_repo( "io_k8s_api", "io_k8s_apimachinery", "io_k8s_client_go", - "org_golang_google_protobuf", "org_golang_x_oauth2", "org_golang_x_sync", ) @@ -53,17 +52,4 @@ kubeconfig( bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True) -bazel_dep(name = "rules_proto", version = "7.1.0") -bazel_dep(name = "toolchains_protoc", version = "0.4.1") -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc") -protoc.toolchain( - # Creates a repository to satisfy well-known-types dependencies such as - # deps=["@com_google_protobuf//:any_proto"] - google_protobuf = "com_google_protobuf", - # Pin to any version of protoc - version = "v27.1", -) -use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub") - -register_toolchains("@toolchains_protoc_hub//:all") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index af5ea25a..47c73827 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -69,8 +69,7 @@ "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", - "https://bcr.bazel.build/modules/protobuf/29.1/MODULE.bazel": "557c3457560ff49e122ed76c0bc3397a64af9574691cb8201b4e46d4ab2ecb95", - "https://bcr.bazel.build/modules/protobuf/29.1/source.json": "04cca85dce26b895ed037d98336d860367fe09919208f2ad383f0df1aff63199", + "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981", "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", @@ -138,8 +137,7 @@ "https://bcr.bazel.build/modules/rules_proto/6.0.0/MODULE.bazel": "b531d7f09f58dce456cd61b4579ce8c86b38544da75184eadaf0a7cb7966453f", "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", - "https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel": "002d62d9108f75bb807cd56245d45648f38275cb3a99dcd45dfb864c5d74cb96", - "https://bcr.bazel.build/modules/rules_proto/7.1.0/source.json": "39f89066c12c24097854e8f57ab8558929f9c8d474d34b2c00ac04630ad8940e", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1", "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", @@ -160,8 +158,6 @@ "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01", - "https://bcr.bazel.build/modules/toolchains_protoc/0.4.1/MODULE.bazel": "05d6c16474a7a96002dd5512c444aa6965ebcf95f3e0c47001aa18269fbecec9", - "https://bcr.bazel.build/modules/toolchains_protoc/0.4.1/source.json": "474d926c8e845762faaa42e792fc66cd36794daee4c8af900f673fad0b403a8d", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", diff --git a/gitops/analysis/BUILD.bazel b/gitops/analysis/BUILD.bazel deleted file mode 100644 index 5fde6815..00000000 --- a/gitops/analysis/BUILD.bazel +++ /dev/null @@ -1,49 +0,0 @@ -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") -load("//starlark:proto.bzl", "write_go_proto_srcs") - -proto_library( - name = "analysis_proto", - srcs = ["analysis.proto"], - visibility = ["//visibility:public"], - deps = [ - "//gitops/blaze_query:blaze_query_proto", - ], -) - -go_proto_library( - name = "analysis_go_proto", - gc_goopts = ["-trimpath=$(BINDIR)=>."], - importpath = "github.com/fasterci/rules_gitops/gitops/analysis", - proto = ":analysis_proto", - visibility = ["//visibility:public"], - deps = [ - "//gitops/blaze_query:blaze_query_go_proto", - ], -) - -write_go_proto_srcs( - name = "write_generated_protos", - src = "analysis.pb.go", - go_proto_library = ":analysis_go_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "analysis", - srcs = ["analysis.pb.go"], - importpath = "github.com/fasterci/rules_gitops/gitops/analysis", - visibility = ["//visibility:public"], - deps = [ - "//gitops/blaze_query", - "@org_golang_google_protobuf//reflect/protoreflect", - "@org_golang_google_protobuf//runtime/protoimpl", - ], -) - -alias( - name = "go_default_library", - actual = ":analysis", - visibility = ["//visibility:public"], -) diff --git a/gitops/analysis/analysis.pb.go b/gitops/analysis/analysis.pb.go deleted file mode 100644 index 454e5e71..00000000 --- a/gitops/analysis/analysis.pb.go +++ /dev/null @@ -1,950 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.27.1 -// source: gitops/analysis/analysis.proto - -package analysis - -import ( - blaze_query "github.com/fasterci/rules_gitops/gitops/blaze_query" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ActionGraphContainer struct { - state protoimpl.MessageState `protogen:"open.v1"` - Artifacts []*Artifact `protobuf:"bytes,1,rep,name=artifacts,proto3" json:"artifacts,omitempty"` - Actions []*Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"` - Targets []*Target `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"` - DepSetOfFiles []*DepSetOfFiles `protobuf:"bytes,4,rep,name=dep_set_of_files,json=depSetOfFiles,proto3" json:"dep_set_of_files,omitempty"` - Configuration []*Configuration `protobuf:"bytes,5,rep,name=configuration,proto3" json:"configuration,omitempty"` - AspectDescriptors []*AspectDescriptor `protobuf:"bytes,6,rep,name=aspect_descriptors,json=aspectDescriptors,proto3" json:"aspect_descriptors,omitempty"` - RuleClasses []*RuleClass `protobuf:"bytes,7,rep,name=rule_classes,json=ruleClasses,proto3" json:"rule_classes,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ActionGraphContainer) Reset() { - *x = ActionGraphContainer{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ActionGraphContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ActionGraphContainer) ProtoMessage() {} - -func (x *ActionGraphContainer) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ActionGraphContainer.ProtoReflect.Descriptor instead. -func (*ActionGraphContainer) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{0} -} - -func (x *ActionGraphContainer) GetArtifacts() []*Artifact { - if x != nil { - return x.Artifacts - } - return nil -} - -func (x *ActionGraphContainer) GetActions() []*Action { - if x != nil { - return x.Actions - } - return nil -} - -func (x *ActionGraphContainer) GetTargets() []*Target { - if x != nil { - return x.Targets - } - return nil -} - -func (x *ActionGraphContainer) GetDepSetOfFiles() []*DepSetOfFiles { - if x != nil { - return x.DepSetOfFiles - } - return nil -} - -func (x *ActionGraphContainer) GetConfiguration() []*Configuration { - if x != nil { - return x.Configuration - } - return nil -} - -func (x *ActionGraphContainer) GetAspectDescriptors() []*AspectDescriptor { - if x != nil { - return x.AspectDescriptors - } - return nil -} - -func (x *ActionGraphContainer) GetRuleClasses() []*RuleClass { - if x != nil { - return x.RuleClasses - } - return nil -} - -type Artifact struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ExecPath string `protobuf:"bytes,2,opt,name=exec_path,json=execPath,proto3" json:"exec_path,omitempty"` - IsTreeArtifact bool `protobuf:"varint,3,opt,name=is_tree_artifact,json=isTreeArtifact,proto3" json:"is_tree_artifact,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Artifact) Reset() { - *x = Artifact{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Artifact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Artifact) ProtoMessage() {} - -func (x *Artifact) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Artifact.ProtoReflect.Descriptor instead. -func (*Artifact) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{1} -} - -func (x *Artifact) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Artifact) GetExecPath() string { - if x != nil { - return x.ExecPath - } - return "" -} - -func (x *Artifact) GetIsTreeArtifact() bool { - if x != nil { - return x.IsTreeArtifact - } - return false -} - -type Action struct { - state protoimpl.MessageState `protogen:"open.v1"` - TargetId string `protobuf:"bytes,1,opt,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` - AspectDescriptorIds []string `protobuf:"bytes,2,rep,name=aspect_descriptor_ids,json=aspectDescriptorIds,proto3" json:"aspect_descriptor_ids,omitempty"` - ActionKey string `protobuf:"bytes,3,opt,name=action_key,json=actionKey,proto3" json:"action_key,omitempty"` - Mnemonic string `protobuf:"bytes,4,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"` - ConfigurationId string `protobuf:"bytes,5,opt,name=configuration_id,json=configurationId,proto3" json:"configuration_id,omitempty"` - Arguments []string `protobuf:"bytes,6,rep,name=arguments,proto3" json:"arguments,omitempty"` - EnvironmentVariables []*KeyValuePair `protobuf:"bytes,7,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"` - InputDepSetIds []string `protobuf:"bytes,8,rep,name=input_dep_set_ids,json=inputDepSetIds,proto3" json:"input_dep_set_ids,omitempty"` - OutputIds []string `protobuf:"bytes,9,rep,name=output_ids,json=outputIds,proto3" json:"output_ids,omitempty"` - DiscoversInputs bool `protobuf:"varint,10,opt,name=discovers_inputs,json=discoversInputs,proto3" json:"discovers_inputs,omitempty"` - ExecutionInfo []*KeyValuePair `protobuf:"bytes,11,rep,name=execution_info,json=executionInfo,proto3" json:"execution_info,omitempty"` - ParamFiles []*ParamFile `protobuf:"bytes,12,rep,name=param_files,json=paramFiles,proto3" json:"param_files,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Action) Reset() { - *x = Action{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Action) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Action) ProtoMessage() {} - -func (x *Action) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Action.ProtoReflect.Descriptor instead. -func (*Action) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{2} -} - -func (x *Action) GetTargetId() string { - if x != nil { - return x.TargetId - } - return "" -} - -func (x *Action) GetAspectDescriptorIds() []string { - if x != nil { - return x.AspectDescriptorIds - } - return nil -} - -func (x *Action) GetActionKey() string { - if x != nil { - return x.ActionKey - } - return "" -} - -func (x *Action) GetMnemonic() string { - if x != nil { - return x.Mnemonic - } - return "" -} - -func (x *Action) GetConfigurationId() string { - if x != nil { - return x.ConfigurationId - } - return "" -} - -func (x *Action) GetArguments() []string { - if x != nil { - return x.Arguments - } - return nil -} - -func (x *Action) GetEnvironmentVariables() []*KeyValuePair { - if x != nil { - return x.EnvironmentVariables - } - return nil -} - -func (x *Action) GetInputDepSetIds() []string { - if x != nil { - return x.InputDepSetIds - } - return nil -} - -func (x *Action) GetOutputIds() []string { - if x != nil { - return x.OutputIds - } - return nil -} - -func (x *Action) GetDiscoversInputs() bool { - if x != nil { - return x.DiscoversInputs - } - return false -} - -func (x *Action) GetExecutionInfo() []*KeyValuePair { - if x != nil { - return x.ExecutionInfo - } - return nil -} - -func (x *Action) GetParamFiles() []*ParamFile { - if x != nil { - return x.ParamFiles - } - return nil -} - -type Target struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` - RuleClassId string `protobuf:"bytes,3,opt,name=rule_class_id,json=ruleClassId,proto3" json:"rule_class_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Target) Reset() { - *x = Target{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Target) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Target) ProtoMessage() {} - -func (x *Target) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Target.ProtoReflect.Descriptor instead. -func (*Target) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{3} -} - -func (x *Target) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Target) GetLabel() string { - if x != nil { - return x.Label - } - return "" -} - -func (x *Target) GetRuleClassId() string { - if x != nil { - return x.RuleClassId - } - return "" -} - -type RuleClass struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RuleClass) Reset() { - *x = RuleClass{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RuleClass) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuleClass) ProtoMessage() {} - -func (x *RuleClass) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuleClass.ProtoReflect.Descriptor instead. -func (*RuleClass) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{4} -} - -func (x *RuleClass) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *RuleClass) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type AspectDescriptor struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Parameters []*KeyValuePair `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AspectDescriptor) Reset() { - *x = AspectDescriptor{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AspectDescriptor) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AspectDescriptor) ProtoMessage() {} - -func (x *AspectDescriptor) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AspectDescriptor.ProtoReflect.Descriptor instead. -func (*AspectDescriptor) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{5} -} - -func (x *AspectDescriptor) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *AspectDescriptor) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AspectDescriptor) GetParameters() []*KeyValuePair { - if x != nil { - return x.Parameters - } - return nil -} - -type DepSetOfFiles struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - TransitiveDepSetIds []string `protobuf:"bytes,2,rep,name=transitive_dep_set_ids,json=transitiveDepSetIds,proto3" json:"transitive_dep_set_ids,omitempty"` - DirectArtifactIds []string `protobuf:"bytes,3,rep,name=direct_artifact_ids,json=directArtifactIds,proto3" json:"direct_artifact_ids,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DepSetOfFiles) Reset() { - *x = DepSetOfFiles{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DepSetOfFiles) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DepSetOfFiles) ProtoMessage() {} - -func (x *DepSetOfFiles) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DepSetOfFiles.ProtoReflect.Descriptor instead. -func (*DepSetOfFiles) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{6} -} - -func (x *DepSetOfFiles) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *DepSetOfFiles) GetTransitiveDepSetIds() []string { - if x != nil { - return x.TransitiveDepSetIds - } - return nil -} - -func (x *DepSetOfFiles) GetDirectArtifactIds() []string { - if x != nil { - return x.DirectArtifactIds - } - return nil -} - -type Configuration struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Mnemonic string `protobuf:"bytes,2,opt,name=mnemonic,proto3" json:"mnemonic,omitempty"` - PlatformName string `protobuf:"bytes,3,opt,name=platform_name,json=platformName,proto3" json:"platform_name,omitempty"` - Checksum string `protobuf:"bytes,4,opt,name=checksum,proto3" json:"checksum,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Configuration) Reset() { - *x = Configuration{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Configuration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Configuration) ProtoMessage() {} - -func (x *Configuration) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Configuration.ProtoReflect.Descriptor instead. -func (*Configuration) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{7} -} - -func (x *Configuration) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Configuration) GetMnemonic() string { - if x != nil { - return x.Mnemonic - } - return "" -} - -func (x *Configuration) GetPlatformName() string { - if x != nil { - return x.PlatformName - } - return "" -} - -func (x *Configuration) GetChecksum() string { - if x != nil { - return x.Checksum - } - return "" -} - -type KeyValuePair struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyValuePair) Reset() { - *x = KeyValuePair{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyValuePair) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyValuePair) ProtoMessage() {} - -func (x *KeyValuePair) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyValuePair.ProtoReflect.Descriptor instead. -func (*KeyValuePair) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{8} -} - -func (x *KeyValuePair) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *KeyValuePair) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type ConfiguredTarget struct { - state protoimpl.MessageState `protogen:"open.v1"` - Target *blaze_query.Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - Configuration *Configuration `protobuf:"bytes,2,opt,name=configuration,proto3" json:"configuration,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ConfiguredTarget) Reset() { - *x = ConfiguredTarget{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ConfiguredTarget) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfiguredTarget) ProtoMessage() {} - -func (x *ConfiguredTarget) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConfiguredTarget.ProtoReflect.Descriptor instead. -func (*ConfiguredTarget) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{9} -} - -func (x *ConfiguredTarget) GetTarget() *blaze_query.Target { - if x != nil { - return x.Target - } - return nil -} - -func (x *ConfiguredTarget) GetConfiguration() *Configuration { - if x != nil { - return x.Configuration - } - return nil -} - -type CqueryResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - Results []*ConfiguredTarget `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CqueryResult) Reset() { - *x = CqueryResult{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CqueryResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CqueryResult) ProtoMessage() {} - -func (x *CqueryResult) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CqueryResult.ProtoReflect.Descriptor instead. -func (*CqueryResult) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{10} -} - -func (x *CqueryResult) GetResults() []*ConfiguredTarget { - if x != nil { - return x.Results - } - return nil -} - -type ParamFile struct { - state protoimpl.MessageState `protogen:"open.v1"` - ExecPath string `protobuf:"bytes,1,opt,name=exec_path,json=execPath,proto3" json:"exec_path,omitempty"` - Arguments []string `protobuf:"bytes,2,rep,name=arguments,proto3" json:"arguments,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ParamFile) Reset() { - *x = ParamFile{} - mi := &file_gitops_analysis_analysis_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ParamFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamFile) ProtoMessage() {} - -func (x *ParamFile) ProtoReflect() protoreflect.Message { - mi := &file_gitops_analysis_analysis_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParamFile.ProtoReflect.Descriptor instead. -func (*ParamFile) Descriptor() ([]byte, []int) { - return file_gitops_analysis_analysis_proto_rawDescGZIP(), []int{11} -} - -func (x *ParamFile) GetExecPath() string { - if x != nil { - return x.ExecPath - } - return "" -} - -func (x *ParamFile) GetArguments() []string { - if x != nil { - return x.Arguments - } - return nil -} - -var File_gitops_analysis_analysis_proto protoreflect.FileDescriptor - -const file_gitops_analysis_analysis_proto_rawDesc = "" + - "\n" + - "\x1egitops/analysis/analysis.proto\x12\banalysis\x1a\x1egitops/blaze_query/build.proto\"\xa4\x03\n" + - "\x14ActionGraphContainer\x120\n" + - "\tartifacts\x18\x01 \x03(\v2\x12.analysis.ArtifactR\tartifacts\x12*\n" + - "\aactions\x18\x02 \x03(\v2\x10.analysis.ActionR\aactions\x12*\n" + - "\atargets\x18\x03 \x03(\v2\x10.analysis.TargetR\atargets\x12@\n" + - "\x10dep_set_of_files\x18\x04 \x03(\v2\x17.analysis.DepSetOfFilesR\rdepSetOfFiles\x12=\n" + - "\rconfiguration\x18\x05 \x03(\v2\x17.analysis.ConfigurationR\rconfiguration\x12I\n" + - "\x12aspect_descriptors\x18\x06 \x03(\v2\x1a.analysis.AspectDescriptorR\x11aspectDescriptors\x126\n" + - "\frule_classes\x18\a \x03(\v2\x13.analysis.RuleClassR\vruleClasses\"a\n" + - "\bArtifact\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1b\n" + - "\texec_path\x18\x02 \x01(\tR\bexecPath\x12(\n" + - "\x10is_tree_artifact\x18\x03 \x01(\bR\x0eisTreeArtifact\"\x94\x04\n" + - "\x06Action\x12\x1b\n" + - "\ttarget_id\x18\x01 \x01(\tR\btargetId\x122\n" + - "\x15aspect_descriptor_ids\x18\x02 \x03(\tR\x13aspectDescriptorIds\x12\x1d\n" + - "\n" + - "action_key\x18\x03 \x01(\tR\tactionKey\x12\x1a\n" + - "\bmnemonic\x18\x04 \x01(\tR\bmnemonic\x12)\n" + - "\x10configuration_id\x18\x05 \x01(\tR\x0fconfigurationId\x12\x1c\n" + - "\targuments\x18\x06 \x03(\tR\targuments\x12K\n" + - "\x15environment_variables\x18\a \x03(\v2\x16.analysis.KeyValuePairR\x14environmentVariables\x12)\n" + - "\x11input_dep_set_ids\x18\b \x03(\tR\x0einputDepSetIds\x12\x1d\n" + - "\n" + - "output_ids\x18\t \x03(\tR\toutputIds\x12)\n" + - "\x10discovers_inputs\x18\n" + - " \x01(\bR\x0fdiscoversInputs\x12=\n" + - "\x0eexecution_info\x18\v \x03(\v2\x16.analysis.KeyValuePairR\rexecutionInfo\x124\n" + - "\vparam_files\x18\f \x03(\v2\x13.analysis.ParamFileR\n" + - "paramFiles\"R\n" + - "\x06Target\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" + - "\x05label\x18\x02 \x01(\tR\x05label\x12\"\n" + - "\rrule_class_id\x18\x03 \x01(\tR\vruleClassId\"/\n" + - "\tRuleClass\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\"n\n" + - "\x10AspectDescriptor\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x126\n" + - "\n" + - "parameters\x18\x03 \x03(\v2\x16.analysis.KeyValuePairR\n" + - "parameters\"\x84\x01\n" + - "\rDepSetOfFiles\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x123\n" + - "\x16transitive_dep_set_ids\x18\x02 \x03(\tR\x13transitiveDepSetIds\x12.\n" + - "\x13direct_artifact_ids\x18\x03 \x03(\tR\x11directArtifactIds\"|\n" + - "\rConfiguration\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + - "\bmnemonic\x18\x02 \x01(\tR\bmnemonic\x12#\n" + - "\rplatform_name\x18\x03 \x01(\tR\fplatformName\x12\x1a\n" + - "\bchecksum\x18\x04 \x01(\tR\bchecksum\"6\n" + - "\fKeyValuePair\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value\"~\n" + - "\x10ConfiguredTarget\x12+\n" + - "\x06target\x18\x01 \x01(\v2\x13.blaze_query.TargetR\x06target\x12=\n" + - "\rconfiguration\x18\x02 \x01(\v2\x17.analysis.ConfigurationR\rconfiguration\"D\n" + - "\fCqueryResult\x124\n" + - "\aresults\x18\x01 \x03(\v2\x1a.analysis.ConfiguredTargetR\aresults\"F\n" + - "\tParamFile\x12\x1b\n" + - "\texec_path\x18\x01 \x01(\tR\bexecPath\x12\x1c\n" + - "\targuments\x18\x02 \x03(\tR\targumentsB8\n" + - "&com.google.devtools.build.lib.analysisB\x0eAnalysisProtosb\x06proto3" - -var ( - file_gitops_analysis_analysis_proto_rawDescOnce sync.Once - file_gitops_analysis_analysis_proto_rawDescData []byte -) - -func file_gitops_analysis_analysis_proto_rawDescGZIP() []byte { - file_gitops_analysis_analysis_proto_rawDescOnce.Do(func() { - file_gitops_analysis_analysis_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gitops_analysis_analysis_proto_rawDesc), len(file_gitops_analysis_analysis_proto_rawDesc))) - }) - return file_gitops_analysis_analysis_proto_rawDescData -} - -var file_gitops_analysis_analysis_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_gitops_analysis_analysis_proto_goTypes = []any{ - (*ActionGraphContainer)(nil), // 0: analysis.ActionGraphContainer - (*Artifact)(nil), // 1: analysis.Artifact - (*Action)(nil), // 2: analysis.Action - (*Target)(nil), // 3: analysis.Target - (*RuleClass)(nil), // 4: analysis.RuleClass - (*AspectDescriptor)(nil), // 5: analysis.AspectDescriptor - (*DepSetOfFiles)(nil), // 6: analysis.DepSetOfFiles - (*Configuration)(nil), // 7: analysis.Configuration - (*KeyValuePair)(nil), // 8: analysis.KeyValuePair - (*ConfiguredTarget)(nil), // 9: analysis.ConfiguredTarget - (*CqueryResult)(nil), // 10: analysis.CqueryResult - (*ParamFile)(nil), // 11: analysis.ParamFile - (*blaze_query.Target)(nil), // 12: blaze_query.Target -} -var file_gitops_analysis_analysis_proto_depIdxs = []int32{ - 1, // 0: analysis.ActionGraphContainer.artifacts:type_name -> analysis.Artifact - 2, // 1: analysis.ActionGraphContainer.actions:type_name -> analysis.Action - 3, // 2: analysis.ActionGraphContainer.targets:type_name -> analysis.Target - 6, // 3: analysis.ActionGraphContainer.dep_set_of_files:type_name -> analysis.DepSetOfFiles - 7, // 4: analysis.ActionGraphContainer.configuration:type_name -> analysis.Configuration - 5, // 5: analysis.ActionGraphContainer.aspect_descriptors:type_name -> analysis.AspectDescriptor - 4, // 6: analysis.ActionGraphContainer.rule_classes:type_name -> analysis.RuleClass - 8, // 7: analysis.Action.environment_variables:type_name -> analysis.KeyValuePair - 8, // 8: analysis.Action.execution_info:type_name -> analysis.KeyValuePair - 11, // 9: analysis.Action.param_files:type_name -> analysis.ParamFile - 8, // 10: analysis.AspectDescriptor.parameters:type_name -> analysis.KeyValuePair - 12, // 11: analysis.ConfiguredTarget.target:type_name -> blaze_query.Target - 7, // 12: analysis.ConfiguredTarget.configuration:type_name -> analysis.Configuration - 9, // 13: analysis.CqueryResult.results:type_name -> analysis.ConfiguredTarget - 14, // [14:14] is the sub-list for method output_type - 14, // [14:14] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name -} - -func init() { file_gitops_analysis_analysis_proto_init() } -func file_gitops_analysis_analysis_proto_init() { - if File_gitops_analysis_analysis_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_gitops_analysis_analysis_proto_rawDesc), len(file_gitops_analysis_analysis_proto_rawDesc)), - NumEnums: 0, - NumMessages: 12, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_gitops_analysis_analysis_proto_goTypes, - DependencyIndexes: file_gitops_analysis_analysis_proto_depIdxs, - MessageInfos: file_gitops_analysis_analysis_proto_msgTypes, - }.Build() - File_gitops_analysis_analysis_proto = out.File - file_gitops_analysis_analysis_proto_goTypes = nil - file_gitops_analysis_analysis_proto_depIdxs = nil -} diff --git a/gitops/analysis/analysis.proto b/gitops/analysis/analysis.proto deleted file mode 100644 index 0ebcf6ed..00000000 --- a/gitops/analysis/analysis.proto +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2018 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package analysis; - -option java_package = "com.google.devtools.build.lib.analysis"; -option java_outer_classname = "AnalysisProtos"; - -import "gitops/blaze_query/build.proto"; - -// Container for the action graph properties. -message ActionGraphContainer { - repeated Artifact artifacts = 1; - repeated Action actions = 2; - repeated Target targets = 3; - repeated DepSetOfFiles dep_set_of_files = 4; - repeated Configuration configuration = 5; - repeated AspectDescriptor aspect_descriptors = 6; - repeated RuleClass rule_classes = 7; -} - -// Represents a single artifact, whether it's a source file or a derived output -// file. -message Artifact { - // Identifier for this artifact; this is an opaque string, only valid for this - // particular dump of the analysis. - string id = 1; - - // The relative path of the file within the execution root. - string exec_path = 2; - - // True iff the artifact is a tree artifact, i.e. the above exec_path refers - // a directory. - bool is_tree_artifact = 3; -} - -// Represents a single action, which is a function from Artifact(s) to -// Artifact(s). -message Action { - // The target that was responsible for the creation of the action. - string target_id = 1; - - // The aspects that were responsible for the creation of the action (if any). - // In the case of aspect-on-aspect, AspectDescriptors are listed in - // topological order of the dependency graph. - // e.g. [A, B] would imply that aspect A is applied on top of aspect B. - repeated string aspect_descriptor_ids = 2; - - // Encodes all significant behavior that might affect the output. The key - // must change if the work performed by the execution of this action changes. - // Note that the key doesn't include checksums of the input files. - string action_key = 3; - - // The mnemonic for this kind of action. - string mnemonic = 4; - - // The configuration under which this action is executed. - string configuration_id = 5; - - // The command line arguments of the action. This will be only set if - // explicitly requested. - repeated string arguments = 6; - - // The list of environment variables to be set before executing the command. - repeated KeyValuePair environment_variables = 7; - - // The set of input dep sets that the action depends upon. If the action does - // input discovery, the contents of this set might change during execution. - repeated string input_dep_set_ids = 8; - - // The list of Artifact IDs that represent the output files that this action - // will generate. - repeated string output_ids = 9; - - // True iff the action does input discovery during execution. - bool discovers_inputs = 10; - - // Execution info for the action. Remote execution services may use this - // information to modify the execution environment, but actions will - // generally not be aware of it. - repeated KeyValuePair execution_info = 11; - - // The list of param files. This will be only set if explicitly requested. - repeated ParamFile param_files = 12; -} - -// Represents a single target (without configuration information) that is -// associated with an action. -message Target { - // Identifier for this target; this is an opaque string, only valid for this - // particular dump of the analysis. - string id = 1; - - // Label of the target, e.g. //foo:bar. - string label = 2; - - // Class of the rule. - string rule_class_id = 3; -} - -message RuleClass { - // Identifier for this rule class; this is an opaque string, only valid for - // this particular dump of the analysis. - string id = 1; - - // Name of the rule class, e.g. cc_library. - string name = 2; -} - -// Represents an invocation specific descriptor of an aspect. -message AspectDescriptor { - // Identifier for this aspect descriptor; this is an opaque string, only valid - // for the particular dump of the analysis. - string id = 1; - - // The name of the corresponding aspect. For native aspects, it's the Java - // class name, for Skylark aspects it's the bzl file followed by a % sign - // followed by the name of the aspect. - string name = 2; - - // The list of parameters bound to a particular invocation of that aspect on - // a target. Note that aspects can be executed multiple times on the same - // target in different order. - repeated KeyValuePair parameters = 3; -} - -message DepSetOfFiles { - // Identifier for this named set of files; this is an opaque string, only - // valid for the particular dump of the analysis. - string id = 1; - - // Other transitively included named set of files. - repeated string transitive_dep_set_ids = 2; - - // The list of input artifact IDs that are immediately contained in this set. - repeated string direct_artifact_ids = 3; -} - -message Configuration { - // Identifier for this configuration; this is an opaque string, only valid for - // the particular dump of the analysis. - string id = 1; - - // The mnemonic representing the build configuration. - string mnemonic = 2; - - // The platform string. - string platform_name = 3; - - // The checksum representation of the configuration options; - string checksum = 4; -} - -message KeyValuePair { - // The variable name. - string key = 1; - - // The variable value. - string value = 2; -} - -message ConfiguredTarget { - // The target. We use blaze_query.Target defined in build.proto instead of - // the Target defined in this file because blaze_query.Target is much heavier - // and will output proto results similar to what users are familiar with from - // regular blaze query. - blaze_query.Target target = 1; - - // The configuration - Configuration configuration = 2; -} - -// Container for cquery results -message CqueryResult { - // All the configuredtargets returns by cquery - repeated ConfiguredTarget results = 1; -} - -// Content of a param file. -message ParamFile { - // The exec path of the param file artifact. - string exec_path = 1; - - // The arguments in the param file. - // Each argument corresponds to a line in the param file. - repeated string arguments = 2; -} diff --git a/gitops/bazel/BUILD.bazel b/gitops/bazel/BUILD.bazel deleted file mode 100644 index 0130d137..00000000 --- a/gitops/bazel/BUILD.bazel +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2020 Adobe. All rights reserved. -# This file is licensed to you under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. You may obtain a copy -# of the License at http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software distributed under -# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -# OF ANY KIND, either express or implied. See the License for the specific language -# governing permissions and limitations under the License. - -load("@rules_go//go:def.bzl", "go_library", "go_test") - -licenses(["notice"]) # Apache 2.0 - -go_library( - name = "bazel", - srcs = ["bazeltargets.go"], - importpath = "github.com/fasterci/rules_gitops/gitops/bazel", - visibility = ["//visibility:public"], -) - -go_test( - name = "bazel_test", - srcs = ["bazeltargets_test.go"], - embed = [":bazel"], -) - -alias( - name = "go_default_library", - actual = ":bazel", - visibility = ["//visibility:public"], -) diff --git a/gitops/bazel/bazeltargets.go b/gitops/bazel/bazeltargets.go deleted file mode 100644 index dd3e98d3..00000000 --- a/gitops/bazel/bazeltargets.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2020 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -package bazel - -import ( - "os" - "strings" -) - -// TargetToExecutable converts bazel target name to respective executable name in bazel-bin -func TargetToExecutable(target string) string { - if !strings.HasPrefix(target, "//") { - return target - } - t := target[2:] - var pkg, name string - idx := strings.Index(t, ":") - if idx >= 0 { - pkg = t[:idx] - name = t[idx+1:] - } else { - pkg = t - lastSlash := strings.LastIndex(pkg, "/") - if lastSlash >= 0 { - name = pkg[lastSlash+1:] - } else { - name = pkg - } - } - - // Candidates in order of preference - candidates := []string{ - "bazel-bin/" + pkg + "/" + name + "_/" + name, - "bazel-bin/" + pkg + "/" + name + "_/" + name + ".exe", - "bazel-bin/" + pkg + "/" + name, - "bazel-bin/" + pkg + "/" + name + ".exe", - } - - for _, c := range candidates { - if _, err := os.Stat(c); err == nil { - return c - } - } - - // Default fallback (standard layout) - return "bazel-bin/" + pkg + "/" + name -} - diff --git a/gitops/bazel/bazeltargets_test.go b/gitops/bazel/bazeltargets_test.go deleted file mode 100644 index 9b8bc67f..00000000 --- a/gitops/bazel/bazeltargets_test.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2020 Adobe. All rights reserved. -This file is licensed to you under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. You may obtain a copy -of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under -the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -OF ANY KIND, either express or implied. See the License for the specific language -governing permissions and limitations under the License. -*/ -package bazel - -import ( - "os" - "testing" -) - -func TestTargetToExecutableHappypath(t *testing.T) { - s := TargetToExecutable("//rtb/bidder:rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops") - if s != "bazel-bin/rtb/bidder/rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops" { - t.Error("unexpected result", s) - } -} - -func TestTargetToExecutableGoLayout(t *testing.T) { - // Create a dummy file to simulate the go binary in bazel-bin - dir := "bazel-bin/rtb/bidder/rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops_" - err := os.MkdirAll(dir, 0755) - if err != nil { - t.Fatalf("failed to create temp dir: %v", err) - } - defer os.RemoveAll("bazel-bin") - - filePath := dir + "/rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops" - err = os.WriteFile(filePath, []byte("dummy"), 0644) - if err != nil { - t.Fatalf("failed to create temp file: %v", err) - } - - s := TargetToExecutable("//rtb/bidder:rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops") - expected := "bazel-bin/rtb/bidder/rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops_/rtb-uat-k8s01-iad-1b-bidder-first-uat.gitops" - if s != expected { - t.Errorf("expected %s, got %s", expected, s) - } -} - diff --git a/gitops/blaze_query/BUILD.bazel b/gitops/blaze_query/BUILD.bazel deleted file mode 100644 index 78904c8f..00000000 --- a/gitops/blaze_query/BUILD.bazel +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Adobe. All rights reserved. -# This file is licensed to you under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. You may obtain a copy -# of the License at http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software distributed under -# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS -# OF ANY KIND, either express or implied. See the License for the specific language -# governing permissions and limitations under the License. - -load("@rules_go//go:def.bzl", "go_library") -load("@rules_go//proto:def.bzl", "go_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") -load("//starlark:proto.bzl", "write_go_proto_srcs") - -proto_library( - name = "blaze_query_proto", - srcs = ["build.proto"], - visibility = ["//visibility:public"], -) - -go_proto_library( - name = "blaze_query_go_proto", - gc_goopts = ["-trimpath=$(BINDIR)=>."], - importpath = "github.com/fasterci/rules_gitops/gitops/blaze_query", - proto = ":blaze_query_proto", - visibility = ["//visibility:public"], -) - -write_go_proto_srcs( - name = "write_generated_protos", - src = "build_query.pb.go", - go_proto_library = ":blaze_query_go_proto", - visibility = ["//visibility:public"], -) - -go_library( - name = "blaze_query", - srcs = ["build_query.pb.go"], - importpath = "github.com/fasterci/rules_gitops/gitops/blaze_query", - visibility = ["//visibility:public"], - deps = [ - "@org_golang_google_protobuf//reflect/protoreflect", - "@org_golang_google_protobuf//runtime/protoimpl", - ], -) - -alias( - name = "go_default_library", - actual = ":blaze_query", - visibility = ["//visibility:public"], -) diff --git a/gitops/blaze_query/build.proto b/gitops/blaze_query/build.proto deleted file mode 100644 index 0f2fdb02..00000000 --- a/gitops/blaze_query/build.proto +++ /dev/null @@ -1,517 +0,0 @@ -// Copyright 2014 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// This file contains the protocol buffer representation of a build -// file or 'blaze query --output=proto' call. - -syntax = "proto2"; - -package blaze_query; - -// option cc_api_version = 2; -// option java_api_version = 1; - -option java_package = "com.google.devtools.build.lib.query2.proto.proto2api"; - -message License { - repeated string license_type = 1; - repeated string exception = 2; -} - -message StringDictEntry { - required string key = 1; - required string value = 2; -} - -message LabelDictUnaryEntry { - required string key = 1; - required string value = 2; -} - -message LabelListDictEntry { - required string key = 1; - repeated string value = 2; -} - -message LabelKeyedStringDictEntry { - required string key = 1; - required string value = 2; -} - -message StringListDictEntry { - required string key = 1; - repeated string value = 2; -} - -// Represents an entry attribute of a Fileset rule in a build file. -message FilesetEntry { - // Indicates what to do when a source file is actually a symlink. - enum SymlinkBehavior { - COPY = 1; - DEREFERENCE = 2; - } - - // The label pointing to the source target where files are copied from. - required string source = 1; - - // The relative path within the fileset rule where files will be mapped. - required string destination_directory = 2; - - // Whether the files= attribute was specified. This is necessary because - // no files= attribute and files=[] mean different things. - optional bool files_present = 7; - - // A list of file labels to include from the source directory. - repeated string file = 3; - - // If this is a fileset entry representing files within the rule - // package, this lists relative paths to files that should be excluded from - // the set. This cannot contain values if 'file' also has values. - repeated string exclude = 4; - - // This field is optional because there will be some time when the new - // PB is used by tools depending on blaze query, but the new blaze version - // is not yet released. - // TODO(bazel-team): Make this field required once a version of Blaze is - // released that outputs this field. - optional SymlinkBehavior symlink_behavior = 5 [ default=COPY ]; - - // The prefix to strip from the path of the files in this FilesetEntry. Note - // that no value and the empty string as the value mean different things here. - optional string strip_prefix = 6; -} - -// A rule attribute. Each attribute must have a type and one of the various -// value fields populated - for the most part. -// -// Attributes of BOOLEAN and TRISTATE type may set all of the int, bool, and -// string values for backwards compatibility with clients that expect them to -// be set. -// -// Attributes of INTEGER, STRING, LABEL, LICENSE, BOOLEAN, and TRISTATE type -// may set *none* of the values. This can happen if the Attribute message is -// prepared for a client that doesn't support SELECTOR_LIST, but the rule has -// a selector list value for the attribute. (Selector lists for attributes of -// other types--the collection types--are handled differently when prepared -// for such a client. The possible collection values are gathered together -// and flattened.) -// -// By checking the type, the appropriate value can be extracted - see the -// comments on each type for the associated value. The order of lists comes -// from the blaze parsing. If an attribute is of a list type, the associated -// list should never be empty. -message Attribute { - reserved 12, 16; - - // Indicates the type of attribute. - enum Discriminator { - INTEGER = 1; // int_value - STRING = 2; // string_value - LABEL = 3; // string_value - OUTPUT = 4; // string_value - STRING_LIST = 5; // string_list_value - LABEL_LIST = 6; // string_list_value - OUTPUT_LIST = 7; // string_list_value - DISTRIBUTION_SET = 8; // string_list_value - order is unimportant - LICENSE = 9; // license - STRING_DICT = 10; // string_dict_value - FILESET_ENTRY_LIST = 11; // fileset_list_value - LABEL_LIST_DICT = 12; // label_list_dict_value - STRING_LIST_DICT = 13; // string_list_dict_value - BOOLEAN = 14; // int, bool and string value - TRISTATE = 15; // tristate, int and string value - INTEGER_LIST = 16; // int_list_value - UNKNOWN = 18; // unknown type, use only for build extensions - LABEL_DICT_UNARY = 19; // label_dict_unary_value - SELECTOR_LIST = 20; // selector_list - LABEL_KEYED_STRING_DICT = 21; // label_keyed_string_dict - - DEPRECATED_STRING_DICT_UNARY = 17; - - } - - // Values for the TriState field type. - enum Tristate { - NO = 0; - YES = 1; - AUTO = 2; - } - - message SelectorEntry { - reserved 12; - - // The key of the selector entry. At this time, this is the label of a - // config_setting rule, or the pseudo-label "//conditions:default". - optional string label = 1; - - // True if the entry's value is the default value for the type as a - // result of the condition value being specified as None (ie: - // {"//condition": None}). - optional bool is_default_value = 16; - - // Exactly one of the following fields (except for glob_criteria) must be - // populated - note that the BOOLEAN and TRISTATE caveat in Attribute's - // comment does not apply here. The type field in the SelectorList - // containing this entry indicates which of these fields is populated, - // in accordance with the comments on Discriminator enum values above. - // (To be explicit: BOOLEAN populates the boolean_value field and TRISTATE - // populates the tristate_value field.) - optional int32 int_value = 2; - optional string string_value = 3; - optional bool boolean_value = 4; - optional Tristate tristate_value = 5; - repeated string string_list_value = 6; - optional License license = 7; - repeated StringDictEntry string_dict_value = 8; - repeated FilesetEntry fileset_list_value = 9; - repeated LabelListDictEntry label_list_dict_value = 10; - repeated StringListDictEntry string_list_dict_value = 11; - repeated int32 int_list_value = 13; - repeated LabelDictUnaryEntry label_dict_unary_value = 15; - repeated LabelKeyedStringDictEntry label_keyed_string_dict_value = 17; - - repeated bytes DEPRECATED_string_dict_unary_value = 14; - } - - message Selector { - // The list of (label, value) pairs in the map that defines the selector. - // At this time, this cannot be empty, i.e. a selector has at least one - // entry. - repeated SelectorEntry entries = 1; - - // Whether or not this has any default values. - optional bool has_default_value = 2; - - // The error message when no condition matches. - optional string no_match_error = 3; - } - - message SelectorList { - // The type that this selector list evaluates to, and the type that each - // selector in the list evaluates to. At this time, this cannot be - // SELECTOR_LIST, i.e. selector lists do not nest. - optional Discriminator type = 1; - - // The list of selector elements in this selector list. At this time, this - // cannot be empty, i.e. a selector list is never empty. - repeated Selector elements = 2; - } - - // The name of the attribute - required string name = 1; - - // Whether the attribute was explicitly specified - optional bool explicitly_specified = 13; - - // If this attribute has a string value or a string list value, then this - // may be set to indicate that the value may be treated as a label that - // isn't a dependency of this attribute's rule. - optional bool nodep = 20; - - // The type of attribute. This message is used for all of the different - // attribute types so the discriminator helps for figuring out what is - // stored in the message. - required Discriminator type = 2; - - // If this attribute has an integer value this will be populated. - // Boolean and TriState also use this field as [0,1] and [-1,0,1] - // for [false, true] and [auto, no, yes] respectively. - optional int32 int_value = 3; - - // If the attribute has a string value this will be populated. Label and - // path attributes use this field as the value even though the type may - // be LABEL or something else other than STRING. - optional string string_value = 5; - - // If the attribute has a boolean value this will be populated. - optional bool boolean_value = 14; - - // If the attribute is a Tristate value, this will be populated. - optional Tristate tristate_value = 15; - - // The value of the attribute has a list of string values (label and path - // note from STRING applies here as well). - repeated string string_list_value = 6; - - // If this is a license attribute, the license information is stored here. - optional License license = 7; - - // If this is a string dict, each entry will be stored here. - repeated StringDictEntry string_dict_value = 8; - - // If the attribute is part of a Fileset, the fileset entries are stored in - // this field. - repeated FilesetEntry fileset_list_value = 9; - - // If this is a label list dict, each entry will be stored here. - repeated LabelListDictEntry label_list_dict_value = 10; - - // If this is a string list dict, each entry will be stored here. - repeated StringListDictEntry string_list_dict_value = 11; - - // The value of the attribute has a list of int32 values - repeated int32 int_list_value = 17; - - // If this is a label dict unary, each entry will be stored here. - repeated LabelDictUnaryEntry label_dict_unary_value = 19; - - // If this is a label-keyed string dict, each entry will be stored here. - repeated LabelKeyedStringDictEntry label_keyed_string_dict_value = 22; - - // If this attribute's value is an expression containing one or more select - // expressions, then its type is SELECTOR_LIST and a SelectorList will be - // stored here. - optional SelectorList selector_list = 21; - - repeated bytes DEPRECATED_string_dict_unary_value = 18; -} - -// A rule instance (e.g., cc_library foo, java_binary bar). -message Rule { - reserved 8, 11; - - // The name of the rule (formatted as an absolute label, e.g. //foo/bar:baz). - required string name = 1; - - // The rule class (e.g., java_library) - required string rule_class = 2; - - // The BUILD file and line number of the location (formatted as - // :) in the rule's package's BUILD file where the - // rule instance was instantiated. The line number will be that of a rule - // invocation or macro call (that in turn invoked a rule). See - // https://docs.bazel.build/versions/master/skylark/macros.html#macro-creation - optional string location = 3; - - // All of the attributes that describe the rule. - repeated Attribute attribute = 4; - - // All of the inputs to the rule (formatted as absolute labels). These are - // predecessors in the dependency graph. - repeated string rule_input = 5; - - // All of the outputs of the rule (formatted as absolute labels). These are - // successors in the dependency graph. - repeated string rule_output = 6; - - // The set of all "features" inherited from the rule's package declaration. - repeated string default_setting = 7; - - // The rule's class's public by default value. - optional bool public_by_default = 9; - - // If this rule is of a skylark-defined RuleClass. - optional bool is_skylark = 10; - - // Hash encapsulating the behavior of this Skylark rule. Any change to this - // rule's definition that could change its behavior will be reflected here. - optional string skylark_environment_hash_code = 12; -} - -// Summary of all transitive dependencies of 'rule,' where each dependent -// rule is included only once in the 'dependency' field. Gives complete -// information to analyze the single build target labeled rule.name, -// including optional location of target in BUILD file. -message RuleSummary { - required Rule rule = 1; - repeated Rule dependency = 2; - optional string location = 3; -} - -// A package group. Aside from the name, it contains the list of packages -// present in the group (as specified in the BUILD file). -message PackageGroup { - reserved 4; - - // The name of the package group - required string name = 1; - - // The list of packages as specified in the BUILD file. Currently this is - // only a list of packages, but some time in the future, there might be - // some type of wildcard mechanism. - repeated string contained_package = 2; - - // The list of sub package groups included in this one. - repeated string included_package_group = 3; -} - -// An environment group. -message EnvironmentGroup { - // The name of the environment group. - required string name = 1; - - // The environments that belong to this group (as labels). - repeated string environment = 2; - - // The member environments that rules implicitly support if not otherwise - // specified. - repeated string default = 3; -} - -// A file that is an input into the build system. -// Next-Id: 10 -message SourceFile { - reserved 7; - - // The name of the source file (a label). - required string name = 1; - - // The location of the source file. This is a path with line numbers, not - // a label in the build system. - optional string location = 2; - - // Labels of .bzl (Skylark) files that are transitively loaded in this BUILD - // file. This is present only when the SourceFile represents a BUILD file that - // loaded .bzl files. - // TODO(bazel-team): Rename this field. - repeated string subinclude = 3; - - // Labels of package groups that are mentioned in the visibility declaration - // for this source file. - repeated string package_group = 4; - - // Labels mentioned in the visibility declaration (including :__pkg__ and - // //visibility: ones) - repeated string visibility_label = 5; - - // The package-level features enabled for this package. Only present if the - // SourceFile represents a BUILD file. - repeated string feature = 6; - - // License attribute for the file. - optional License license = 8; - - // True if the package contains an error. Only present if the SourceFile - // represents a BUILD file. - optional bool package_contains_errors = 9; -} - -// A file that is the output of a build rule. -message GeneratedFile { - // The name of the generated file (a label). - required string name = 1; - - // The label of the target that generates the file. - required string generating_rule = 2; - - // The path of the output file (not a label). - optional string location = 3; -} - -// A target from a blaze query execution. Similar to the Attribute message, -// the Discriminator is used to determine which field contains information. -// For any given type, only one of these can be populated in a single Target. -message Target { - enum Discriminator { - RULE = 1; - SOURCE_FILE = 2; - GENERATED_FILE = 3; - PACKAGE_GROUP = 4; - ENVIRONMENT_GROUP = 5; - } - - // The type of target contained in the message. - required Discriminator type = 1; - - // If this target represents a rule, the rule is stored here. - optional Rule rule = 2; - - // A file that is not generated by the build system (version controlled - // or created by the test harness). - optional SourceFile source_file = 3; - - // A generated file that is the output of a rule. - optional GeneratedFile generated_file = 4; - - // A package group. - optional PackageGroup package_group = 5; - - // An environment group. - optional EnvironmentGroup environment_group = 6; -} - -// Container for all of the blaze query results. -message QueryResult { - // All of the targets returned by the blaze query. - repeated Target target = 1; -} - -//////////////////////////////////////////////////////////////////////////// -// Messages dealing with querying the BUILD language itself. For now, this is -// quite simplistic: Blaze can only tell the names of the rule classes, their -// attributes with their type. - -// Information about allowed rule classes for a specific attribute of a rule. -message AllowedRuleClassInfo { - enum AllowedRuleClasses { - ANY = 1; // Any rule is allowed to be in this attribute - SPECIFIED = 2; // Only the explicitly listed rules are allowed - } - - required AllowedRuleClasses policy = 1; - - // Rule class names of rules allowed in this attribute, e.g "cc_library", - // "py_binary". Only present if the allowed_rule_classes field is set to - // SPECIFIED. - repeated string allowed_rule_class = 2; -} - -// This message represents a single attribute of a single rule. -// See docs.bazel.build/versions/master/skylark/lib/attr.html. -message AttributeDefinition { - required string name = 1; // e.g. "name", "srcs" - required Attribute.Discriminator type = 2; - optional bool mandatory = 3; - optional AllowedRuleClassInfo allowed_rule_classes = 4; // type=label* - optional string documentation = 5; - optional bool allow_empty = 6; // type=*_list|*_dict - optional bool allow_single_file = 7; // type=label - optional AttributeValue default = 9; // simple (not computed/late-bound) values only - optional bool executable = 10; // type=label - optional bool configurable = 11; - optional bool nodep = 12; // label-valued edge does not establish a dependency - optional bool cfg_is_host = 13; // edge entails a transition to "host" configuration -} - -// An AttributeValue represents the value of an attribute. -// A single field, determined by the attribute type, is populated. -// -// It is used only for AttributeDefinition.default. Attribute and -// SelectorEntry do their own thing for unfortunate historical reasons. -message AttributeValue { - optional int32 int = 1; // type=int|tristate - optional string string = 2; // type=string|label|output - optional bool bool = 3; // type=bool - repeated AttributeValue list = 4; // type=*_list|distrib - repeated DictEntry dict = 5; // type=*_dict - - message DictEntry { - required string key = 1; - required AttributeValue value = 2; - } -} - -message RuleDefinition { - required string name = 1; - // Only contains documented attributes - repeated AttributeDefinition attribute = 2; - optional string documentation = 3; - // Only for build extensions: label to file that defines the extension - optional string label = 4; -} - -message BuildLanguage { - // Only contains documented rule definitions - repeated RuleDefinition rule = 1; -} diff --git a/gitops/blaze_query/build_query.pb.go b/gitops/blaze_query/build_query.pb.go deleted file mode 100644 index 7478c53f..00000000 --- a/gitops/blaze_query/build_query.pb.go +++ /dev/null @@ -1,2586 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.27.1 -// source: gitops/blaze_query/build.proto - -package blaze_query - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type FilesetEntry_SymlinkBehavior int32 - -const ( - FilesetEntry_COPY FilesetEntry_SymlinkBehavior = 1 - FilesetEntry_DEREFERENCE FilesetEntry_SymlinkBehavior = 2 -) - -// Enum value maps for FilesetEntry_SymlinkBehavior. -var ( - FilesetEntry_SymlinkBehavior_name = map[int32]string{ - 1: "COPY", - 2: "DEREFERENCE", - } - FilesetEntry_SymlinkBehavior_value = map[string]int32{ - "COPY": 1, - "DEREFERENCE": 2, - } -) - -func (x FilesetEntry_SymlinkBehavior) Enum() *FilesetEntry_SymlinkBehavior { - p := new(FilesetEntry_SymlinkBehavior) - *p = x - return p -} - -func (x FilesetEntry_SymlinkBehavior) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FilesetEntry_SymlinkBehavior) Descriptor() protoreflect.EnumDescriptor { - return file_gitops_blaze_query_build_proto_enumTypes[0].Descriptor() -} - -func (FilesetEntry_SymlinkBehavior) Type() protoreflect.EnumType { - return &file_gitops_blaze_query_build_proto_enumTypes[0] -} - -func (x FilesetEntry_SymlinkBehavior) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *FilesetEntry_SymlinkBehavior) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = FilesetEntry_SymlinkBehavior(num) - return nil -} - -// Deprecated: Use FilesetEntry_SymlinkBehavior.Descriptor instead. -func (FilesetEntry_SymlinkBehavior) EnumDescriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{6, 0} -} - -type Attribute_Discriminator int32 - -const ( - Attribute_INTEGER Attribute_Discriminator = 1 - Attribute_STRING Attribute_Discriminator = 2 - Attribute_LABEL Attribute_Discriminator = 3 - Attribute_OUTPUT Attribute_Discriminator = 4 - Attribute_STRING_LIST Attribute_Discriminator = 5 - Attribute_LABEL_LIST Attribute_Discriminator = 6 - Attribute_OUTPUT_LIST Attribute_Discriminator = 7 - Attribute_DISTRIBUTION_SET Attribute_Discriminator = 8 - Attribute_LICENSE Attribute_Discriminator = 9 - Attribute_STRING_DICT Attribute_Discriminator = 10 - Attribute_FILESET_ENTRY_LIST Attribute_Discriminator = 11 - Attribute_LABEL_LIST_DICT Attribute_Discriminator = 12 - Attribute_STRING_LIST_DICT Attribute_Discriminator = 13 - Attribute_BOOLEAN Attribute_Discriminator = 14 - Attribute_TRISTATE Attribute_Discriminator = 15 - Attribute_INTEGER_LIST Attribute_Discriminator = 16 - Attribute_UNKNOWN Attribute_Discriminator = 18 - Attribute_LABEL_DICT_UNARY Attribute_Discriminator = 19 - Attribute_SELECTOR_LIST Attribute_Discriminator = 20 - Attribute_LABEL_KEYED_STRING_DICT Attribute_Discriminator = 21 - Attribute_DEPRECATED_STRING_DICT_UNARY Attribute_Discriminator = 17 -) - -// Enum value maps for Attribute_Discriminator. -var ( - Attribute_Discriminator_name = map[int32]string{ - 1: "INTEGER", - 2: "STRING", - 3: "LABEL", - 4: "OUTPUT", - 5: "STRING_LIST", - 6: "LABEL_LIST", - 7: "OUTPUT_LIST", - 8: "DISTRIBUTION_SET", - 9: "LICENSE", - 10: "STRING_DICT", - 11: "FILESET_ENTRY_LIST", - 12: "LABEL_LIST_DICT", - 13: "STRING_LIST_DICT", - 14: "BOOLEAN", - 15: "TRISTATE", - 16: "INTEGER_LIST", - 18: "UNKNOWN", - 19: "LABEL_DICT_UNARY", - 20: "SELECTOR_LIST", - 21: "LABEL_KEYED_STRING_DICT", - 17: "DEPRECATED_STRING_DICT_UNARY", - } - Attribute_Discriminator_value = map[string]int32{ - "INTEGER": 1, - "STRING": 2, - "LABEL": 3, - "OUTPUT": 4, - "STRING_LIST": 5, - "LABEL_LIST": 6, - "OUTPUT_LIST": 7, - "DISTRIBUTION_SET": 8, - "LICENSE": 9, - "STRING_DICT": 10, - "FILESET_ENTRY_LIST": 11, - "LABEL_LIST_DICT": 12, - "STRING_LIST_DICT": 13, - "BOOLEAN": 14, - "TRISTATE": 15, - "INTEGER_LIST": 16, - "UNKNOWN": 18, - "LABEL_DICT_UNARY": 19, - "SELECTOR_LIST": 20, - "LABEL_KEYED_STRING_DICT": 21, - "DEPRECATED_STRING_DICT_UNARY": 17, - } -) - -func (x Attribute_Discriminator) Enum() *Attribute_Discriminator { - p := new(Attribute_Discriminator) - *p = x - return p -} - -func (x Attribute_Discriminator) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Attribute_Discriminator) Descriptor() protoreflect.EnumDescriptor { - return file_gitops_blaze_query_build_proto_enumTypes[1].Descriptor() -} - -func (Attribute_Discriminator) Type() protoreflect.EnumType { - return &file_gitops_blaze_query_build_proto_enumTypes[1] -} - -func (x Attribute_Discriminator) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *Attribute_Discriminator) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = Attribute_Discriminator(num) - return nil -} - -// Deprecated: Use Attribute_Discriminator.Descriptor instead. -func (Attribute_Discriminator) EnumDescriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7, 0} -} - -type Attribute_Tristate int32 - -const ( - Attribute_NO Attribute_Tristate = 0 - Attribute_YES Attribute_Tristate = 1 - Attribute_AUTO Attribute_Tristate = 2 -) - -// Enum value maps for Attribute_Tristate. -var ( - Attribute_Tristate_name = map[int32]string{ - 0: "NO", - 1: "YES", - 2: "AUTO", - } - Attribute_Tristate_value = map[string]int32{ - "NO": 0, - "YES": 1, - "AUTO": 2, - } -) - -func (x Attribute_Tristate) Enum() *Attribute_Tristate { - p := new(Attribute_Tristate) - *p = x - return p -} - -func (x Attribute_Tristate) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Attribute_Tristate) Descriptor() protoreflect.EnumDescriptor { - return file_gitops_blaze_query_build_proto_enumTypes[2].Descriptor() -} - -func (Attribute_Tristate) Type() protoreflect.EnumType { - return &file_gitops_blaze_query_build_proto_enumTypes[2] -} - -func (x Attribute_Tristate) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *Attribute_Tristate) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = Attribute_Tristate(num) - return nil -} - -// Deprecated: Use Attribute_Tristate.Descriptor instead. -func (Attribute_Tristate) EnumDescriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7, 1} -} - -type Target_Discriminator int32 - -const ( - Target_RULE Target_Discriminator = 1 - Target_SOURCE_FILE Target_Discriminator = 2 - Target_GENERATED_FILE Target_Discriminator = 3 - Target_PACKAGE_GROUP Target_Discriminator = 4 - Target_ENVIRONMENT_GROUP Target_Discriminator = 5 -) - -// Enum value maps for Target_Discriminator. -var ( - Target_Discriminator_name = map[int32]string{ - 1: "RULE", - 2: "SOURCE_FILE", - 3: "GENERATED_FILE", - 4: "PACKAGE_GROUP", - 5: "ENVIRONMENT_GROUP", - } - Target_Discriminator_value = map[string]int32{ - "RULE": 1, - "SOURCE_FILE": 2, - "GENERATED_FILE": 3, - "PACKAGE_GROUP": 4, - "ENVIRONMENT_GROUP": 5, - } -) - -func (x Target_Discriminator) Enum() *Target_Discriminator { - p := new(Target_Discriminator) - *p = x - return p -} - -func (x Target_Discriminator) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Target_Discriminator) Descriptor() protoreflect.EnumDescriptor { - return file_gitops_blaze_query_build_proto_enumTypes[3].Descriptor() -} - -func (Target_Discriminator) Type() protoreflect.EnumType { - return &file_gitops_blaze_query_build_proto_enumTypes[3] -} - -func (x Target_Discriminator) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *Target_Discriminator) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = Target_Discriminator(num) - return nil -} - -// Deprecated: Use Target_Discriminator.Descriptor instead. -func (Target_Discriminator) EnumDescriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{14, 0} -} - -type AllowedRuleClassInfo_AllowedRuleClasses int32 - -const ( - AllowedRuleClassInfo_ANY AllowedRuleClassInfo_AllowedRuleClasses = 1 - AllowedRuleClassInfo_SPECIFIED AllowedRuleClassInfo_AllowedRuleClasses = 2 -) - -// Enum value maps for AllowedRuleClassInfo_AllowedRuleClasses. -var ( - AllowedRuleClassInfo_AllowedRuleClasses_name = map[int32]string{ - 1: "ANY", - 2: "SPECIFIED", - } - AllowedRuleClassInfo_AllowedRuleClasses_value = map[string]int32{ - "ANY": 1, - "SPECIFIED": 2, - } -) - -func (x AllowedRuleClassInfo_AllowedRuleClasses) Enum() *AllowedRuleClassInfo_AllowedRuleClasses { - p := new(AllowedRuleClassInfo_AllowedRuleClasses) - *p = x - return p -} - -func (x AllowedRuleClassInfo_AllowedRuleClasses) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AllowedRuleClassInfo_AllowedRuleClasses) Descriptor() protoreflect.EnumDescriptor { - return file_gitops_blaze_query_build_proto_enumTypes[4].Descriptor() -} - -func (AllowedRuleClassInfo_AllowedRuleClasses) Type() protoreflect.EnumType { - return &file_gitops_blaze_query_build_proto_enumTypes[4] -} - -func (x AllowedRuleClassInfo_AllowedRuleClasses) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Do not use. -func (x *AllowedRuleClassInfo_AllowedRuleClasses) UnmarshalJSON(b []byte) error { - num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) - if err != nil { - return err - } - *x = AllowedRuleClassInfo_AllowedRuleClasses(num) - return nil -} - -// Deprecated: Use AllowedRuleClassInfo_AllowedRuleClasses.Descriptor instead. -func (AllowedRuleClassInfo_AllowedRuleClasses) EnumDescriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{16, 0} -} - -type License struct { - state protoimpl.MessageState `protogen:"open.v1"` - LicenseType []string `protobuf:"bytes,1,rep,name=license_type,json=licenseType" json:"license_type,omitempty"` - Exception []string `protobuf:"bytes,2,rep,name=exception" json:"exception,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *License) Reset() { - *x = License{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *License) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*License) ProtoMessage() {} - -func (x *License) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use License.ProtoReflect.Descriptor instead. -func (*License) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{0} -} - -func (x *License) GetLicenseType() []string { - if x != nil { - return x.LicenseType - } - return nil -} - -func (x *License) GetException() []string { - if x != nil { - return x.Exception - } - return nil -} - -type StringDictEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StringDictEntry) Reset() { - *x = StringDictEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StringDictEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringDictEntry) ProtoMessage() {} - -func (x *StringDictEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringDictEntry.ProtoReflect.Descriptor instead. -func (*StringDictEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{1} -} - -func (x *StringDictEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *StringDictEntry) GetValue() string { - if x != nil && x.Value != nil { - return *x.Value - } - return "" -} - -type LabelDictUnaryEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LabelDictUnaryEntry) Reset() { - *x = LabelDictUnaryEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LabelDictUnaryEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelDictUnaryEntry) ProtoMessage() {} - -func (x *LabelDictUnaryEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelDictUnaryEntry.ProtoReflect.Descriptor instead. -func (*LabelDictUnaryEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{2} -} - -func (x *LabelDictUnaryEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *LabelDictUnaryEntry) GetValue() string { - if x != nil && x.Value != nil { - return *x.Value - } - return "" -} - -type LabelListDictEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LabelListDictEntry) Reset() { - *x = LabelListDictEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LabelListDictEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelListDictEntry) ProtoMessage() {} - -func (x *LabelListDictEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelListDictEntry.ProtoReflect.Descriptor instead. -func (*LabelListDictEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{3} -} - -func (x *LabelListDictEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *LabelListDictEntry) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type LabelKeyedStringDictEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value *string `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LabelKeyedStringDictEntry) Reset() { - *x = LabelKeyedStringDictEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LabelKeyedStringDictEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelKeyedStringDictEntry) ProtoMessage() {} - -func (x *LabelKeyedStringDictEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelKeyedStringDictEntry.ProtoReflect.Descriptor instead. -func (*LabelKeyedStringDictEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{4} -} - -func (x *LabelKeyedStringDictEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *LabelKeyedStringDictEntry) GetValue() string { - if x != nil && x.Value != nil { - return *x.Value - } - return "" -} - -type StringListDictEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value []string `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StringListDictEntry) Reset() { - *x = StringListDictEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StringListDictEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StringListDictEntry) ProtoMessage() {} - -func (x *StringListDictEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StringListDictEntry.ProtoReflect.Descriptor instead. -func (*StringListDictEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{5} -} - -func (x *StringListDictEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *StringListDictEntry) GetValue() []string { - if x != nil { - return x.Value - } - return nil -} - -type FilesetEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Source *string `protobuf:"bytes,1,req,name=source" json:"source,omitempty"` - DestinationDirectory *string `protobuf:"bytes,2,req,name=destination_directory,json=destinationDirectory" json:"destination_directory,omitempty"` - FilesPresent *bool `protobuf:"varint,7,opt,name=files_present,json=filesPresent" json:"files_present,omitempty"` - File []string `protobuf:"bytes,3,rep,name=file" json:"file,omitempty"` - Exclude []string `protobuf:"bytes,4,rep,name=exclude" json:"exclude,omitempty"` - SymlinkBehavior *FilesetEntry_SymlinkBehavior `protobuf:"varint,5,opt,name=symlink_behavior,json=symlinkBehavior,enum=blaze_query.FilesetEntry_SymlinkBehavior,def=1" json:"symlink_behavior,omitempty"` - StripPrefix *string `protobuf:"bytes,6,opt,name=strip_prefix,json=stripPrefix" json:"strip_prefix,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -// Default values for FilesetEntry fields. -const ( - Default_FilesetEntry_SymlinkBehavior = FilesetEntry_COPY -) - -func (x *FilesetEntry) Reset() { - *x = FilesetEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FilesetEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FilesetEntry) ProtoMessage() {} - -func (x *FilesetEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FilesetEntry.ProtoReflect.Descriptor instead. -func (*FilesetEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{6} -} - -func (x *FilesetEntry) GetSource() string { - if x != nil && x.Source != nil { - return *x.Source - } - return "" -} - -func (x *FilesetEntry) GetDestinationDirectory() string { - if x != nil && x.DestinationDirectory != nil { - return *x.DestinationDirectory - } - return "" -} - -func (x *FilesetEntry) GetFilesPresent() bool { - if x != nil && x.FilesPresent != nil { - return *x.FilesPresent - } - return false -} - -func (x *FilesetEntry) GetFile() []string { - if x != nil { - return x.File - } - return nil -} - -func (x *FilesetEntry) GetExclude() []string { - if x != nil { - return x.Exclude - } - return nil -} - -func (x *FilesetEntry) GetSymlinkBehavior() FilesetEntry_SymlinkBehavior { - if x != nil && x.SymlinkBehavior != nil { - return *x.SymlinkBehavior - } - return Default_FilesetEntry_SymlinkBehavior -} - -func (x *FilesetEntry) GetStripPrefix() string { - if x != nil && x.StripPrefix != nil { - return *x.StripPrefix - } - return "" -} - -type Attribute struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - ExplicitlySpecified *bool `protobuf:"varint,13,opt,name=explicitly_specified,json=explicitlySpecified" json:"explicitly_specified,omitempty"` - Nodep *bool `protobuf:"varint,20,opt,name=nodep" json:"nodep,omitempty"` - Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` - IntValue *int32 `protobuf:"varint,3,opt,name=int_value,json=intValue" json:"int_value,omitempty"` - StringValue *string `protobuf:"bytes,5,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - BooleanValue *bool `protobuf:"varint,14,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"` - TristateValue *Attribute_Tristate `protobuf:"varint,15,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"` - StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"` - License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"` - StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"` - FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"` - LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"` - StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"` - IntListValue []int32 `protobuf:"varint,17,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"` - LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,19,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"` - LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,22,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"` - SelectorList *Attribute_SelectorList `protobuf:"bytes,21,opt,name=selector_list,json=selectorList" json:"selector_list,omitempty"` - DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,18,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Attribute) Reset() { - *x = Attribute{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Attribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attribute) ProtoMessage() {} - -func (x *Attribute) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attribute.ProtoReflect.Descriptor instead. -func (*Attribute) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7} -} - -func (x *Attribute) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *Attribute) GetExplicitlySpecified() bool { - if x != nil && x.ExplicitlySpecified != nil { - return *x.ExplicitlySpecified - } - return false -} - -func (x *Attribute) GetNodep() bool { - if x != nil && x.Nodep != nil { - return *x.Nodep - } - return false -} - -func (x *Attribute) GetType() Attribute_Discriminator { - if x != nil && x.Type != nil { - return *x.Type - } - return Attribute_INTEGER -} - -func (x *Attribute) GetIntValue() int32 { - if x != nil && x.IntValue != nil { - return *x.IntValue - } - return 0 -} - -func (x *Attribute) GetStringValue() string { - if x != nil && x.StringValue != nil { - return *x.StringValue - } - return "" -} - -func (x *Attribute) GetBooleanValue() bool { - if x != nil && x.BooleanValue != nil { - return *x.BooleanValue - } - return false -} - -func (x *Attribute) GetTristateValue() Attribute_Tristate { - if x != nil && x.TristateValue != nil { - return *x.TristateValue - } - return Attribute_NO -} - -func (x *Attribute) GetStringListValue() []string { - if x != nil { - return x.StringListValue - } - return nil -} - -func (x *Attribute) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Attribute) GetStringDictValue() []*StringDictEntry { - if x != nil { - return x.StringDictValue - } - return nil -} - -func (x *Attribute) GetFilesetListValue() []*FilesetEntry { - if x != nil { - return x.FilesetListValue - } - return nil -} - -func (x *Attribute) GetLabelListDictValue() []*LabelListDictEntry { - if x != nil { - return x.LabelListDictValue - } - return nil -} - -func (x *Attribute) GetStringListDictValue() []*StringListDictEntry { - if x != nil { - return x.StringListDictValue - } - return nil -} - -func (x *Attribute) GetIntListValue() []int32 { - if x != nil { - return x.IntListValue - } - return nil -} - -func (x *Attribute) GetLabelDictUnaryValue() []*LabelDictUnaryEntry { - if x != nil { - return x.LabelDictUnaryValue - } - return nil -} - -func (x *Attribute) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry { - if x != nil { - return x.LabelKeyedStringDictValue - } - return nil -} - -func (x *Attribute) GetSelectorList() *Attribute_SelectorList { - if x != nil { - return x.SelectorList - } - return nil -} - -func (x *Attribute) GetDEPRECATEDStringDictUnaryValue() [][]byte { - if x != nil { - return x.DEPRECATEDStringDictUnaryValue - } - return nil -} - -type Rule struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - RuleClass *string `protobuf:"bytes,2,req,name=rule_class,json=ruleClass" json:"rule_class,omitempty"` - Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` - Attribute []*Attribute `protobuf:"bytes,4,rep,name=attribute" json:"attribute,omitempty"` - RuleInput []string `protobuf:"bytes,5,rep,name=rule_input,json=ruleInput" json:"rule_input,omitempty"` - RuleOutput []string `protobuf:"bytes,6,rep,name=rule_output,json=ruleOutput" json:"rule_output,omitempty"` - DefaultSetting []string `protobuf:"bytes,7,rep,name=default_setting,json=defaultSetting" json:"default_setting,omitempty"` - PublicByDefault *bool `protobuf:"varint,9,opt,name=public_by_default,json=publicByDefault" json:"public_by_default,omitempty"` - IsSkylark *bool `protobuf:"varint,10,opt,name=is_skylark,json=isSkylark" json:"is_skylark,omitempty"` - SkylarkEnvironmentHashCode *string `protobuf:"bytes,12,opt,name=skylark_environment_hash_code,json=skylarkEnvironmentHashCode" json:"skylark_environment_hash_code,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Rule) Reset() { - *x = Rule{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Rule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Rule) ProtoMessage() {} - -func (x *Rule) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Rule.ProtoReflect.Descriptor instead. -func (*Rule) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{8} -} - -func (x *Rule) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *Rule) GetRuleClass() string { - if x != nil && x.RuleClass != nil { - return *x.RuleClass - } - return "" -} - -func (x *Rule) GetLocation() string { - if x != nil && x.Location != nil { - return *x.Location - } - return "" -} - -func (x *Rule) GetAttribute() []*Attribute { - if x != nil { - return x.Attribute - } - return nil -} - -func (x *Rule) GetRuleInput() []string { - if x != nil { - return x.RuleInput - } - return nil -} - -func (x *Rule) GetRuleOutput() []string { - if x != nil { - return x.RuleOutput - } - return nil -} - -func (x *Rule) GetDefaultSetting() []string { - if x != nil { - return x.DefaultSetting - } - return nil -} - -func (x *Rule) GetPublicByDefault() bool { - if x != nil && x.PublicByDefault != nil { - return *x.PublicByDefault - } - return false -} - -func (x *Rule) GetIsSkylark() bool { - if x != nil && x.IsSkylark != nil { - return *x.IsSkylark - } - return false -} - -func (x *Rule) GetSkylarkEnvironmentHashCode() string { - if x != nil && x.SkylarkEnvironmentHashCode != nil { - return *x.SkylarkEnvironmentHashCode - } - return "" -} - -type RuleSummary struct { - state protoimpl.MessageState `protogen:"open.v1"` - Rule *Rule `protobuf:"bytes,1,req,name=rule" json:"rule,omitempty"` - Dependency []*Rule `protobuf:"bytes,2,rep,name=dependency" json:"dependency,omitempty"` - Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RuleSummary) Reset() { - *x = RuleSummary{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RuleSummary) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuleSummary) ProtoMessage() {} - -func (x *RuleSummary) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuleSummary.ProtoReflect.Descriptor instead. -func (*RuleSummary) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{9} -} - -func (x *RuleSummary) GetRule() *Rule { - if x != nil { - return x.Rule - } - return nil -} - -func (x *RuleSummary) GetDependency() []*Rule { - if x != nil { - return x.Dependency - } - return nil -} - -func (x *RuleSummary) GetLocation() string { - if x != nil && x.Location != nil { - return *x.Location - } - return "" -} - -type PackageGroup struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - ContainedPackage []string `protobuf:"bytes,2,rep,name=contained_package,json=containedPackage" json:"contained_package,omitempty"` - IncludedPackageGroup []string `protobuf:"bytes,3,rep,name=included_package_group,json=includedPackageGroup" json:"included_package_group,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PackageGroup) Reset() { - *x = PackageGroup{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PackageGroup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PackageGroup) ProtoMessage() {} - -func (x *PackageGroup) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PackageGroup.ProtoReflect.Descriptor instead. -func (*PackageGroup) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{10} -} - -func (x *PackageGroup) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *PackageGroup) GetContainedPackage() []string { - if x != nil { - return x.ContainedPackage - } - return nil -} - -func (x *PackageGroup) GetIncludedPackageGroup() []string { - if x != nil { - return x.IncludedPackageGroup - } - return nil -} - -type EnvironmentGroup struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - Environment []string `protobuf:"bytes,2,rep,name=environment" json:"environment,omitempty"` - Default []string `protobuf:"bytes,3,rep,name=default" json:"default,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EnvironmentGroup) Reset() { - *x = EnvironmentGroup{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EnvironmentGroup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EnvironmentGroup) ProtoMessage() {} - -func (x *EnvironmentGroup) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EnvironmentGroup.ProtoReflect.Descriptor instead. -func (*EnvironmentGroup) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{11} -} - -func (x *EnvironmentGroup) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *EnvironmentGroup) GetEnvironment() []string { - if x != nil { - return x.Environment - } - return nil -} - -func (x *EnvironmentGroup) GetDefault() []string { - if x != nil { - return x.Default - } - return nil -} - -type SourceFile struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - Location *string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"` - Subinclude []string `protobuf:"bytes,3,rep,name=subinclude" json:"subinclude,omitempty"` - PackageGroup []string `protobuf:"bytes,4,rep,name=package_group,json=packageGroup" json:"package_group,omitempty"` - VisibilityLabel []string `protobuf:"bytes,5,rep,name=visibility_label,json=visibilityLabel" json:"visibility_label,omitempty"` - Feature []string `protobuf:"bytes,6,rep,name=feature" json:"feature,omitempty"` - License *License `protobuf:"bytes,8,opt,name=license" json:"license,omitempty"` - PackageContainsErrors *bool `protobuf:"varint,9,opt,name=package_contains_errors,json=packageContainsErrors" json:"package_contains_errors,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SourceFile) Reset() { - *x = SourceFile{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SourceFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SourceFile) ProtoMessage() {} - -func (x *SourceFile) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead. -func (*SourceFile) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{12} -} - -func (x *SourceFile) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *SourceFile) GetLocation() string { - if x != nil && x.Location != nil { - return *x.Location - } - return "" -} - -func (x *SourceFile) GetSubinclude() []string { - if x != nil { - return x.Subinclude - } - return nil -} - -func (x *SourceFile) GetPackageGroup() []string { - if x != nil { - return x.PackageGroup - } - return nil -} - -func (x *SourceFile) GetVisibilityLabel() []string { - if x != nil { - return x.VisibilityLabel - } - return nil -} - -func (x *SourceFile) GetFeature() []string { - if x != nil { - return x.Feature - } - return nil -} - -func (x *SourceFile) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *SourceFile) GetPackageContainsErrors() bool { - if x != nil && x.PackageContainsErrors != nil { - return *x.PackageContainsErrors - } - return false -} - -type GeneratedFile struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - GeneratingRule *string `protobuf:"bytes,2,req,name=generating_rule,json=generatingRule" json:"generating_rule,omitempty"` - Location *string `protobuf:"bytes,3,opt,name=location" json:"location,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GeneratedFile) Reset() { - *x = GeneratedFile{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GeneratedFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GeneratedFile) ProtoMessage() {} - -func (x *GeneratedFile) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GeneratedFile.ProtoReflect.Descriptor instead. -func (*GeneratedFile) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{13} -} - -func (x *GeneratedFile) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *GeneratedFile) GetGeneratingRule() string { - if x != nil && x.GeneratingRule != nil { - return *x.GeneratingRule - } - return "" -} - -func (x *GeneratedFile) GetLocation() string { - if x != nil && x.Location != nil { - return *x.Location - } - return "" -} - -type Target struct { - state protoimpl.MessageState `protogen:"open.v1"` - Type *Target_Discriminator `protobuf:"varint,1,req,name=type,enum=blaze_query.Target_Discriminator" json:"type,omitempty"` - Rule *Rule `protobuf:"bytes,2,opt,name=rule" json:"rule,omitempty"` - SourceFile *SourceFile `protobuf:"bytes,3,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - GeneratedFile *GeneratedFile `protobuf:"bytes,4,opt,name=generated_file,json=generatedFile" json:"generated_file,omitempty"` - PackageGroup *PackageGroup `protobuf:"bytes,5,opt,name=package_group,json=packageGroup" json:"package_group,omitempty"` - EnvironmentGroup *EnvironmentGroup `protobuf:"bytes,6,opt,name=environment_group,json=environmentGroup" json:"environment_group,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Target) Reset() { - *x = Target{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Target) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Target) ProtoMessage() {} - -func (x *Target) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Target.ProtoReflect.Descriptor instead. -func (*Target) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{14} -} - -func (x *Target) GetType() Target_Discriminator { - if x != nil && x.Type != nil { - return *x.Type - } - return Target_RULE -} - -func (x *Target) GetRule() *Rule { - if x != nil { - return x.Rule - } - return nil -} - -func (x *Target) GetSourceFile() *SourceFile { - if x != nil { - return x.SourceFile - } - return nil -} - -func (x *Target) GetGeneratedFile() *GeneratedFile { - if x != nil { - return x.GeneratedFile - } - return nil -} - -func (x *Target) GetPackageGroup() *PackageGroup { - if x != nil { - return x.PackageGroup - } - return nil -} - -func (x *Target) GetEnvironmentGroup() *EnvironmentGroup { - if x != nil { - return x.EnvironmentGroup - } - return nil -} - -type QueryResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - Target []*Target `protobuf:"bytes,1,rep,name=target" json:"target,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *QueryResult) Reset() { - *x = QueryResult{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *QueryResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryResult) ProtoMessage() {} - -func (x *QueryResult) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use QueryResult.ProtoReflect.Descriptor instead. -func (*QueryResult) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{15} -} - -func (x *QueryResult) GetTarget() []*Target { - if x != nil { - return x.Target - } - return nil -} - -type AllowedRuleClassInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - Policy *AllowedRuleClassInfo_AllowedRuleClasses `protobuf:"varint,1,req,name=policy,enum=blaze_query.AllowedRuleClassInfo_AllowedRuleClasses" json:"policy,omitempty"` - AllowedRuleClass []string `protobuf:"bytes,2,rep,name=allowed_rule_class,json=allowedRuleClass" json:"allowed_rule_class,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AllowedRuleClassInfo) Reset() { - *x = AllowedRuleClassInfo{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AllowedRuleClassInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AllowedRuleClassInfo) ProtoMessage() {} - -func (x *AllowedRuleClassInfo) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AllowedRuleClassInfo.ProtoReflect.Descriptor instead. -func (*AllowedRuleClassInfo) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{16} -} - -func (x *AllowedRuleClassInfo) GetPolicy() AllowedRuleClassInfo_AllowedRuleClasses { - if x != nil && x.Policy != nil { - return *x.Policy - } - return AllowedRuleClassInfo_ANY -} - -func (x *AllowedRuleClassInfo) GetAllowedRuleClass() []string { - if x != nil { - return x.AllowedRuleClass - } - return nil -} - -type AttributeDefinition struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - Type *Attribute_Discriminator `protobuf:"varint,2,req,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` - Mandatory *bool `protobuf:"varint,3,opt,name=mandatory" json:"mandatory,omitempty"` - AllowedRuleClasses *AllowedRuleClassInfo `protobuf:"bytes,4,opt,name=allowed_rule_classes,json=allowedRuleClasses" json:"allowed_rule_classes,omitempty"` - Documentation *string `protobuf:"bytes,5,opt,name=documentation" json:"documentation,omitempty"` - AllowEmpty *bool `protobuf:"varint,6,opt,name=allow_empty,json=allowEmpty" json:"allow_empty,omitempty"` - AllowSingleFile *bool `protobuf:"varint,7,opt,name=allow_single_file,json=allowSingleFile" json:"allow_single_file,omitempty"` - Default *AttributeValue `protobuf:"bytes,9,opt,name=default" json:"default,omitempty"` - Executable *bool `protobuf:"varint,10,opt,name=executable" json:"executable,omitempty"` - Configurable *bool `protobuf:"varint,11,opt,name=configurable" json:"configurable,omitempty"` - Nodep *bool `protobuf:"varint,12,opt,name=nodep" json:"nodep,omitempty"` - CfgIsHost *bool `protobuf:"varint,13,opt,name=cfg_is_host,json=cfgIsHost" json:"cfg_is_host,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AttributeDefinition) Reset() { - *x = AttributeDefinition{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AttributeDefinition) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AttributeDefinition) ProtoMessage() {} - -func (x *AttributeDefinition) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AttributeDefinition.ProtoReflect.Descriptor instead. -func (*AttributeDefinition) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{17} -} - -func (x *AttributeDefinition) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *AttributeDefinition) GetType() Attribute_Discriminator { - if x != nil && x.Type != nil { - return *x.Type - } - return Attribute_INTEGER -} - -func (x *AttributeDefinition) GetMandatory() bool { - if x != nil && x.Mandatory != nil { - return *x.Mandatory - } - return false -} - -func (x *AttributeDefinition) GetAllowedRuleClasses() *AllowedRuleClassInfo { - if x != nil { - return x.AllowedRuleClasses - } - return nil -} - -func (x *AttributeDefinition) GetDocumentation() string { - if x != nil && x.Documentation != nil { - return *x.Documentation - } - return "" -} - -func (x *AttributeDefinition) GetAllowEmpty() bool { - if x != nil && x.AllowEmpty != nil { - return *x.AllowEmpty - } - return false -} - -func (x *AttributeDefinition) GetAllowSingleFile() bool { - if x != nil && x.AllowSingleFile != nil { - return *x.AllowSingleFile - } - return false -} - -func (x *AttributeDefinition) GetDefault() *AttributeValue { - if x != nil { - return x.Default - } - return nil -} - -func (x *AttributeDefinition) GetExecutable() bool { - if x != nil && x.Executable != nil { - return *x.Executable - } - return false -} - -func (x *AttributeDefinition) GetConfigurable() bool { - if x != nil && x.Configurable != nil { - return *x.Configurable - } - return false -} - -func (x *AttributeDefinition) GetNodep() bool { - if x != nil && x.Nodep != nil { - return *x.Nodep - } - return false -} - -func (x *AttributeDefinition) GetCfgIsHost() bool { - if x != nil && x.CfgIsHost != nil { - return *x.CfgIsHost - } - return false -} - -type AttributeValue struct { - state protoimpl.MessageState `protogen:"open.v1"` - Int *int32 `protobuf:"varint,1,opt,name=int" json:"int,omitempty"` - String_ *string `protobuf:"bytes,2,opt,name=string" json:"string,omitempty"` - Bool *bool `protobuf:"varint,3,opt,name=bool" json:"bool,omitempty"` - List []*AttributeValue `protobuf:"bytes,4,rep,name=list" json:"list,omitempty"` - Dict []*AttributeValue_DictEntry `protobuf:"bytes,5,rep,name=dict" json:"dict,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AttributeValue) Reset() { - *x = AttributeValue{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AttributeValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AttributeValue) ProtoMessage() {} - -func (x *AttributeValue) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AttributeValue.ProtoReflect.Descriptor instead. -func (*AttributeValue) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{18} -} - -func (x *AttributeValue) GetInt() int32 { - if x != nil && x.Int != nil { - return *x.Int - } - return 0 -} - -func (x *AttributeValue) GetString_() string { - if x != nil && x.String_ != nil { - return *x.String_ - } - return "" -} - -func (x *AttributeValue) GetBool() bool { - if x != nil && x.Bool != nil { - return *x.Bool - } - return false -} - -func (x *AttributeValue) GetList() []*AttributeValue { - if x != nil { - return x.List - } - return nil -} - -func (x *AttributeValue) GetDict() []*AttributeValue_DictEntry { - if x != nil { - return x.Dict - } - return nil -} - -type RuleDefinition struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"` - Attribute []*AttributeDefinition `protobuf:"bytes,2,rep,name=attribute" json:"attribute,omitempty"` - Documentation *string `protobuf:"bytes,3,opt,name=documentation" json:"documentation,omitempty"` - Label *string `protobuf:"bytes,4,opt,name=label" json:"label,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RuleDefinition) Reset() { - *x = RuleDefinition{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RuleDefinition) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RuleDefinition) ProtoMessage() {} - -func (x *RuleDefinition) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RuleDefinition.ProtoReflect.Descriptor instead. -func (*RuleDefinition) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{19} -} - -func (x *RuleDefinition) GetName() string { - if x != nil && x.Name != nil { - return *x.Name - } - return "" -} - -func (x *RuleDefinition) GetAttribute() []*AttributeDefinition { - if x != nil { - return x.Attribute - } - return nil -} - -func (x *RuleDefinition) GetDocumentation() string { - if x != nil && x.Documentation != nil { - return *x.Documentation - } - return "" -} - -func (x *RuleDefinition) GetLabel() string { - if x != nil && x.Label != nil { - return *x.Label - } - return "" -} - -type BuildLanguage struct { - state protoimpl.MessageState `protogen:"open.v1"` - Rule []*RuleDefinition `protobuf:"bytes,1,rep,name=rule" json:"rule,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BuildLanguage) Reset() { - *x = BuildLanguage{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BuildLanguage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BuildLanguage) ProtoMessage() {} - -func (x *BuildLanguage) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BuildLanguage.ProtoReflect.Descriptor instead. -func (*BuildLanguage) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{20} -} - -func (x *BuildLanguage) GetRule() []*RuleDefinition { - if x != nil { - return x.Rule - } - return nil -} - -type Attribute_SelectorEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Label *string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"` - IsDefaultValue *bool `protobuf:"varint,16,opt,name=is_default_value,json=isDefaultValue" json:"is_default_value,omitempty"` - IntValue *int32 `protobuf:"varint,2,opt,name=int_value,json=intValue" json:"int_value,omitempty"` - StringValue *string `protobuf:"bytes,3,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - BooleanValue *bool `protobuf:"varint,4,opt,name=boolean_value,json=booleanValue" json:"boolean_value,omitempty"` - TristateValue *Attribute_Tristate `protobuf:"varint,5,opt,name=tristate_value,json=tristateValue,enum=blaze_query.Attribute_Tristate" json:"tristate_value,omitempty"` - StringListValue []string `protobuf:"bytes,6,rep,name=string_list_value,json=stringListValue" json:"string_list_value,omitempty"` - License *License `protobuf:"bytes,7,opt,name=license" json:"license,omitempty"` - StringDictValue []*StringDictEntry `protobuf:"bytes,8,rep,name=string_dict_value,json=stringDictValue" json:"string_dict_value,omitempty"` - FilesetListValue []*FilesetEntry `protobuf:"bytes,9,rep,name=fileset_list_value,json=filesetListValue" json:"fileset_list_value,omitempty"` - LabelListDictValue []*LabelListDictEntry `protobuf:"bytes,10,rep,name=label_list_dict_value,json=labelListDictValue" json:"label_list_dict_value,omitempty"` - StringListDictValue []*StringListDictEntry `protobuf:"bytes,11,rep,name=string_list_dict_value,json=stringListDictValue" json:"string_list_dict_value,omitempty"` - IntListValue []int32 `protobuf:"varint,13,rep,name=int_list_value,json=intListValue" json:"int_list_value,omitempty"` - LabelDictUnaryValue []*LabelDictUnaryEntry `protobuf:"bytes,15,rep,name=label_dict_unary_value,json=labelDictUnaryValue" json:"label_dict_unary_value,omitempty"` - LabelKeyedStringDictValue []*LabelKeyedStringDictEntry `protobuf:"bytes,17,rep,name=label_keyed_string_dict_value,json=labelKeyedStringDictValue" json:"label_keyed_string_dict_value,omitempty"` - DEPRECATEDStringDictUnaryValue [][]byte `protobuf:"bytes,14,rep,name=DEPRECATED_string_dict_unary_value,json=DEPRECATEDStringDictUnaryValue" json:"DEPRECATED_string_dict_unary_value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Attribute_SelectorEntry) Reset() { - *x = Attribute_SelectorEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Attribute_SelectorEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attribute_SelectorEntry) ProtoMessage() {} - -func (x *Attribute_SelectorEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attribute_SelectorEntry.ProtoReflect.Descriptor instead. -func (*Attribute_SelectorEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7, 0} -} - -func (x *Attribute_SelectorEntry) GetLabel() string { - if x != nil && x.Label != nil { - return *x.Label - } - return "" -} - -func (x *Attribute_SelectorEntry) GetIsDefaultValue() bool { - if x != nil && x.IsDefaultValue != nil { - return *x.IsDefaultValue - } - return false -} - -func (x *Attribute_SelectorEntry) GetIntValue() int32 { - if x != nil && x.IntValue != nil { - return *x.IntValue - } - return 0 -} - -func (x *Attribute_SelectorEntry) GetStringValue() string { - if x != nil && x.StringValue != nil { - return *x.StringValue - } - return "" -} - -func (x *Attribute_SelectorEntry) GetBooleanValue() bool { - if x != nil && x.BooleanValue != nil { - return *x.BooleanValue - } - return false -} - -func (x *Attribute_SelectorEntry) GetTristateValue() Attribute_Tristate { - if x != nil && x.TristateValue != nil { - return *x.TristateValue - } - return Attribute_NO -} - -func (x *Attribute_SelectorEntry) GetStringListValue() []string { - if x != nil { - return x.StringListValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetLicense() *License { - if x != nil { - return x.License - } - return nil -} - -func (x *Attribute_SelectorEntry) GetStringDictValue() []*StringDictEntry { - if x != nil { - return x.StringDictValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetFilesetListValue() []*FilesetEntry { - if x != nil { - return x.FilesetListValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetLabelListDictValue() []*LabelListDictEntry { - if x != nil { - return x.LabelListDictValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetStringListDictValue() []*StringListDictEntry { - if x != nil { - return x.StringListDictValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetIntListValue() []int32 { - if x != nil { - return x.IntListValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetLabelDictUnaryValue() []*LabelDictUnaryEntry { - if x != nil { - return x.LabelDictUnaryValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetLabelKeyedStringDictValue() []*LabelKeyedStringDictEntry { - if x != nil { - return x.LabelKeyedStringDictValue - } - return nil -} - -func (x *Attribute_SelectorEntry) GetDEPRECATEDStringDictUnaryValue() [][]byte { - if x != nil { - return x.DEPRECATEDStringDictUnaryValue - } - return nil -} - -type Attribute_Selector struct { - state protoimpl.MessageState `protogen:"open.v1"` - Entries []*Attribute_SelectorEntry `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"` - HasDefaultValue *bool `protobuf:"varint,2,opt,name=has_default_value,json=hasDefaultValue" json:"has_default_value,omitempty"` - NoMatchError *string `protobuf:"bytes,3,opt,name=no_match_error,json=noMatchError" json:"no_match_error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Attribute_Selector) Reset() { - *x = Attribute_Selector{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Attribute_Selector) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attribute_Selector) ProtoMessage() {} - -func (x *Attribute_Selector) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attribute_Selector.ProtoReflect.Descriptor instead. -func (*Attribute_Selector) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7, 1} -} - -func (x *Attribute_Selector) GetEntries() []*Attribute_SelectorEntry { - if x != nil { - return x.Entries - } - return nil -} - -func (x *Attribute_Selector) GetHasDefaultValue() bool { - if x != nil && x.HasDefaultValue != nil { - return *x.HasDefaultValue - } - return false -} - -func (x *Attribute_Selector) GetNoMatchError() string { - if x != nil && x.NoMatchError != nil { - return *x.NoMatchError - } - return "" -} - -type Attribute_SelectorList struct { - state protoimpl.MessageState `protogen:"open.v1"` - Type *Attribute_Discriminator `protobuf:"varint,1,opt,name=type,enum=blaze_query.Attribute_Discriminator" json:"type,omitempty"` - Elements []*Attribute_Selector `protobuf:"bytes,2,rep,name=elements" json:"elements,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Attribute_SelectorList) Reset() { - *x = Attribute_SelectorList{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Attribute_SelectorList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Attribute_SelectorList) ProtoMessage() {} - -func (x *Attribute_SelectorList) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Attribute_SelectorList.ProtoReflect.Descriptor instead. -func (*Attribute_SelectorList) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{7, 2} -} - -func (x *Attribute_SelectorList) GetType() Attribute_Discriminator { - if x != nil && x.Type != nil { - return *x.Type - } - return Attribute_INTEGER -} - -func (x *Attribute_SelectorList) GetElements() []*Attribute_Selector { - if x != nil { - return x.Elements - } - return nil -} - -type AttributeValue_DictEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` - Value *AttributeValue `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AttributeValue_DictEntry) Reset() { - *x = AttributeValue_DictEntry{} - mi := &file_gitops_blaze_query_build_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AttributeValue_DictEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AttributeValue_DictEntry) ProtoMessage() {} - -func (x *AttributeValue_DictEntry) ProtoReflect() protoreflect.Message { - mi := &file_gitops_blaze_query_build_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AttributeValue_DictEntry.ProtoReflect.Descriptor instead. -func (*AttributeValue_DictEntry) Descriptor() ([]byte, []int) { - return file_gitops_blaze_query_build_proto_rawDescGZIP(), []int{18, 0} -} - -func (x *AttributeValue_DictEntry) GetKey() string { - if x != nil && x.Key != nil { - return *x.Key - } - return "" -} - -func (x *AttributeValue_DictEntry) GetValue() *AttributeValue { - if x != nil { - return x.Value - } - return nil -} - -var File_gitops_blaze_query_build_proto protoreflect.FileDescriptor - -const file_gitops_blaze_query_build_proto_rawDesc = "" + - "\n" + - "\x1egitops/blaze_query/build.proto\x12\vblaze_query\"J\n" + - "\aLicense\x12!\n" + - "\flicense_type\x18\x01 \x03(\tR\vlicenseType\x12\x1c\n" + - "\texception\x18\x02 \x03(\tR\texception\"9\n" + - "\x0fStringDictEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x02(\tR\x05value\"=\n" + - "\x13LabelDictUnaryEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x02(\tR\x05value\"<\n" + - "\x12LabelListDictEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x03(\tR\x05value\"C\n" + - "\x19LabelKeyedStringDictEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x02(\tR\x05value\"=\n" + - "\x13StringListDictEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x03(\tR\x05value\"\xdb\x02\n" + - "\fFilesetEntry\x12\x16\n" + - "\x06source\x18\x01 \x02(\tR\x06source\x123\n" + - "\x15destination_directory\x18\x02 \x02(\tR\x14destinationDirectory\x12#\n" + - "\rfiles_present\x18\a \x01(\bR\ffilesPresent\x12\x12\n" + - "\x04file\x18\x03 \x03(\tR\x04file\x12\x18\n" + - "\aexclude\x18\x04 \x03(\tR\aexclude\x12Z\n" + - "\x10symlink_behavior\x18\x05 \x01(\x0e2).blaze_query.FilesetEntry.SymlinkBehavior:\x04COPYR\x0fsymlinkBehavior\x12!\n" + - "\fstrip_prefix\x18\x06 \x01(\tR\vstripPrefix\",\n" + - "\x0fSymlinkBehavior\x12\b\n" + - "\x04COPY\x10\x01\x12\x0f\n" + - "\vDEREFERENCE\x10\x02\"\x9f\x16\n" + - "\tAttribute\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x121\n" + - "\x14explicitly_specified\x18\r \x01(\bR\x13explicitlySpecified\x12\x14\n" + - "\x05nodep\x18\x14 \x01(\bR\x05nodep\x128\n" + - "\x04type\x18\x02 \x02(\x0e2$.blaze_query.Attribute.DiscriminatorR\x04type\x12\x1b\n" + - "\tint_value\x18\x03 \x01(\x05R\bintValue\x12!\n" + - "\fstring_value\x18\x05 \x01(\tR\vstringValue\x12#\n" + - "\rboolean_value\x18\x0e \x01(\bR\fbooleanValue\x12F\n" + - "\x0etristate_value\x18\x0f \x01(\x0e2\x1f.blaze_query.Attribute.TristateR\rtristateValue\x12*\n" + - "\x11string_list_value\x18\x06 \x03(\tR\x0fstringListValue\x12.\n" + - "\alicense\x18\a \x01(\v2\x14.blaze_query.LicenseR\alicense\x12H\n" + - "\x11string_dict_value\x18\b \x03(\v2\x1c.blaze_query.StringDictEntryR\x0fstringDictValue\x12G\n" + - "\x12fileset_list_value\x18\t \x03(\v2\x19.blaze_query.FilesetEntryR\x10filesetListValue\x12R\n" + - "\x15label_list_dict_value\x18\n" + - " \x03(\v2\x1f.blaze_query.LabelListDictEntryR\x12labelListDictValue\x12U\n" + - "\x16string_list_dict_value\x18\v \x03(\v2 .blaze_query.StringListDictEntryR\x13stringListDictValue\x12$\n" + - "\x0eint_list_value\x18\x11 \x03(\x05R\fintListValue\x12U\n" + - "\x16label_dict_unary_value\x18\x13 \x03(\v2 .blaze_query.LabelDictUnaryEntryR\x13labelDictUnaryValue\x12h\n" + - "\x1dlabel_keyed_string_dict_value\x18\x16 \x03(\v2&.blaze_query.LabelKeyedStringDictEntryR\x19labelKeyedStringDictValue\x12H\n" + - "\rselector_list\x18\x15 \x01(\v2#.blaze_query.Attribute.SelectorListR\fselectorList\x12J\n" + - "\"DEPRECATED_string_dict_unary_value\x18\x12 \x03(\fR\x1eDEPRECATEDStringDictUnaryValue\x1a\xcf\a\n" + - "\rSelectorEntry\x12\x14\n" + - "\x05label\x18\x01 \x01(\tR\x05label\x12(\n" + - "\x10is_default_value\x18\x10 \x01(\bR\x0eisDefaultValue\x12\x1b\n" + - "\tint_value\x18\x02 \x01(\x05R\bintValue\x12!\n" + - "\fstring_value\x18\x03 \x01(\tR\vstringValue\x12#\n" + - "\rboolean_value\x18\x04 \x01(\bR\fbooleanValue\x12F\n" + - "\x0etristate_value\x18\x05 \x01(\x0e2\x1f.blaze_query.Attribute.TristateR\rtristateValue\x12*\n" + - "\x11string_list_value\x18\x06 \x03(\tR\x0fstringListValue\x12.\n" + - "\alicense\x18\a \x01(\v2\x14.blaze_query.LicenseR\alicense\x12H\n" + - "\x11string_dict_value\x18\b \x03(\v2\x1c.blaze_query.StringDictEntryR\x0fstringDictValue\x12G\n" + - "\x12fileset_list_value\x18\t \x03(\v2\x19.blaze_query.FilesetEntryR\x10filesetListValue\x12R\n" + - "\x15label_list_dict_value\x18\n" + - " \x03(\v2\x1f.blaze_query.LabelListDictEntryR\x12labelListDictValue\x12U\n" + - "\x16string_list_dict_value\x18\v \x03(\v2 .blaze_query.StringListDictEntryR\x13stringListDictValue\x12$\n" + - "\x0eint_list_value\x18\r \x03(\x05R\fintListValue\x12U\n" + - "\x16label_dict_unary_value\x18\x0f \x03(\v2 .blaze_query.LabelDictUnaryEntryR\x13labelDictUnaryValue\x12h\n" + - "\x1dlabel_keyed_string_dict_value\x18\x11 \x03(\v2&.blaze_query.LabelKeyedStringDictEntryR\x19labelKeyedStringDictValue\x12J\n" + - "\"DEPRECATED_string_dict_unary_value\x18\x0e \x03(\fR\x1eDEPRECATEDStringDictUnaryValueJ\x04\b\f\x10\r\x1a\x9c\x01\n" + - "\bSelector\x12>\n" + - "\aentries\x18\x01 \x03(\v2$.blaze_query.Attribute.SelectorEntryR\aentries\x12*\n" + - "\x11has_default_value\x18\x02 \x01(\bR\x0fhasDefaultValue\x12$\n" + - "\x0eno_match_error\x18\x03 \x01(\tR\fnoMatchError\x1a\x85\x01\n" + - "\fSelectorList\x128\n" + - "\x04type\x18\x01 \x01(\x0e2$.blaze_query.Attribute.DiscriminatorR\x04type\x12;\n" + - "\belements\x18\x02 \x03(\v2\x1f.blaze_query.Attribute.SelectorR\belements\"\x8a\x03\n" + - "\rDiscriminator\x12\v\n" + - "\aINTEGER\x10\x01\x12\n" + - "\n" + - "\x06STRING\x10\x02\x12\t\n" + - "\x05LABEL\x10\x03\x12\n" + - "\n" + - "\x06OUTPUT\x10\x04\x12\x0f\n" + - "\vSTRING_LIST\x10\x05\x12\x0e\n" + - "\n" + - "LABEL_LIST\x10\x06\x12\x0f\n" + - "\vOUTPUT_LIST\x10\a\x12\x14\n" + - "\x10DISTRIBUTION_SET\x10\b\x12\v\n" + - "\aLICENSE\x10\t\x12\x0f\n" + - "\vSTRING_DICT\x10\n" + - "\x12\x16\n" + - "\x12FILESET_ENTRY_LIST\x10\v\x12\x13\n" + - "\x0fLABEL_LIST_DICT\x10\f\x12\x14\n" + - "\x10STRING_LIST_DICT\x10\r\x12\v\n" + - "\aBOOLEAN\x10\x0e\x12\f\n" + - "\bTRISTATE\x10\x0f\x12\x10\n" + - "\fINTEGER_LIST\x10\x10\x12\v\n" + - "\aUNKNOWN\x10\x12\x12\x14\n" + - "\x10LABEL_DICT_UNARY\x10\x13\x12\x11\n" + - "\rSELECTOR_LIST\x10\x14\x12\x1b\n" + - "\x17LABEL_KEYED_STRING_DICT\x10\x15\x12 \n" + - "\x1cDEPRECATED_STRING_DICT_UNARY\x10\x11\"%\n" + - "\bTristate\x12\x06\n" + - "\x02NO\x10\x00\x12\a\n" + - "\x03YES\x10\x01\x12\b\n" + - "\x04AUTO\x10\x02J\x04\b\f\x10\rJ\x04\b\x10\x10\x11\"\x8e\x03\n" + - "\x04Rule\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12\x1d\n" + - "\n" + - "rule_class\x18\x02 \x02(\tR\truleClass\x12\x1a\n" + - "\blocation\x18\x03 \x01(\tR\blocation\x124\n" + - "\tattribute\x18\x04 \x03(\v2\x16.blaze_query.AttributeR\tattribute\x12\x1d\n" + - "\n" + - "rule_input\x18\x05 \x03(\tR\truleInput\x12\x1f\n" + - "\vrule_output\x18\x06 \x03(\tR\n" + - "ruleOutput\x12'\n" + - "\x0fdefault_setting\x18\a \x03(\tR\x0edefaultSetting\x12*\n" + - "\x11public_by_default\x18\t \x01(\bR\x0fpublicByDefault\x12\x1d\n" + - "\n" + - "is_skylark\x18\n" + - " \x01(\bR\tisSkylark\x12A\n" + - "\x1dskylark_environment_hash_code\x18\f \x01(\tR\x1askylarkEnvironmentHashCodeJ\x04\b\b\x10\tJ\x04\b\v\x10\f\"\x83\x01\n" + - "\vRuleSummary\x12%\n" + - "\x04rule\x18\x01 \x02(\v2\x11.blaze_query.RuleR\x04rule\x121\n" + - "\n" + - "dependency\x18\x02 \x03(\v2\x11.blaze_query.RuleR\n" + - "dependency\x12\x1a\n" + - "\blocation\x18\x03 \x01(\tR\blocation\"\x8b\x01\n" + - "\fPackageGroup\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12+\n" + - "\x11contained_package\x18\x02 \x03(\tR\x10containedPackage\x124\n" + - "\x16included_package_group\x18\x03 \x03(\tR\x14includedPackageGroupJ\x04\b\x04\x10\x05\"b\n" + - "\x10EnvironmentGroup\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12 \n" + - "\venvironment\x18\x02 \x03(\tR\venvironment\x12\x18\n" + - "\adefault\x18\x03 \x03(\tR\adefault\"\xb4\x02\n" + - "\n" + - "SourceFile\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12\x1a\n" + - "\blocation\x18\x02 \x01(\tR\blocation\x12\x1e\n" + - "\n" + - "subinclude\x18\x03 \x03(\tR\n" + - "subinclude\x12#\n" + - "\rpackage_group\x18\x04 \x03(\tR\fpackageGroup\x12)\n" + - "\x10visibility_label\x18\x05 \x03(\tR\x0fvisibilityLabel\x12\x18\n" + - "\afeature\x18\x06 \x03(\tR\afeature\x12.\n" + - "\alicense\x18\b \x01(\v2\x14.blaze_query.LicenseR\alicense\x126\n" + - "\x17package_contains_errors\x18\t \x01(\bR\x15packageContainsErrorsJ\x04\b\a\x10\b\"h\n" + - "\rGeneratedFile\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12'\n" + - "\x0fgenerating_rule\x18\x02 \x02(\tR\x0egeneratingRule\x12\x1a\n" + - "\blocation\x18\x03 \x01(\tR\blocation\"\xd9\x03\n" + - "\x06Target\x125\n" + - "\x04type\x18\x01 \x02(\x0e2!.blaze_query.Target.DiscriminatorR\x04type\x12%\n" + - "\x04rule\x18\x02 \x01(\v2\x11.blaze_query.RuleR\x04rule\x128\n" + - "\vsource_file\x18\x03 \x01(\v2\x17.blaze_query.SourceFileR\n" + - "sourceFile\x12A\n" + - "\x0egenerated_file\x18\x04 \x01(\v2\x1a.blaze_query.GeneratedFileR\rgeneratedFile\x12>\n" + - "\rpackage_group\x18\x05 \x01(\v2\x19.blaze_query.PackageGroupR\fpackageGroup\x12J\n" + - "\x11environment_group\x18\x06 \x01(\v2\x1d.blaze_query.EnvironmentGroupR\x10environmentGroup\"h\n" + - "\rDiscriminator\x12\b\n" + - "\x04RULE\x10\x01\x12\x0f\n" + - "\vSOURCE_FILE\x10\x02\x12\x12\n" + - "\x0eGENERATED_FILE\x10\x03\x12\x11\n" + - "\rPACKAGE_GROUP\x10\x04\x12\x15\n" + - "\x11ENVIRONMENT_GROUP\x10\x05\":\n" + - "\vQueryResult\x12+\n" + - "\x06target\x18\x01 \x03(\v2\x13.blaze_query.TargetR\x06target\"\xc0\x01\n" + - "\x14AllowedRuleClassInfo\x12L\n" + - "\x06policy\x18\x01 \x02(\x0e24.blaze_query.AllowedRuleClassInfo.AllowedRuleClassesR\x06policy\x12,\n" + - "\x12allowed_rule_class\x18\x02 \x03(\tR\x10allowedRuleClass\",\n" + - "\x12AllowedRuleClasses\x12\a\n" + - "\x03ANY\x10\x01\x12\r\n" + - "\tSPECIFIED\x10\x02\"\xfa\x03\n" + - "\x13AttributeDefinition\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x128\n" + - "\x04type\x18\x02 \x02(\x0e2$.blaze_query.Attribute.DiscriminatorR\x04type\x12\x1c\n" + - "\tmandatory\x18\x03 \x01(\bR\tmandatory\x12S\n" + - "\x14allowed_rule_classes\x18\x04 \x01(\v2!.blaze_query.AllowedRuleClassInfoR\x12allowedRuleClasses\x12$\n" + - "\rdocumentation\x18\x05 \x01(\tR\rdocumentation\x12\x1f\n" + - "\vallow_empty\x18\x06 \x01(\bR\n" + - "allowEmpty\x12*\n" + - "\x11allow_single_file\x18\a \x01(\bR\x0fallowSingleFile\x125\n" + - "\adefault\x18\t \x01(\v2\x1b.blaze_query.AttributeValueR\adefault\x12\x1e\n" + - "\n" + - "executable\x18\n" + - " \x01(\bR\n" + - "executable\x12\"\n" + - "\fconfigurable\x18\v \x01(\bR\fconfigurable\x12\x14\n" + - "\x05nodep\x18\f \x01(\bR\x05nodep\x12\x1e\n" + - "\vcfg_is_host\x18\r \x01(\bR\tcfgIsHost\"\x8c\x02\n" + - "\x0eAttributeValue\x12\x10\n" + - "\x03int\x18\x01 \x01(\x05R\x03int\x12\x16\n" + - "\x06string\x18\x02 \x01(\tR\x06string\x12\x12\n" + - "\x04bool\x18\x03 \x01(\bR\x04bool\x12/\n" + - "\x04list\x18\x04 \x03(\v2\x1b.blaze_query.AttributeValueR\x04list\x129\n" + - "\x04dict\x18\x05 \x03(\v2%.blaze_query.AttributeValue.DictEntryR\x04dict\x1aP\n" + - "\tDictEntry\x12\x10\n" + - "\x03key\x18\x01 \x02(\tR\x03key\x121\n" + - "\x05value\x18\x02 \x02(\v2\x1b.blaze_query.AttributeValueR\x05value\"\xa0\x01\n" + - "\x0eRuleDefinition\x12\x12\n" + - "\x04name\x18\x01 \x02(\tR\x04name\x12>\n" + - "\tattribute\x18\x02 \x03(\v2 .blaze_query.AttributeDefinitionR\tattribute\x12$\n" + - "\rdocumentation\x18\x03 \x01(\tR\rdocumentation\x12\x14\n" + - "\x05label\x18\x04 \x01(\tR\x05label\"@\n" + - "\rBuildLanguage\x12/\n" + - "\x04rule\x18\x01 \x03(\v2\x1b.blaze_query.RuleDefinitionR\x04ruleB6\n" + - "4com.google.devtools.build.lib.query2.proto.proto2api" - -var ( - file_gitops_blaze_query_build_proto_rawDescOnce sync.Once - file_gitops_blaze_query_build_proto_rawDescData []byte -) - -func file_gitops_blaze_query_build_proto_rawDescGZIP() []byte { - file_gitops_blaze_query_build_proto_rawDescOnce.Do(func() { - file_gitops_blaze_query_build_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gitops_blaze_query_build_proto_rawDesc), len(file_gitops_blaze_query_build_proto_rawDesc))) - }) - return file_gitops_blaze_query_build_proto_rawDescData -} - -var file_gitops_blaze_query_build_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_gitops_blaze_query_build_proto_msgTypes = make([]protoimpl.MessageInfo, 25) -var file_gitops_blaze_query_build_proto_goTypes = []any{ - (FilesetEntry_SymlinkBehavior)(0), // 0: blaze_query.FilesetEntry.SymlinkBehavior - (Attribute_Discriminator)(0), // 1: blaze_query.Attribute.Discriminator - (Attribute_Tristate)(0), // 2: blaze_query.Attribute.Tristate - (Target_Discriminator)(0), // 3: blaze_query.Target.Discriminator - (AllowedRuleClassInfo_AllowedRuleClasses)(0), // 4: blaze_query.AllowedRuleClassInfo.AllowedRuleClasses - (*License)(nil), // 5: blaze_query.License - (*StringDictEntry)(nil), // 6: blaze_query.StringDictEntry - (*LabelDictUnaryEntry)(nil), // 7: blaze_query.LabelDictUnaryEntry - (*LabelListDictEntry)(nil), // 8: blaze_query.LabelListDictEntry - (*LabelKeyedStringDictEntry)(nil), // 9: blaze_query.LabelKeyedStringDictEntry - (*StringListDictEntry)(nil), // 10: blaze_query.StringListDictEntry - (*FilesetEntry)(nil), // 11: blaze_query.FilesetEntry - (*Attribute)(nil), // 12: blaze_query.Attribute - (*Rule)(nil), // 13: blaze_query.Rule - (*RuleSummary)(nil), // 14: blaze_query.RuleSummary - (*PackageGroup)(nil), // 15: blaze_query.PackageGroup - (*EnvironmentGroup)(nil), // 16: blaze_query.EnvironmentGroup - (*SourceFile)(nil), // 17: blaze_query.SourceFile - (*GeneratedFile)(nil), // 18: blaze_query.GeneratedFile - (*Target)(nil), // 19: blaze_query.Target - (*QueryResult)(nil), // 20: blaze_query.QueryResult - (*AllowedRuleClassInfo)(nil), // 21: blaze_query.AllowedRuleClassInfo - (*AttributeDefinition)(nil), // 22: blaze_query.AttributeDefinition - (*AttributeValue)(nil), // 23: blaze_query.AttributeValue - (*RuleDefinition)(nil), // 24: blaze_query.RuleDefinition - (*BuildLanguage)(nil), // 25: blaze_query.BuildLanguage - (*Attribute_SelectorEntry)(nil), // 26: blaze_query.Attribute.SelectorEntry - (*Attribute_Selector)(nil), // 27: blaze_query.Attribute.Selector - (*Attribute_SelectorList)(nil), // 28: blaze_query.Attribute.SelectorList - (*AttributeValue_DictEntry)(nil), // 29: blaze_query.AttributeValue.DictEntry -} -var file_gitops_blaze_query_build_proto_depIdxs = []int32{ - 0, // 0: blaze_query.FilesetEntry.symlink_behavior:type_name -> blaze_query.FilesetEntry.SymlinkBehavior - 1, // 1: blaze_query.Attribute.type:type_name -> blaze_query.Attribute.Discriminator - 2, // 2: blaze_query.Attribute.tristate_value:type_name -> blaze_query.Attribute.Tristate - 5, // 3: blaze_query.Attribute.license:type_name -> blaze_query.License - 6, // 4: blaze_query.Attribute.string_dict_value:type_name -> blaze_query.StringDictEntry - 11, // 5: blaze_query.Attribute.fileset_list_value:type_name -> blaze_query.FilesetEntry - 8, // 6: blaze_query.Attribute.label_list_dict_value:type_name -> blaze_query.LabelListDictEntry - 10, // 7: blaze_query.Attribute.string_list_dict_value:type_name -> blaze_query.StringListDictEntry - 7, // 8: blaze_query.Attribute.label_dict_unary_value:type_name -> blaze_query.LabelDictUnaryEntry - 9, // 9: blaze_query.Attribute.label_keyed_string_dict_value:type_name -> blaze_query.LabelKeyedStringDictEntry - 28, // 10: blaze_query.Attribute.selector_list:type_name -> blaze_query.Attribute.SelectorList - 12, // 11: blaze_query.Rule.attribute:type_name -> blaze_query.Attribute - 13, // 12: blaze_query.RuleSummary.rule:type_name -> blaze_query.Rule - 13, // 13: blaze_query.RuleSummary.dependency:type_name -> blaze_query.Rule - 5, // 14: blaze_query.SourceFile.license:type_name -> blaze_query.License - 3, // 15: blaze_query.Target.type:type_name -> blaze_query.Target.Discriminator - 13, // 16: blaze_query.Target.rule:type_name -> blaze_query.Rule - 17, // 17: blaze_query.Target.source_file:type_name -> blaze_query.SourceFile - 18, // 18: blaze_query.Target.generated_file:type_name -> blaze_query.GeneratedFile - 15, // 19: blaze_query.Target.package_group:type_name -> blaze_query.PackageGroup - 16, // 20: blaze_query.Target.environment_group:type_name -> blaze_query.EnvironmentGroup - 19, // 21: blaze_query.QueryResult.target:type_name -> blaze_query.Target - 4, // 22: blaze_query.AllowedRuleClassInfo.policy:type_name -> blaze_query.AllowedRuleClassInfo.AllowedRuleClasses - 1, // 23: blaze_query.AttributeDefinition.type:type_name -> blaze_query.Attribute.Discriminator - 21, // 24: blaze_query.AttributeDefinition.allowed_rule_classes:type_name -> blaze_query.AllowedRuleClassInfo - 23, // 25: blaze_query.AttributeDefinition.default:type_name -> blaze_query.AttributeValue - 23, // 26: blaze_query.AttributeValue.list:type_name -> blaze_query.AttributeValue - 29, // 27: blaze_query.AttributeValue.dict:type_name -> blaze_query.AttributeValue.DictEntry - 22, // 28: blaze_query.RuleDefinition.attribute:type_name -> blaze_query.AttributeDefinition - 24, // 29: blaze_query.BuildLanguage.rule:type_name -> blaze_query.RuleDefinition - 2, // 30: blaze_query.Attribute.SelectorEntry.tristate_value:type_name -> blaze_query.Attribute.Tristate - 5, // 31: blaze_query.Attribute.SelectorEntry.license:type_name -> blaze_query.License - 6, // 32: blaze_query.Attribute.SelectorEntry.string_dict_value:type_name -> blaze_query.StringDictEntry - 11, // 33: blaze_query.Attribute.SelectorEntry.fileset_list_value:type_name -> blaze_query.FilesetEntry - 8, // 34: blaze_query.Attribute.SelectorEntry.label_list_dict_value:type_name -> blaze_query.LabelListDictEntry - 10, // 35: blaze_query.Attribute.SelectorEntry.string_list_dict_value:type_name -> blaze_query.StringListDictEntry - 7, // 36: blaze_query.Attribute.SelectorEntry.label_dict_unary_value:type_name -> blaze_query.LabelDictUnaryEntry - 9, // 37: blaze_query.Attribute.SelectorEntry.label_keyed_string_dict_value:type_name -> blaze_query.LabelKeyedStringDictEntry - 26, // 38: blaze_query.Attribute.Selector.entries:type_name -> blaze_query.Attribute.SelectorEntry - 1, // 39: blaze_query.Attribute.SelectorList.type:type_name -> blaze_query.Attribute.Discriminator - 27, // 40: blaze_query.Attribute.SelectorList.elements:type_name -> blaze_query.Attribute.Selector - 23, // 41: blaze_query.AttributeValue.DictEntry.value:type_name -> blaze_query.AttributeValue - 42, // [42:42] is the sub-list for method output_type - 42, // [42:42] is the sub-list for method input_type - 42, // [42:42] is the sub-list for extension type_name - 42, // [42:42] is the sub-list for extension extendee - 0, // [0:42] is the sub-list for field type_name -} - -func init() { file_gitops_blaze_query_build_proto_init() } -func file_gitops_blaze_query_build_proto_init() { - if File_gitops_blaze_query_build_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_gitops_blaze_query_build_proto_rawDesc), len(file_gitops_blaze_query_build_proto_rawDesc)), - NumEnums: 5, - NumMessages: 25, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_gitops_blaze_query_build_proto_goTypes, - DependencyIndexes: file_gitops_blaze_query_build_proto_depIdxs, - EnumInfos: file_gitops_blaze_query_build_proto_enumTypes, - MessageInfos: file_gitops_blaze_query_build_proto_msgTypes, - }.Build() - File_gitops_blaze_query_build_proto = out.File - file_gitops_blaze_query_build_proto_goTypes = nil - file_gitops_blaze_query_build_proto_depIdxs = nil -} diff --git a/gitops/prer/BUILD.bazel b/gitops/prer/BUILD.bazel index 056f4f55..55b3b510 100644 --- a/gitops/prer/BUILD.bazel +++ b/gitops/prer/BUILD.bazel @@ -18,15 +18,12 @@ go_library( importpath = "github.com/fasterci/rules_gitops/gitops/prer", visibility = ["//visibility:private"], deps = [ - "//gitops/analysis", - "//gitops/bazel", "//gitops/commitmsg", "//gitops/exec", "//gitops/git", "//gitops/git/bitbucket", "//gitops/git/github", "//gitops/git/gitlab", - "@org_golang_google_protobuf//proto", "@org_golang_x_sync//errgroup", ], ) diff --git a/go.mod b/go.mod index 7d72933d..93a20bf0 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/xanzy/go-gitlab v0.80.2 golang.org/x/oauth2 v0.30.0 golang.org/x/sync v0.14.0 - google.golang.org/protobuf v1.36.6 k8s.io/api v0.32.5 k8s.io/apimachinery v0.32.5 k8s.io/client-go v0.32.5 @@ -64,6 +63,7 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.7.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/starlark/BUILD.bazel b/starlark/BUILD.bazel deleted file mode 100644 index e69de29b..00000000 diff --git a/starlark/proto.bzl b/starlark/proto.bzl deleted file mode 100644 index 514d1cd7..00000000 --- a/starlark/proto.bzl +++ /dev/null @@ -1,85 +0,0 @@ -""" -Rules for generating Go source files from proto files. - -based on https://github.com/bazelbuild/rules_go/issues/2111#issuecomment-1355927231 -""" - -load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") -load("@rules_go//go:def.bzl", "GoInfo") -load("@rules_go//proto:compiler.bzl", "GoProtoCompiler") - -def _output_go_library_srcs_impl(ctx): - srcs_of_library = [] - importpath = "" - for src in ctx.attr.deps: - lib = src[GoInfo] - if importpath and lib.importpath != importpath: - fail( - "importpath of all deps must match, got {} and {}", - importpath, - lib.importpath, - ) - importpath = lib.importpath - srcs_of_library.extend(lib.srcs) - - if len(srcs_of_library) != 1: - fail("expected exactly one src for library, got {}", len(srcs_of_library)) - - if not ctx.attr.out: - fail("must specify out for now") - - # Run a command to copy the src file to the out location. - _copy(ctx, srcs_of_library[0], ctx.outputs.out) - -def _copy(ctx, in_file, out_file): - # based on https://github.com/bazelbuild/examples/blob/main/rules/shell_command/rules.bzl - ctx.actions.run_shell( - # Input files visible to the action. - inputs = [in_file], - # Output files that must be created by the action. - outputs = [out_file], - progress_message = "Copying {} to {}".format(in_file.path, out_file.path), - arguments = [in_file.path, out_file.path], - command = """cp "$1" "$2" """, - ) - -output_go_library_srcs = rule( - implementation = _output_go_library_srcs_impl, - attrs = { - "compiler": attr.label( - providers = [GoProtoCompiler], - default = "@rules_go//proto:go_proto", - ), - "deps": attr.label_list( - providers = [GoInfo], - aspects = [], - ), - "out": attr.output( - doc = ("Name of output .go file. If not specified, the file name " + - "of the generated source file will be used."), - mandatory = False, - ), - "_go_context_data": attr.label( - default = "@rules_go//:go_context_data", - ), - }, - toolchains = ["@rules_go//go:toolchain"], -) - -def write_go_proto_srcs(name, go_proto_library, src, visibility = None): - generated_src = "__generated_" + src - output_go_library_srcs( - name = name + "_generated", - deps = [go_proto_library], - out = generated_src, - visibility = ["//visibility:private"], - ) - - write_source_files( - name = name, - files = { - src: generated_src, - }, - diff_test = True, - visibility = visibility, - ) From 4f7723ed22a9b266c7000e2308d8c22215cac20c Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 16:59:56 -0700 Subject: [PATCH 06/14] keep it v7 compatible --- gitops/prer/create_gitops_prs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index d081723b..69b1aad1 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -106,7 +106,7 @@ func cleanTarget(target string) string { func bazelQueryTargets(query string) []GitopsTarget { log.Println("Executing bazel cquery ", query) - starlarkExpr := `json.encode(struct(deployment_branch = getattr(providers(target)['//gitops:provider.bzl%GitopsArtifactsInfo'], 'deployment_branch', '') if '//gitops:provider.bzl%GitopsArtifactsInfo' in providers(target) else '', target = str(target.label), executable = providers(target)['DefaultInfo'].files_to_run.executable.path if providers(target)['DefaultInfo'].files_to_run.executable else ''))` + starlarkExpr := `json.encode(struct(deployment_branch = getattr(providers(target)['//gitops:provider.bzl%GitopsArtifactsInfo'], 'deployment_branch', '') if '//gitops:provider.bzl%GitopsArtifactsInfo' in providers(target) else '', target = str(target.label), executable = target.files_to_run.executable.path if target.files_to_run.executable else ''))` cmd := oe.Command(*bazelCmd, "cquery", "--implicit_deps=false", query, "--output=starlark", "--starlark:expr="+starlarkExpr) stderr, err := cmd.StderrPipe() if err != nil { From 86c6a4ebefc703e7fcb1c3d215f835f222cfe30a Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 17:54:38 -0700 Subject: [PATCH 07/14] skip empty deployment branch targets --- gitops/prer/create_gitops_prs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index 69b1aad1..1de28f05 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -198,7 +198,11 @@ func main() { } for _, t := range results { targetName := cleanTarget(t.Target) - releaseTrains[t.DeploymentBranch] = append(releaseTrains[t.DeploymentBranch], GitopsTarget{Target: targetName, Binary: t.Binary, DeploymentBranch: t.DeploymentBranch}) + if t.DeploymentBranch != "" { + releaseTrains[t.DeploymentBranch] = append(releaseTrains[t.DeploymentBranch], GitopsTarget{Target: targetName, Binary: t.Binary, DeploymentBranch: t.DeploymentBranch}) + } else { + log.Printf("No deployment branch for %s, Skipping", t.Target) + } } if (len(releaseTrains)) == 0 { log.Println("No matching targets found") From 061f6f8dd076c93fcc3241c9eed0332ba6733047 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Tue, 2 Jun 2026 22:16:27 -0700 Subject: [PATCH 08/14] fix: update starlark expression to safely resolve GitopsArtifactsInfo provider in bazel cquery --- gitops/prer/create_gitops_prs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index 1de28f05..80e12bd0 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -106,7 +106,7 @@ func cleanTarget(target string) string { func bazelQueryTargets(query string) []GitopsTarget { log.Println("Executing bazel cquery ", query) - starlarkExpr := `json.encode(struct(deployment_branch = getattr(providers(target)['//gitops:provider.bzl%GitopsArtifactsInfo'], 'deployment_branch', '') if '//gitops:provider.bzl%GitopsArtifactsInfo' in providers(target) else '', target = str(target.label), executable = target.files_to_run.executable.path if target.files_to_run.executable else ''))` + starlarkExpr := `json.encode(struct(deployment_branch = getattr(([providers(target)[p] for p in providers(target) if p.endswith('//gitops:provider.bzl%GitopsArtifactsInfo')] + [None])[0], 'deployment_branch', ''), target = str(target.label), executable = target.files_to_run.executable.path if target.files_to_run.executable else ''))` cmd := oe.Command(*bazelCmd, "cquery", "--implicit_deps=false", query, "--output=starlark", "--starlark:expr="+starlarkExpr) stderr, err := cmd.StderrPipe() if err != nil { From 9282f8aa9a7af4c704a72738f7d152542ccc15a1 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 11:36:49 -0700 Subject: [PATCH 09/14] fix: update starlark query to use hasattr when checking for GitopsArtifactsInfo deployment_branch attribute --- gitops/prer/create_gitops_prs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitops/prer/create_gitops_prs.go b/gitops/prer/create_gitops_prs.go index 80e12bd0..4aa1a7dd 100644 --- a/gitops/prer/create_gitops_prs.go +++ b/gitops/prer/create_gitops_prs.go @@ -106,7 +106,7 @@ func cleanTarget(target string) string { func bazelQueryTargets(query string) []GitopsTarget { log.Println("Executing bazel cquery ", query) - starlarkExpr := `json.encode(struct(deployment_branch = getattr(([providers(target)[p] for p in providers(target) if p.endswith('//gitops:provider.bzl%GitopsArtifactsInfo')] + [None])[0], 'deployment_branch', ''), target = str(target.label), executable = target.files_to_run.executable.path if target.files_to_run.executable else ''))` + starlarkExpr := `json.encode(struct(deployment_branch = getattr(([providers(target)[p] for p in providers(target) if hasattr(providers(target)[p], 'deployment_branch')] + [None])[0], 'deployment_branch', ''), target = str(target.label), executable = target.files_to_run.executable.path if target.files_to_run.executable else ''))` cmd := oe.Command(*bazelCmd, "cquery", "--implicit_deps=false", query, "--output=starlark", "--starlark:expr="+starlarkExpr) stderr, err := cmd.StderrPipe() if err != nil { From c84cc7dc0a92f05bc544d85793c88035e671d160 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 13:29:13 -0700 Subject: [PATCH 10/14] fix: add fallback for git init in tests to support older git versions and update prerequisites --- README.md | 2 +- gitops/git/git_test.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe8eae1e..eabbf679 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ copy the MODULE.bazel snippet into your `MODULE.bazel` file. ### Prerequisites -* **Git**: A minimum Git version of **2.19.0** is required for runtime operations due to the use of partial clones (`--filter=blob:none`) and other modern clone/fetch options (e.g. `--no-tags`). If you are running the test suite, Git **2.28.0** or later is required due to test dependencies (specifically `git init --initial-branch`). +* **Git**: A minimum Git version of **2.19.0** is required for runtime operations due to the use of partial clones (`--filter=blob:none`) and other modern clone/fetch options (e.g. `--no-tags`). diff --git a/gitops/git/git_test.go b/gitops/git/git_test.go index 3effd699..4911245f 100644 --- a/gitops/git/git_test.go +++ b/gitops/git/git_test.go @@ -28,7 +28,14 @@ func createMockRemote(t *testing.T, files map[string]string) string { t.Fatalf("failed to create temp remote dir: %v", err) } - mustRun(t, remoteDir, "git", "init", "--initial-branch=master") + // Try using --initial-branch=master (Git 2.28.0+) + initCmd := oe.Command("git", "init", "--initial-branch=master") + initCmd.Dir = remoteDir + if _, err := initCmd.CombinedOutput(); err != nil { + // Fallback for older Git versions + mustRun(t, remoteDir, "git", "init") + mustRun(t, remoteDir, "git", "symbolic-ref", "HEAD", "refs/heads/master") + } mustRun(t, remoteDir, "git", "config", "user.name", "Test User") mustRun(t, remoteDir, "git", "config", "user.email", "test@example.com") From 321231953bdb708f933b9abe149d3846df2ad716 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 13:34:44 -0700 Subject: [PATCH 11/14] test: add cloud/app.yaml to mock remote in git push retry tests --- gitops/git/git_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitops/git/git_test.go b/gitops/git/git_test.go index 4911245f..41e98e90 100644 --- a/gitops/git/git_test.go +++ b/gitops/git/git_test.go @@ -477,7 +477,8 @@ func TestPushForceWithLeaseOnDeletedBranch(t *testing.T) { // Scenario 1: With pushRetryMax = 0, the push should fail. t.Run("retry_max_0_fails", func(t *testing.T) { remoteDir := createMockRemote(t, map[string]string{ - "readme.md": "documentation", + "readme.md": "documentation", + "cloud/app.yaml": "image: app:v0", }) defer os.RemoveAll(remoteDir) @@ -503,7 +504,8 @@ func TestPushForceWithLeaseOnDeletedBranch(t *testing.T) { // Scenario 2: With pushRetryMax = 1, the push should succeed on the second attempt. t.Run("retry_max_1_succeeds", func(t *testing.T) { remoteDir := createMockRemote(t, map[string]string{ - "readme.md": "documentation", + "readme.md": "documentation", + "cloud/app.yaml": "image: app:v0", }) defer os.RemoveAll(remoteDir) From e3c04e901a684d1caba21c61f408ce3f917e1b22 Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 15:07:22 -0700 Subject: [PATCH 12/14] Even in Bzlmod-only projects, it is standard practice to create an empty WORKSPACE file at the root of the workspace. This maintains compatibility with older tooling (including older versions of Bazelisk, IDE plugins, and third-party tools) that expect a WORKSPACE file to detect the project boundaries. --- WORKSPACE | 1 + e2e/WORKSPACE | 1 + 2 files changed, 2 insertions(+) create mode 100644 WORKSPACE create mode 100644 e2e/WORKSPACE diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..325f5e33 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1 @@ +# Marker file for workspace root (required for older Bazelisk/tooling compatibility) diff --git a/e2e/WORKSPACE b/e2e/WORKSPACE new file mode 100644 index 00000000..325f5e33 --- /dev/null +++ b/e2e/WORKSPACE @@ -0,0 +1 @@ +# Marker file for workspace root (required for older Bazelisk/tooling compatibility) From fe31b8eed41d7207284da3dc494cb9d799c3838d Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 15:14:23 -0700 Subject: [PATCH 13/14] run integration test in CI --- .fasterci/config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.fasterci/config.yaml b/.fasterci/config.yaml index b927f0b5..3b5cd949 100644 --- a/.fasterci/config.yaml +++ b/.fasterci/config.yaml @@ -15,6 +15,8 @@ workflows: - //... test_targets: - //... + - name: prer integration test + run: ./gitops/prer/prer_test.sh - name: Build & test e2e working-directory: e2e bazel: From 0a61e496b2645a763636ba84ecac9e69e1ec78cf Mon Sep 17 00:00:00 2001 From: Aleksey Pesternikov Date: Wed, 3 Jun 2026 15:17:03 -0700 Subject: [PATCH 14/14] debug output --- gitops/prer/prer_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/gitops/prer/prer_test.sh b/gitops/prer/prer_test.sh index fbc94fb7..7d48be8a 100755 --- a/gitops/prer/prer_test.sh +++ b/gitops/prer/prer_test.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -e +set -x # Make sure we are running from the repository root WORKSPACE_ROOT=$(git rev-parse --show-toplevel)