# Copyright 2018 Google LLC
#
# 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
#
#     https://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.

tide:
  merge_method:
    GoogleCloudPlatform/compute-image-tools: squash
    GoogleCloudPlatform/compute-image-windows: squash
    GoogleCloudPlatform/guest-agent: squash
    GoogleCloudPlatform/guest-diskexpand: squash
    GoogleCloudPlatform/guest-logging-go: squash
    GoogleCloudPlatform/guest-oslogin: squash
    GoogleCloudPlatform/guest-test-infra: squash
    GoogleCloudPlatform/osconfig: squash
    GoogleCloudPlatform/artifact-registry-apt-transport: squash
    GoogleCloudPlatform/artifact-registry-yum-plugin: squash
    GoogleCloudPlatform/blueprints: squash
    GoogleCloudPlatform/compute-image-import: squash
    GoogleContainerTools/kpt-config-sync: squash
    kubeflow: squash
    GoogleCloudPlatform/k8s-config-connector: merge
    GoogleCloudPlatform/gke-networking-api: merge
  squash_label: tide/merge-method-squash
  rebase_label: tide/merge-method-rebase
  merge_label: tide/merge-method-merge
  merge_commit_template:
    kubeflow:
      title: "{{ .Title }} (#{{ .Number }})"
  target_urls:
    "*": https://oss.gprow.dev/tide
    "GoogleCloudPlatform/blueprints": https://prow.infra.cft.dev/tide
  queries:
  - repos:
    - GoogleCloudPlatform/compute-image-tools
    - GoogleCloudPlatform/compute-image-windows
    - GoogleCloudPlatform/guest-agent
    - GoogleCloudPlatform/guest-diskexpand
    - GoogleCloudPlatform/guest-logging-go
    - GoogleCloudPlatform/guest-oslogin
    - GoogleCloudPlatform/guest-test-infra
    - GoogleCloudPlatform/osconfig
    - GoogleCloudPlatform/artifact-registry-apt-transport
    - GoogleCloudPlatform/artifact-registry-yum-plugin
    - GoogleCloudPlatform/oss-test-infra
    - GoogleCloudPlatform/testgrid
    - GoogleCloudPlatform/k8s-cloud-provider
    - GoogleCloudPlatform/gke-networking-api
    - GoogleContainerTools/kpt-config-sync
    - GoogleCloudPlatform/k8s-config-connector
    labels:
    - lgtm
    - approved
    missingLabels:
    - do-not-merge
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
  - repos:
    - GoogleCloudPlatform/netd
    labels:
    - lgtm
    - approved
    missingLabels:
    - do-not-merge
    - do-not-merge/blocked-paths
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
  - repos:
    - GoogleCloudPlatform/compute-image-import
    labels:
    - lgtm
    - approved
    missingLabels:
    - do-not-merge
    - do-not-merge/blocked-paths
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
  - repos:
    - kubeflow/pipelines
    labels:
    - lgtm
    - approved
    - ci-passed
    missingLabels:
    - do-not-merge
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
    - needs-rebase
  - orgs:
    - kubeflow
    labels:
    - lgtm
    - approved
    missingLabels:
    - do-not-merge
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
    - needs-rebase
  - author: google-oss-robot
    labels: # google-oss-robot should only create autobump PR with this label
    - skip-review
    missingLabels:
    - do-not-merge
    - do-not-merge/hold
    - do-not-merge/invalid-owners-file
    - do-not-merge/work-in-progress
    repos:
    - GoogleCloudPlatform/oss-test-infra
  context_options:
    orgs:
      GoogleCloudPlatform:
        repos:
          gke-networking-api:
            optional-contexts:
              # The job is triggered only on dependabot PRs.
              - regenerate-crds

plank:
  job_url_prefix_config:
    '*': https://oss.gprow.dev/view/
    "GoogleCloudPlatform/blueprints": https://prow.infra.cft.dev/view/
  pod_pending_timeout: 30m
  pod_unscheduled_timeout: 10m
  build_cluster_status_file: 'gs://oss-prow/oss-prow-build-clusters-statuses.json'
  default_decoration_config_entries:
  - config:
      timeout: 7200000000000 # 2h
      grace_period: 15000000000 # 15s
      utility_images:
        clonerefs: "us-central1-docker.pkg.dev/gob-prow/prow-images/clonerefs:v20250423-91b28ca9b"
        initupload: "us-central1-docker.pkg.dev/gob-prow/prow-images/initupload:v20250423-91b28ca9b"
        entrypoint: "us-central1-docker.pkg.dev/gob-prow/prow-images/entrypoint:v20250423-91b28ca9b"
        sidecar: "us-central1-docker.pkg.dev/gob-prow/prow-images/sidecar:v20250423-91b28ca9b"
      gcs_configuration:
        bucket: "oss-prow"
        path_strategy: "explicit"
      gcs_credentials_secret: "service-account" # TODO(fejta): remove https://github.com/GoogleCloudPlatform/oss-test-infra/issues/202
  - cluster: default
    config:
      gcs_credentials_secret: "" # Use workload identity
      default_service_account_name: "prowjob-default-sa" # SA in build cluster
  - cluster: test-infra-trusted
    config:
      gcs_credentials_secret: "" # Use workload identity
      default_service_account_name: "prowjob-default-sa" # SA in build cluster
  - cluster: build-elcarro
    config:
      gcs_configuration:
        bucket: "oss-prow-elcarro"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret
  - cluster: build-blueprints
    config:
      gcs_configuration:
        bucket: "blueprints-prow"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret
  - cluster: gcp-guest
    config:
      gcs_configuration:
        bucket: "oss-prow"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret
  - cluster: build-compute-image-import
    config:
      gcs_configuration:
        bucket: "compute-image-import-prow"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret
  - cluster: build-kpt-config-sync
    config:
      gcs_configuration:
        bucket: "oss-prow-build-kpt-config-sync"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret
  - cluster: build-gcp-oracle-team
    config:
      gcs_configuration:
        bucket: "gcp-oracle-prow-bucket"
      default_service_account_name: "prowjob-default-sa" # Use workload identity
      gcs_credentials_secret: ""                         # rather than service account key secret

