### Install fallbackcheck Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/tot/fallbackcheck.md Install the fallbackcheck binary using go get. ```shell go get sigs.k8s.io/prow/cmd/tot/fallbackcheck ``` -------------------------------- ### Start Tilt for Local Development Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-tilt.md Start Tilt after initial setup to begin the local development loop. Tilt provides a UI for build status and logs. ```bash tilt up ``` ```bash make dev-tilt ``` -------------------------------- ### Install Tilt on Server Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Installs Tilt using the official installation script from GitHub. ```bash curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash ``` -------------------------------- ### Bootstrap Started.json Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/metadata-artifacts.md Example of the 'Started.json' artifact for a Bootstrap job. This file contains initial job information. ```json { "node": "0790211c-cacb-11ea-a4b9-4a19d9b965b2", "pull": "master:5a529aa3a0dd3a050c5302329681e871ef6c162e,93063:c25e430df7771a96c9a004d8500473a4f2ef55d3", "repo-version": "v1.20.0-alpha.0.261+06ea384605f172", "timestamp": 1595278460, "repos": { "k8s.io/kubernetes": "master:5a529aa3a0dd3a050c5302329681e871ef6c162e,93063:c25e430df7771a96c9a004d8500473a4f2ef55d3", "k8s.io/release": "master" }, "version": "v1.20.0-alpha.0.261+06ea384605f172" } ``` -------------------------------- ### Example fallbackcheck run Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/tot/fallbackcheck.md An example of running fallbackcheck with specific GCS bucket and deck deployment URLs. ```shell fallbackcheck -bucket https://gcsweb-ci.svc.ci.openshift.org/gcs/origin-ci-test/ -prow-url https://deck-ci.svc.ci.openshift.org/ ``` -------------------------------- ### PodUtil Started.json Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/metadata-artifacts.md Example of the 'Started.json' artifact for a PodUtil job. This file contains job details and repository information. ```json { "timestamp": 1595277241, "pull": "93264", "repos": { "kubernetes/kubernetes": "master:5feab0aa1e592ab413b461bc3ad08a6b74a427b4,93264:5dd9241d43f256984358354d1fec468f274f9ac4" }, "metadata": { "links": { "resultstore": { "url": "https://source.cloud.google.com/results/invocations/20688dbb-eb32-47e6-8a49-34734e714f81/targets/test" } }, "resultstore": "https://source.cloud.google.com/results/invocations/20688dbb-eb32-47e6-8a49-34734e714f81/targets/test" }, "repo-version": "30f64c5b1fc57a3beb1476f9beb29280166954d1", "Pending": false } ``` -------------------------------- ### Initial Setup for Local Development Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-tilt.md Run this command once to create the kind cluster and deploy core Prow components. ```bash make dev ``` -------------------------------- ### Install KinD on Server Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Downloads and installs the latest version of KinD on a Linux AMD64 machine, placing it in the local bin directory. ```bash curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind ``` -------------------------------- ### Cloning a Repository with extra_refs Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/cli-tools/generic-autobumper.md This example shows how to clone a repository using `extra_refs`, which is a common setup requirement for the generic-autobumper to ensure a 'committable' local repository. ```yaml extra_refs: - org: kubernetes repo: test-infra base_ref: master ``` -------------------------------- ### Install Docker on Server Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Installs Docker on an Ubuntu/Debian server and adds the current user to the docker group for permissions. ```bash sudo apt-get update sudo apt-get install -y docker.io sudo usermod -aG docker $USER ``` -------------------------------- ### Pod Start Time and Status Display Source: https://github.com/kubernetes-sigs/prow/blob/main/pkg/spyglass/lenses/podinfo/template.html Renders the pod's start time and its current phase (status). ```go-template Start time {{$pod.Status.StartTime}} Pod status {{$pod.Status.Phase}} ``` -------------------------------- ### External Plugin Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/plugins/_index.md Example configuration for external plugins in `plugins.yaml`. This shows how to specify plugin names, endpoints, and the GitHub events they should respond to for a given organization or repository. ```yaml external_plugins: org-foo/repo-bar: - name: refresh-remote endpoint: https://my-refresh-plugin.com events: - issue_comment - name: needs-rebase # No endpoint specified implies "http://{{name}}". events: - pull_request # Dispatching issue_comment events to the needs-rebase plugin is optional. If enabled, this may cost up to two token per comment on a PR. If `ghproxy` # is in use, these two tokens are only needed if the PR or its mergeability changed. - issue_comment - name: cherrypick # No events specified implies all event types. ``` -------------------------------- ### Install Go on Server Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Installs Go version 1.22.12 on a Debian-based Linux server. Ensure your system's PATH is updated and sourced. ```bash curl -OL https://go.dev/dl/go1.22.12.linux-amd64.tar.gz sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc source ~/.bashrc go version ``` -------------------------------- ### Preset Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Defines a reusable preset with environment variables and volumes that can be applied to jobs based on labels. ```yaml presets: - labels: preset-foo-bar: "true" env: - name: FOO value: BAR volumes: - name: foo emptyDir: {} - name: bar secret: secretName: bar volumeMounts: - name: foo mountPath: /etc/foo - name: bar mountPath: /etc/bar readOnly: true ``` -------------------------------- ### Ghproxy Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/ghproxy/throttling-algorithm.md Example configuration for ghproxy, demonstrating how to set various throttling-related flags. These flags control time spacing between requests, maximum delay durations, and request timeouts. ```yaml ... args: - --cache-dir=/cache - --cache-sizeGB=10 - --legacy-disable-disk-cache-partitions-by-auth-header=false - --get-throttling-time-ms=300 - --throttling-time-ms=900 - --throttling-time-v4-ms=850 - --throttling-max-delay-duration-seconds=45 - --throttling-max-delay-duration-v4-seconds=110 - --request-timeout=120 - --concurrency=1000 # rely only on additional throttling algorithm and "disable" the previous solution ... ``` -------------------------------- ### Example GCS Bucket Configuration Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/build-clusters.md This example shows how to configure a custom GCS bucket for Prow job reporting. It is useful when the default bucket configuration does not meet your needs. ```yaml oss-test-infra/prow/oss/config.yaml # L138 oss: gcs: # Bucket for oss-prow jobs bucket: gs://oss-prow ``` -------------------------------- ### Prepare and Run Deck Locally Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/core/deck/_index.md Prepare assets by building a tarball and extracting it. Then, start Deck locally using Go or an IDE with the specified command-line arguments for configuration and file locations. ```bash # Prepare assets make build-tarball PROW_IMAGE=cmd/deck mkdir -p /tmp/deck tar -xvf ./_bin/deck.tar -C /tmp/deck cd /tmp/deck # Expand all layers for tar in *.tar.gz; do tar -xvf $tar; done # Start Deck via go or in your IDE with the following arguments: --config-path=./config/prow/config.yaml --job-config-path=./config/jobs --hook-url=http://prow.k8s.io --spyglass --template-files-location=/tmp/deck/var/run/ko/template --static-files-location=/tmp/deck/var/run/ko/static --spyglass-files-location=/tmp/deck/var/run/ko/lenses ``` -------------------------------- ### Prow Component Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/test/integration/_index.md Example of how to configure a Prow component (like 'hook' or 'deck') to use a fake GitHub server endpoint within the test cluster. This ensures communication stays internal to the test environment. ```bash # Configure component to talk to fake GitHub server if [[ "${component}" == "hook" || "${component}" == "deck" ]]; then kubectl patch deployment "${component}" -p '{"spec":{"template":{"spec":{"containers":[{"name":"'${component}'","env":[{"name":"GITHUB_ENDPOINT","value":"http://fakeghserver:8080"}]}]}}}}' fi ``` -------------------------------- ### Bootstrap Finished.json Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/metadata-artifacts.md Example of the 'Finished.json' artifact for a Bootstrap job. This file includes job status and metadata. ```json { "timestamp": 1596732481, "version": "v1.20.0-alpha.0.519+e825f0a86103a6", "result": "SUCCESS", "passed": true, "job-version": "v1.20.0-alpha.0.519+e825f0a86103a6", "metadata": { "repo-commit": "e825f0a86103a6de00ebd20e158274c4fa625a34", "repos": { "k8s.io/kubernetes": "master:382107e6c84374b229e6188207ef026621286aa2,93714:19ff4d5a9a9b2df60019854f119e269ee035bbee" }, "infra-commit": "1b7fbb373", "repo": "k8s.io/kubernetes", "job-version": "v1.20.0-alpha.0.519+e825f0a86103a6", "revision": "v1.20.0-alpha.0.519+e825f0a86103a6" } } ``` -------------------------------- ### Generic Autobumper Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/cli-tools/generic-autobumper.md This is a comprehensive example of a configuration file for the generic-autobumper. It specifies GitHub credentials, repository details, image prefixes to track, and paths to reference configuration files. ```yaml gitHubLogin: "k8s-ci-robot" gitHubToken: "/etc/github-token/oauth" gitName: "Kubernetes Prow Robot" gitEmail: "k8s.ci.robot@gmail.com" onCallAddress: "https://storage.googleapis.com/kubernetes-jenkins/oncall.json" skipPullRequest: false gitHubOrg: "kubernetes" gitHubRepo: "test-infra" remoteName: "test-infra" upstreamURLBase: "https://raw.githubusercontent.com/kubernetes/test-infra/master" includedConfigPaths: - "." excludedConfigPaths: - "config/prow-staging" extraFiles: - "config/jobs/kubernetes/kops/build-grid.py" - "config/jobs/kubernetes/kops/build-pipeline.py" - "releng/generate_tests.py" - "images/kubekins-e2e/Dockerfile" targetVersion: "latest" prefixes: - name: "Prow" prefix: "gcr.io/k8s-prow/" refConfigFile: "config/prow/cluster/deck_deployment.yaml" stagingRefConfigFile: "config/prow-staging/cluster/deck_deployment.yaml" repo: "https://github.com/kubernetes/test-infra" summarise: true consistentImages: true - name: "Boskos" prefix: "gcr.io/k8s-staging-boskos/" refConfigFile: "config/prow/cluster/build/boskos.yaml" stagingRefConfigFile: "config/prow-staging/cluster/boskos.yaml" repo: "https://github.com/kubernetes-sigs/boskos" summarise: false consistentImages: true - name: "Prow-Test-Images" prefix: "gcr.io/k8s-staging-test-infra/" repo: "https://github.com/kubernetes/test-infra" summarise: false consistentImages: false ``` -------------------------------- ### Onboard New Repository Configuration Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/hmac.md Example demonstrating how to onboard a new repository by adding it to the `org_repo_config` with its `token_created_after` timestamp. The HMAC tool will create a new token and webhook for this repository. ```yaml qux: token_created_after: 2017-10-02T15:00:00Z foo/bar: token_created_after: 2018-10-02T15:00:00Z foo/baz: token_created_after: 2019-10-02T15:00:00Z foo/bax: token_created_after: 2020-03-02T15:00:00Z ``` -------------------------------- ### Minimal Spyglass Lens Backend Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/spyglass/write-a-lens.md A basic implementation of the lenses.Lens interface for a Spyglass lens. Ensure the package name and lens name match the directory structure. ```go package samplelens import ( "encoding/json" "sigs.k8s.io/prow/pkg/config" "sigs.k8s.io/prow/pkg/spyglass/lenses" ) type Lens struct{} func init() { lenses.RegisterLens(Lens{}) } // Config returns the lens's configuration. func (lens Lens) Config() lenses.LensConfig { return lenses.LensConfig{ Title: "Human Readable Lens", Name: "samplelens", // remember: this *must* match the location of the lens (and thus package name) Priority: 0, } } // Header returns the content of func (lens Lens) Header(artifacts []lenses.Artifact, resourceDir string, config json.RawMessage, spyglassConfig config.Spyglass) string { return "" } func (lens Lens) Callback(artifacts []lenses.Artifact, resourceDir string, data string, config json.RawMessage, spyglassConfig config.Spyglass) string { return "" } // Body returns the displayed HTML for the func (lens Lens) Body(artifacts []lenses.Artifact, resourceDir string, data string, config json.RawMessage, spyglassConfig config.Spyglass) string { return "Hi! I\'m a lens!" } ``` -------------------------------- ### Verify Client Environment Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Check running Docker containers and Kubernetes nodes on the client machine to ensure the setup is working correctly. ```bash docker ps kubectl get nodes ``` -------------------------------- ### Clone Prow and Build Development Environment Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Clone the Prow repository and use make commands to set up the development environment. Use 'make dev' for core components or 'make dev-full' for a more complete setup. ```bash git clone https://github.com/kubernetes-sigs/prow.git make dev ``` -------------------------------- ### Example Test Container Script Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/pod-utilities/_index.md This bash script demonstrates how a test container can interact with the Prow environment, accessing cloned repositories and writing artifacts. ```bash pwd # my repo root ls path/to/file/in/my/repo.txt # access repo file ls ../other-repo # access repo file in another repo echo success > ${ARTIFACTS}/results.txt # result info that will be uploaded to GCS. # logs, and job metadata are automatically uploaded. ``` -------------------------------- ### Running a Local Hook Instance Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/cli-tools/phony.md Start a local instance of the hook component for testing. Ensure the HMAC secret file used here matches the one provided to phony. ```bash go run cmd/hook/main.go \ --config-path=config/prow/config.yaml \ --plugin-config=config/prow/plugins.yaml \ --hmac-secret-file=path/to/hmac \ --github-token-path=path/to/github-token ``` -------------------------------- ### Day-to-day Development with Tilt Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-tilt.md Use this command for daily development after the initial setup. Tilt automatically detects changes and redeploys affected components. ```bash make dev-tilt ``` -------------------------------- ### Example JUnit XML Input with Properties Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/spyglass/lenses/junit.md Illustrates the expected structure of JUnit XML input files, including test cases with optional properties that can be used for grouping. ```xml ``` -------------------------------- ### Example OWNERS File Structure Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/plugins/approve/approvers/_index.md Defines GitHub usernames for reviewers and approvers within a specific directory. Items can be usernames or aliases defined in OWNERS_ALIASES files. ```yaml reviewers: - jack - ken - lina approvers: - jack - ken - lina ``` -------------------------------- ### Create a GKE Build Cluster Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/build-clusters.md This script helps create a new GKE cluster intended for Prow to use. It automates much of the setup process, including necessary permissions. ```bash #!/bin/bash # This script is a placeholder and demonstrates the concept of creating a build cluster. # In a real scenario, you would use a more robust script like the one # provided in the Prow repository (pkg/create-build-cluster.sh). # Variables (example - replace with your actual values) PROJECT_ID="your-gcp-project-id" CLUSTER_NAME="prow-build-cluster" ZONE="us-central1-a" MACHINE_TYPE="e2-medium" NUM_NODES="3" # Enable necessary GCP APIs gcloud services enable container.googleapis.com # Create the GKE cluster echo "Creating GKE cluster ${CLUSTER_NAME} in project ${PROJECT_ID}...". gcloud container clusters create ${CLUSTER_NAME} \ --project=${PROJECT_ID} \ --zone=${ZONE} \ --machine-type=${MACHINE_TYPE} \ --num-nodes=${NUM_NODES} \ --enable-autoscaling --min-nodes=1 --max-nodes=5 \ --enable-ip-alias \ --network=default \ --subnetwork=default # Get cluster credentials gcloud container clusters get-credentials ${CLUSTER_NAME} --zone=${ZONE} --project=${PROJECT_ID} # Create a Kubernetes Service Account for Prow KSA_NAME="prow-build-cluster-admin" NAMESPACE="default" echo "Creating Kubernetes Service Account ${KSA_NAME} in namespace ${NAMESPACE}...". cat < Date: Thu May 19 12:34:56 2022 +0000 update ``` -------------------------------- ### Apply Starter Manifests Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/getting-started-deploy.md Applies one of the starter Prow manifests (S3, GCS, or Azure) to your cluster. ```sh kubectl apply -f config/prow/cluster/starter/starter-s3.yaml ``` ```sh kubectl apply -f config/prow/cluster/starter/starter-gcs.yaml ``` ```sh kubectl apply -f config/prow/cluster/starter/starter-azure.yaml ``` -------------------------------- ### PodUtil Finished.json Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/metadata-artifacts.md Example of the 'Finished.json' artifact for a PodUtil job. This file indicates job completion status and revision. ```json { "timestamp": 1595279434, "passed": true, "result": "SUCCESS", "revision": "5dd9241d43f256984358354d1fec468f274f9ac4" } ``` -------------------------------- ### Periodic Job Specification Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Example of the JSON-encoded job specification for a periodic Prow job. This format is used when a job runs on a schedule. ```json {"type":"periodic","job":"job-name","buildid":"0","prowjobid":"uuid","refs":{}} ``` -------------------------------- ### Batch Job Specification Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Example of the JSON-encoded job specification for a batch Prow job. This format is used for jobs that run on a group of commits. ```json {"type":"batch","job":"job-name","buildid":"0","prowjobid":"uuid","refs":{"org":"org-name","repo":"repo-name","base_ref":"base-ref","base_sha":"base-sha","pulls":[{"number":1,"author":"author-name","sha":"pull-sha"},{"number":2,"author":"other-author-name","sha":"second-pull-sha"}]}} ``` -------------------------------- ### Local FGS Execution Help Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/test/integration/fakegitserver.md This command displays the help message for the `fakegitserver` executable, showing available flags for configuring the Git binary path, repository parent directory, and port. ```shell $ go run fakegitserver.go -h Usage of /tmp/go-build2317700172/b001/exe/fakegitserver: -git-binary git Path to the git binary. (default "/usr/bin/git") -git-repos-parent-dir string Path to the parent folder containing all Git repos to serve over HTTP. (default "/git-repo") -port int Port to listen on. (default 8888) ``` -------------------------------- ### Postsubmit Job Specification Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Example of the JSON-encoded job specification for a postsubmit Prow job. This format is used for jobs that run after a commit is merged. ```json {"type":"postsubmit","job":"job-name","buildid":"0","prowjobid":"uuid","refs":{"org":"org-name","repo":"repo-name","base_ref":"base-ref","base_sha":"base-sha"}} ``` -------------------------------- ### Show Prow-Controller-Manager Help Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/core/prow-controller-manager.md Run this command to display the help message for the prow-controller-manager, showing available flags and options. ```bash $ go run ./cmd/prow-controller-manager --help ``` -------------------------------- ### Presubmit Job Specification Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Example of the JSON-encoded job specification for a presubmit Prow job. This format is used for jobs that run before a commit is merged, typically for pull requests. ```json {"type":"presubmit","job":"job-name","buildid":"0","prowjobid":"uuid","refs":{"org":"org-name","repo":"repo-name","base_ref":"base-ref","base_sha":"base-sha","pulls":[{"number":1,"author":"author-name","sha":"pull-sha","title":"pull-title","head_ref":"pull-branch"}]}} ``` -------------------------------- ### Spyglass Lenses Configuration Example Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/spyglass/_index.md This YAML configuration demonstrates how to set up various Spyglass lenses, including metadata, buildlog, junit, and podinfo. It shows how to specify required and optional files, and configure lens-specific settings like highlight regexes and test group selectors. ```yaml deck: spyglass: size_limit: 100000000 # 100 MB gcs_browser_prefix: https://gcsweb.k8s.io/gcs/ testgrid_config: gs://k8s-testgrid/config testgrid_root: https://testgrid.k8s.io/ announcement: "The old job viewer has been deprecated." lenses: - lens: name: metadata required_files: - ^(?:started|finished)\.json$ optional_files: - ^(?:podinfo|prowjob)\.json$ - lens: name: buildlog config: highlight_regexes: - timed out - 'ERROR:' - (FAIL|Failure [\b) - panic\b - ^E\d{4} \d\d:\d\d:\d\d\.\d\d\d] required_files: - ^build-log\.txt$ - lens: name: junit config: # optional groups: - name: "Informing Tests" selector: "properties/property[@name='lifecycle' and @value='informing']" collapsed: true required_files: - ^artifacts/junit.*\.xml$ - lens: name: podinfo config: runner_configs: # Would only work if `prowjob.json` is configured below "": pod_link_template: "https:///{{ .Name }}" # Name is directly from the Pod struct. # Example: # "default": # pod_link_template: "https://console.cloud.google.com/kubernetes/pod/us-central1-f/prow/test-pods/{{ .Name }}/details?project=k8s-prow-builds" required_files: - ^podinfo\.json$ optional_files: - ^prowjob\.json$ # Only if runner_configs is configured. ``` -------------------------------- ### Get Prow Ingress IP Address Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/getting-started-deploy.md Retrieves the external IP address assigned to the Prow ingress. ```sh kubectl get ingress -n prow prow NAME CLASS HOSTS ADDRESS PORTS AGE prow prow.<> an.ip.addr.ess 80, 443 22d ``` -------------------------------- ### Get KUBECONFIG from KIND Cluster Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Retrieve the KUBECONFIG file from the created KIND cluster on the server machine. ```bash kind get kubeconfig --name kind-prow-integration > ~/kind-prow-integration-kubeconfig.yaml ``` -------------------------------- ### Configure Prometheus Push Gateway Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/jenkins-operator.md Example of configuring a Prometheus push gateway endpoint and interval in the Prow configuration. ```yaml push_gateway: endpoint: http://prometheus-push-gateway interval: 1m ``` -------------------------------- ### Postsubmit Job Configuration Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/jobs.md Example configuration for a postsubmit job. These jobs run after a push event to a repository. They can be filtered by branches and concurrency. ```yaml postsubmits: org/repo: - name: bar-job # As for periodics. decorate: true # As for periodics. spec: {} # As for periodics. max_concurrency: 10 # Run no more than this number concurrently. branches: # Regexps, only run against these branches. - ^main$ skip_branches: # Regexps, do not run against these branches. - ^release-.*$ ``` -------------------------------- ### Copy Tilt Settings File Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-tilt.md Copy the checked-in tilt-settings.yaml to your local directory to begin customizing Tilt settings. This file is git-ignored. ```bash cp tilt-settings.yaml tilt-settings.yaml # already there; just edit it ``` -------------------------------- ### Configure Job Labels for Jenkins Operator Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/jenkins-operator.md Example of setting labels in a Prow job configuration to enable sharding with the Jenkins operator. ```yaml presubmits: org/repo: - name: pull-request-unit agent: jenkins labels: master: jenkins-master always_run: true context: ci/prow/unit rerun_command: "/test unit" trigger: "((?m)^/test( all| unit),?(\s+|$))" ``` -------------------------------- ### Deploy Prow with Environment Variables Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/getting-started-deploy.md Deploys Prow using a starter manifest, substituting sensitive values from environment variables. ```sh export GITHUB_TOKEN= ... envsubst < starter-azure.yaml | kubectl apply -f - ``` -------------------------------- ### Configure Jenkins Operator Sharding Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/optional/jenkins-operator.md Example of configuring Jenkins operator sharding using label selectors in the Prow configuration file. ```yaml jenkins_operators: - label_selector: master=jenkins-master max_concurrency: 150 max_goroutines: 20 ``` -------------------------------- ### Configure a Periodic Job Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/core/horologium.md Example of configuring a periodic job with a name, interval, and spec. This is defined within the Prow job configuration. ```yaml periodics: - name: ci-example-periodic interval: 1h decorate: true spec: containers: - image: alpine command: - /bin/sh args: - -c - echo "hello from horologium" ``` -------------------------------- ### Container Command and Arguments Display Source: https://github.com/kubernetes-sigs/prow/blob/main/pkg/spyglass/lenses/podinfo/template.html Displays the container's command and arguments, including decorated arguments if present. Commands and arguments are formatted as code. ```go-template Command {{range $c.Command}} `{{.}}` {{end}} {{range $c.Args}} `{{.}}` {{end}} Decorated Command {{range .DecoratedArgs}} `{{.}}` {{end}} ``` -------------------------------- ### Example Hook Log Output Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/cli-tools/phony.md This log message from the hook component indicates a successful reception and processing of a 'pull_request' event sent by phony. ```json {"author":"","component":"hook","event-GUID":"GUID","event-type":"pull_request","level":"info","msg":"Pull request .", ``` -------------------------------- ### Bootstrap Prow Configuration Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/cli-tools/config-bootstrapper.md Use this command to bootstrap Prow's configuration files. Specify the source path for configuration files, the main config file, the plugin config file, and the directory for job configurations. Set `--dry-run=true` to preview changes without applying them. ```shell ./config-bootstrapper \ --dry-run=false \ --source-path=. \ --config-path=prowconfig/config.yaml \ --plugin-config=prowconfig/plugins.yaml \ --job-config-path=prowconfig/jobs ``` -------------------------------- ### Cloning a Repository from Local FGS Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/test/integration/fakegitserver.md This example shows how to clone a Git repository named 'foo' from a locally running FGS instance. It then navigates into the cloned repository and demonstrates performing Git operations like `git log` and `git push`. ```shell # Clone "foo" repo, assuming it exists locally under `-git-repos-parent-dir`. $ git clone http://localhost:8888/repo/foo $ cd foo $ git log # or any other arbitrary Git command # ... do some Git operations $ git push ``` -------------------------------- ### Reset Docker Service Configuration Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/local-dev-two-machines.md Resets the Docker service's ExecStart command to its default, ensuring it starts correctly after configuration changes. ```ini [Service] ExecStart= ExecStart=/usr/bin/dockerd ``` -------------------------------- ### Run Integration Test Without Setup Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/test/integration/_index.md Execute integration tests without re-deploying the test cluster. Use this when only test code has changed. ```bash ./test/integration/integration-test.sh -run=TestMostAwesomeComponent -no-setup ``` -------------------------------- ### Advanced ProwJob Configuration with Pod Utilities Source: https://github.com/kubernetes-sigs/prow/blob/main/site/content/en/docs/components/pod-utilities/_index.md This example showcases advanced Pod Utility configurations for ProwJobs, including SSH key secrets for private repositories, custom clone URIs, extra repository references with working directory settings, submodule control, and clone depth. ```yaml - name: post-job decorate: true decoration_config: ssh_key_secrets: - ssh-secret clone_uri: "git@github.com:/.git" extra_refs: - org: kubernetes repo: other-repo base_ref: master workdir: false skip_submodules: true clone_depth: 0 spec: containers: - image: alpine command: - "echo" args: - "The artifacts dir is $(ARTIFACTS)" ``` -------------------------------- ### CSRF Token and Google Analytics Setup Source: https://github.com/kubernetes-sigs/prow/blob/main/cmd/deck/template/base.html Sets up the CSRF token and conditionally includes Google Analytics tracking code or a placeholder function. ```html var csrfToken = {{csrfToken}}; {{if googleAnalytics}} window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', {{googleAnalytics}}); {{else}} function gtag() {} {{end}} ```