Skip to content

Commit 8e757ef

Browse files
authored
Merge branch 'google:master' into patch-1
2 parents 929c59c + ae4c7dc commit 8e757ef

File tree

81 files changed

+3798
-1510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3798
-1510
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
/bot/*
2323
/coverage
2424
/deployment
25+
/clusterfuzz-config
2526
/local/bin/android-sdk/*
2627
/local/storage
2728
/paramiko.log

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python 3.11.9
2+
gcloud 523.0.1

AGENTS.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Agent Instructions
2+
3+
This document provides instructions for agents on how to perform common development tasks in this repository.
4+
5+
## Initial Setup
6+
7+
This project uses `asdf` to manage tool versions. Before you can install the project's dependencies, you need to install and configure `asdf`.
8+
9+
### 1. Install `asdf`
10+
11+
First, make sure you have `git` and `curl` installed. Then, clone the `asdf` repository:
12+
13+
```bash
14+
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
15+
```
16+
17+
### 2. Configure Your Shell
18+
19+
Add `asdf` to your shell's startup file. For `bash`, run:
20+
21+
```bash
22+
echo -e "\n. \"$HOME/.asdf/asdf.sh\"" >> ~/.bashrc
23+
```
24+
25+
Then, source your `.bashrc` to apply the changes to your current session:
26+
27+
```bash
28+
source ~/.bashrc
29+
```
30+
31+
### 3. Install `asdf` Plugins and Tools
32+
33+
Now, from the root of this project, run the following commands to install the necessary `asdf` plugins and the tools specified in the `.tool-versions` file:
34+
35+
```bash
36+
asdf plugin add python
37+
asdf plugin add gcloud https://github.com/jthegedus/asdf-gcloud
38+
asdf install
39+
```
40+
41+
### 4. Install `pipenv`
42+
43+
Once `asdf` has installed the correct python version, you need to install `pipenv`:
44+
45+
```bash
46+
python -m pip install pipenv
47+
```
48+
49+
### 5. Install Project Dependencies
50+
51+
Now you are ready to install the project's dependencies. Run the following command from the root of the repository:
52+
53+
```bash
54+
./local/install_deps.bash
55+
```
56+
57+
## Testing
58+
59+
To run all unit tests, execute the following commands:
60+
61+
```bash
62+
python butler.py py_unittest -t appengine -m
63+
python butler.py py_unittest -t core -m
64+
```
65+
66+
The `-m` flag runs the tests in parallel, which is recommended.
67+
68+
## Linting
69+
70+
To check the code for style and linting issues, run the following command:
71+
72+
```bash
73+
python butler.py lint
74+
```
75+
76+
This will lint the changed code in your current branch.
77+
78+
## Formatting
79+
80+
To automatically format the code to match the project's style guidelines, run:
81+
82+
```bash
83+
python butler.py format
84+
```
85+
86+
This will format the changed code in your current branch.

butler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,10 @@ def main():
304304
parser_deploy.add_argument(
305305
'--prod', action='store_true', help='Deploy to production.')
306306
parser_deploy.add_argument(
307-
'--targets', nargs='*', default=['appengine', 'terraform', 'zips'])
307+
'--targets',
308+
nargs='*',
309+
default=['appengine', 'terraform', 'zips'],
310+
choices=['appengine', 'terraform', 'zips', 'test_deployment'])
308311
parser_deploy.add_argument(
309312
'--release',
310313
'-r',

configs/test/gae/prod3/cron.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ cron:
7070
schedule: every day 01:00
7171
target: cron-service
7272

73-
- description: Manage VMs.
74-
url: /manage-vms
75-
schedule: every 30 minutes
76-
target: cron-service
77-
7873
- description: Schedule corpus pruning task.
7974
url: /schedule-corpus-pruning
8075
schedule: every day 19:00

configs/test/k8s/manage-vms.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

configs/test/project.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,6 @@ env:
139139
# Pub/Sub topic for receiving issue updates.
140140
#issue_updates:
141141
#pubsub_topic: projects/test-project/topics/issue-updates
142+
143+
schedule_fuzz:
144+
cpu_limit: 100000

deploy/cloudbuild.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
steps:
16+
- name: gcr.io/cloud-builders/git
17+
entrypoint: bash
18+
args:
19+
- -c
20+
- |
21+
# First, clone the repository
22+
git config --global credential.helper gcloud.sh
23+
git clone https://clusterfuzz-config-472119376969-git.us-central1.sourcemanager.dev/clusterfuzz-testing/clusterfuzz-config.git /workspace/clusterfuzz-config
24+
25+
# Move into the repository directory
26+
cd /workspace/clusterfuzz-config
27+
28+
# Conditionally run 'git checkout'
29+
if [ -n "${_CLUSTERFUZZ_CONFIG_REVISION}" ]; then
30+
echo "✅ _CLUSTERFUZZ_CONFIG_REVISION is set. Checking out to commit: ${_CLUSTERFUZZ_CONFIG_REVISION}"
31+
git checkout "${_CLUSTERFUZZ_CONFIG_REVISION}"
32+
else
33+
echo "☑️ _CLUSTERFUZZ_CONFIG_REVISION is not set. Using the latest commit."
34+
fi
35+
36+
- name: gcr.io/cloud-builders/git
37+
entrypoint: bash
38+
args:
39+
- -c
40+
- |
41+
# Conditionally clone the upstream clusterfuzz and 'git checkout' if the revision is provided
42+
if [ -n "${_CLUSTERFUZZ_REVISION}" ]; then
43+
echo "✅ _CLUSTERFUZZ_REVISION is set. Checking out to commit: ${_CLUSTERFUZZ_REVISION}"
44+
git clone https://github.com/google/clusterfuzz.git
45+
cd clusterfuzz
46+
git checkout "${_CLUSTERFUZZ_REVISION}"
47+
else
48+
echo "☑️ _CLUSTERFUZZ_REVISION is not set. Using the latest commit."
49+
fi
50+
51+
- name: gcr.io/clusterfuzz-images/base:091c6c2-202409251610
52+
entrypoint: bash
53+
args:
54+
- -c
55+
- |
56+
# Conditionally run go into the cloned clusterfuzz
57+
if [ -n "${_CLUSTERFUZZ_REVISION}" ]; then
58+
cd clusterfuzz
59+
fi
60+
61+
# Install required deps for performing butler deploy
62+
bash ./local/install_deps.bash
63+
64+
# Get into the venv
65+
source "$$(python3.11 -m pipenv --venv)/bin/activate"
66+
67+
# Check if the _PROJECT substitution was provided.
68+
if [ -z "${_PROJECT}" ]; then
69+
echo "❌ Error: The _PROJECT substitution variable must be provided."
70+
exit 1
71+
fi
72+
73+
# Construct the full path using the substitution variable.
74+
configpath="/workspace/clusterfuzz-config/configs/${_PROJECT}"
75+
76+
# Verify that the configuration directory actually exists.
77+
if [ ! -d "$configpath" ]; then
78+
echo "❌ Error: Configuration directory not found at $configpath"
79+
exit 1
80+
fi
81+
82+
echo "✅ Running deploy for project config: $configpath"
83+
python3.11 butler.py deploy -c $configpath --prod --targets zips appengine --force
84+
85+
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
86+
entrypoint: bash
87+
args:
88+
- -c
89+
- |
90+
if [ -n "${_CLUSTERFUZZ_REVISION}" ]; then
91+
cd clusterfuzz
92+
fi
93+
CURRENT_CLUSTERFUZZ_REVISION="$(cat src/appengine/resources/clusterfuzz-source.manifest)"
94+
gcloud compute project-info add-metadata --metadata=clusterfuzz-revision="$${CURRENT_CLUSTERFUZZ_REVISION}" --project "${PROJECT_ID}"
95+
96+
timeout: 1200s
97+
options:
98+
machineType: E2_HIGHCPU_32
99+
diskSizeGb: 500
100+
logging: CLOUD_LOGGING_ONLY

docs/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ GEM
205205
rb-fsevent (~> 0.10, >= 0.10.3)
206206
rb-inotify (~> 0.9, >= 0.9.10)
207207
mercenary (0.3.6)
208-
mini_portile2 (2.8.8)
208+
mini_portile2 (2.8.9)
209209
minima (2.5.1)
210210
jekyll (>= 3.5, < 5.0)
211211
jekyll-feed (~> 0.9)
212212
jekyll-seo-tag (~> 2.1)
213213
minitest (5.19.0)
214-
nokogiri (1.18.8)
214+
nokogiri (1.18.9)
215215
mini_portile2 (~> 2.8.2)
216216
racc (~> 1.4)
217217
octokit (4.25.1)

docs/production-setup/setting_up_bots.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,9 @@ to deploy new changes.
184184

185185
### Google Compute Engine bots
186186

187-
Once deployed, bots are automatically created via an App Engine cron task that
188-
runs every *30 minutes*. For faster results, you can manually force it by
189-
visiting the `Cron jobs` page
190-
[here](https://console.cloud.google.com/appengine/cronjobs) and running the
191-
`/manage-vms` cron job.
187+
ClusterFuzz bots must be created (preferably by Terraform) following the configurations in configs/test/gce/clusters.yaml.
192188

193-
After the cron job finishes, check this
189+
After creation or update finishes, check
194190
[page](https://console.cloud.google.com/compute/instanceGroups/list) to ensure
195191
that all instances are created for this particular
196192
[instance group](#google-compute-engine-cluster).

0 commit comments

Comments
 (0)