sinker:
  resync_period: 1m
  max_prowjob_age: 48h
  max_pod_age: 48h
  terminated_pod_ttl: 30m

prowjob_namespace: default
pod_namespace: test-pods
log_level: debug

prowjob_default_entries:
  - cluster: '*'
    repo: 'GoogleCloudPlatform/blueprints'
    config:
      tenant_id: 'blueprints'
  - cluster: 'build-blueprints'
    repo: '*'
    config:
      tenant_id: 'blueprints'

branch-protection:
  orgs:
    kubeflow:
      protect: true
      #required_status_checks:
      #  contexts:
      #  - cla/google
      exclude:
      - "^revert-" # don't protect revert branches
      - "^dependabot/" # don't protect branches created by dependabot
      - "-patch-" # don't protect branches created by editing on GitHub UI

deck:
  google_analytics: G-NQ9CERRMYD
  spyglass:
    announcement: "Googlers: Please join <a href='https://groups.google.com/a/google.com/g/prow-announce'>the prow-announce@google.com group</a> to receive important Prow related updates. Consider adding your team as a subgroup!"
    size_limit: 500000000 # 500MB
    gcs_browser_prefix: https://pantheon.corp.google.com/storage/browser/ # TODO(fejta): something publicly accessible
    testgrid_config: gs://k8s-testgrid/config
    testgrid_root: https://testgrid.k8s.io/
    lenses:
      - lens:
          name: metadata
        required_files:
          - started.json|finished.json
        optional_files:
          - podinfo.json
      - lens:
          name: buildlog
        required_files:
          - build-log.txt
      - lens:
          name: junit
        required_files:
          - artifacts/junit.*\.xml
      - lens:
          name: podinfo
          config:
            runner_configs:
              "default":
                pod_link_template: "https://console.cloud.google.com/kubernetes/pod/us-west1-a/prow/test-pods/{{ .Name }}/details?project=oss-prow-builds"
              "test-infra-trusted":
                pod_link_template: "https://console.cloud.google.com/kubernetes/pod/us-west1-a/prow/test-pods/{{ .Name }}/details?project=oss-prow"
              "build-kubeflow":
                pod_link_template: "https://console.cloud.google.com/kubernetes/pod/us-east1-d/kf-ci-v1/test-pods/{{ .Name }}/details?project=kubeflow-ci"
        required_files:
          - podinfo.json
        optional_files:
          - prowjob.json
      - lens:
          name: html
        required_files:
          - ^artifacts/.*\.html$
  rerun_auth_configs:
    '*':
      github_orgs:
      - GoogleCloudPlatform
  skip_storage_path_validation: false
  additional_allowed_buckets:
    - compute-image-tools-test
    - gcp-guest-testgrid

gerrit:
  deck_url: https://oss.gprow.dev/
  tick_interval: 30s
  org_repos_config:
  - org: https://kunit-review.googlesource.com
    repos:
    - linux
  - org: https://linux-review.googlesource.com
    repos:
    - linux/kernel/git/torvalds/linux

in_repo_config:
  enabled:
    chaotoppicks: true
    GoogleCloudPlatform/blueprints: true
    GoogleCloudPlatform/oss-test-infra: true
    GoogleCloudPlatform/testgrid: true

  allowed_clusters:
    "*": []
    "chaotoppicks": ["default"] # For experimenting purpose, will remove once done with experiments
    "GoogleCloudPlatform/blueprints": ["build-blueprints"]
    "GoogleCloudPlatform/oss-test-infra": ["default"]
    "GoogleCloudPlatform/testgrid": ["default"]

presets:
# docker-in-docker preset
#
# NOTE: This requires using an entrypoint or base image with the runner.sh
# script. An example can be found at:
#
#   https://github.com/kubernetes/test-infra/blob/master/images/bootstrap/runner.sh
#
# You must ALSO set the following on your PodSpec:
#
#   securityContext:
#     privileged: true
- labels:
    preset-dind-enabled: "true"
  env:
  - name: DOCKER_IN_DOCKER_ENABLED
    value: "true"
  - name: BOOTSTRAP_MTU_WORKAROUND
    value: "true"
  volumes:
  - name: docker-graph
    emptyDir: {}
  volumeMounts:
  - name: docker-graph
    mountPath: /docker-graph
# docker-in-docker preset that uses in-memory etcd to limit write operations.
- labels:
    preset-dind-enabled-memory: "true"
  env:
  - name: DOCKER_IN_DOCKER_ENABLED
    value: "true"
  - name: BOOTSTRAP_MTU_WORKAROUND
    value: "true"
  volumes:
  - name: docker-graph
    emptyDir:
      medium: Memory
  volumeMounts:
  - name: docker-graph
    mountPath: /docker-graph

# volume mounts for kind
- labels:
    preset-kind-volume-mounts: "true"
  volumeMounts:
  - mountPath: /lib/modules
    name: modules
    readOnly: true
  - mountPath: /sys/fs/cgroup
    name: cgroup
  volumes:
  - name: modules
    hostPath:
      path: /lib/modules
      type: Directory
  - name: cgroup
    hostPath:
      path: /sys/fs/cgroup
      type: Directory

pubsub_subscriptions:
  "louhi-resources":
  - "oss-prow-trigger-subscription"
