### 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