Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def _add_package_subparser(toplevel_subparsers):
'--release',
choices=['prod', 'candidate', 'chrome-tests-syncer'],
default='prod')
parser_package.add_argument(
'--custom-zip-name',
help='Custom name for the zip file (e.g. username.zip).')


def _add_bootstrap_subparser(toplevel_subparsers):
Expand Down Expand Up @@ -403,7 +406,12 @@ def main():
'--targets',
nargs='*',
default=['appengine', 'terraform', 'zips'],
choices=['appengine', 'terraform', 'zips', 'test_deployment'])
choices=[
'appengine', 'terraform', 'zips', 'test_deployment', 'custom_zip'
])
parser_deploy.add_argument(
'--custom-zip-name',
help='Custom name for the deployed zip package (defaults to git user).')
parser_deploy.add_argument(
'--release',
'-r',
Expand Down
2 changes: 1 addition & 1 deletion configs/test/bot/setup/android.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GOOGLE_CLOUD_SDK=google-cloud-sdk
GOOGLE_CLOUD_SDK_ARCHIVE=google-cloud-sdk-232.0.0-linux-x86_64.tar.gz
INSTALL_DIRECTORY=${INSTALL_DIRECTORY:-${HOME}}
DEPLOYMENT_BUCKET=${DEPLOYMENT_BUCKET:-"deployment.$CLOUD_PROJECT_ID.appspot.com"}
DEPLOYMENT_ZIP="linux-3.zip"
DEPLOYMENT_ZIP=${DEPLOYMENT_ZIP:-"linux-3.zip"}
GSUTIL_PATH="$INSTALL_DIRECTORY/$GOOGLE_CLOUD_SDK/bin"
ROOT_DIR="$INSTALL_DIRECTORY/clusterfuzz"
PYTHONPATH="$PYTHONPATH:$ROOT_DIR/src"
Expand Down
2 changes: 1 addition & 1 deletion configs/test/bot/setup/linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GOOGLE_CLOUD_SDK=google-cloud-sdk
GOOGLE_CLOUD_SDK_ARCHIVE=google-cloud-sdk-232.0.0-linux-x86_64.tar.gz
INSTALL_DIRECTORY=${INSTALL_DIRECTORY:-${HOME}}
DEPLOYMENT_BUCKET=${DEPLOYMENT_BUCKET:-"deployment.$CLOUD_PROJECT_ID.appspot.com"}
DEPLOYMENT_ZIP="linux-3.zip"
DEPLOYMENT_ZIP=${DEPLOYMENT_ZIP:-"linux-3.zip"}
GSUTIL_PATH="$INSTALL_DIRECTORY/$GOOGLE_CLOUD_SDK/bin"
ROOT_DIR="$INSTALL_DIRECTORY/clusterfuzz"
PYTHONPATH="$PYTHONPATH:$ROOT_DIR/src"
Expand Down
2 changes: 1 addition & 1 deletion configs/test/bot/setup/mac.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GOOGLE_CLOUD_SDK=google-cloud-sdk
GOOGLE_CLOUD_SDK_ARCHIVE=google-cloud-sdk-232.0.0-darwin-x86_64.tar.gz
INSTALL_DIRECTORY=${INSTALL_DIRECTORY:-${HOME}}
DEPLOYMENT_BUCKET=${DEPLOYMENT_BUCKET:-"deployment.$CLOUD_PROJECT_ID.appspot.com"}
DEPLOYMENT_ZIP="macos-3.zip"
DEPLOYMENT_ZIP=${DEPLOYMENT_ZIP:-"macos-3.zip"}
GSUTIL_PATH="$INSTALL_DIRECTORY/$GOOGLE_CLOUD_SDK/bin"
ROOT_DIR="$INSTALL_DIRECTORY/clusterfuzz"
PYTHONPATH="$PYTHONPATH:$ROOT_DIR/src"
Expand Down
29 changes: 27 additions & 2 deletions deploy/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,28 @@ steps:
exit 1
fi

echo "✅ Running deploy for project config: $configpath"
python3.11 butler.py deploy -c $configpath --prod --targets zips appengine --force
targets="${_TARGETS:-zips appengine}"
extra_args=""
if echo "$$targets" | grep -q "custom_zip"; then
if [ -n "${_CUSTOM_ZIP_NAME}" ]; then
extra_args="--custom-zip-name ${_CUSTOM_ZIP_NAME}"
fi
fi

echo "✅ Running deploy for project config: $configpath with targets: $$targets"
python3.11 butler.py deploy -c $configpath --prod --targets $$targets --force $$extra_args

- id: update project metadata with revision
name: gcr.io/google.com/cloudsdktool/cloud-sdk
entrypoint: bash
args:
- -c
- |
if echo "${_TARGETS:-zips appengine}" | grep -q "custom_zip"; then
echo "Skipping project metadata update for custom_zip deployment."
exit 0
fi

if [ -n "${_CLUSTERFUZZ_REVISION}" ]; then
cd clusterfuzz
fi
Expand Down Expand Up @@ -128,6 +141,10 @@ steps:
args:
- '-c'
- |
if echo "${_TARGETS:-zips appengine}" | grep -q "custom_zip"; then
echo "Skipping terraform init for custom_zip deployment."
exit 0
fi
cd /workspace/clusterfuzz-config/configs/${_PROJECT}/terraform
terraform init || exit 1

Expand All @@ -137,9 +154,17 @@ steps:
args:
- '-c'
- |
if echo "${_TARGETS:-zips appengine}" | grep -q "custom_zip"; then
echo "Skipping terraform apply for custom_zip deployment."
exit 0
fi
cd /workspace/clusterfuzz-config/configs/${_PROJECT}/terraform
terraform apply -target=module.compute -auto-approve || exit 1

substitutions:
_TARGETS: 'zips appengine'
_CUSTOM_ZIP_NAME: ''

timeout: 3000s
options:
machineType: E2_HIGHCPU_32
Expand Down
8 changes: 5 additions & 3 deletions docker/base/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
if [ -z "$DEPLOYMENT_ZIP" ]; then
DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi
fi
export DEPLOYMENT_ZIP

Expand Down
48 changes: 39 additions & 9 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ IMAGES=(
VERSION_TAG="latest"
GIT_HASH_ARG=""
PUSH="true"
SKIP_LATEST_TAG="false"
TARGET_IMAGE=""
REGISTRY_PREFIX=${REGISTRY_PREFIX:-"gcr.io/clusterfuzz-images"}
NEEDS_ROOT_PIPFILE=false

# Set up a trap to clean up Pipfiles on exit.
Expand All @@ -57,18 +60,41 @@ fi
while [[ "$#" -gt 0 ]]; do
case $1 in
--no-push) PUSH="false";;
--skip-latest-tag) SKIP_LATEST_TAG="true";;
--image) TARGET_IMAGE="$2"; shift;;
--image=*) TARGET_IMAGE="${1#*=}";;
--registry-prefix) REGISTRY_PREFIX="$2"; shift;;
--registry-prefix=*) REGISTRY_PREFIX="${1#*=}";;
--project) REGISTRY_PREFIX="gcr.io/$2"; shift;;
--project=*) REGISTRY_PREFIX="gcr.io/${1#*=}";;
"") ;; # Ignore empty arguments, which can be passed by Cloud Build.
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done

if [ -n "$TARGET_IMAGE" ]; then
FILTERED_IMAGES=()
for img in "${IMAGES[@]}"; do
if [[ "$img" == *"$TARGET_IMAGE"* ]]; then
FILTERED_IMAGES+=("$img")
fi
done
if [ ${#FILTERED_IMAGES[@]} -eq 0 ]; then
echo "No images matching target '$TARGET_IMAGE'"
exit 1
fi
IMAGES=("${FILTERED_IMAGES[@]}")
fi

function docker_push {
if [ "$PUSH" == "true" ]; then
docker push "$image_with_version_tag"
if [ "$SKIP_LATEST_TAG" != "true" ]; then
docker push "$image_with_version_tag"
fi
docker push "$image_with_stamp"
else
echo "Skipping push for $image_with_version_tag."
echo "Skipping push for $image_with_stamp."
fi
}

Expand All @@ -85,8 +111,9 @@ else
stamp="$VERSION_TAG-$GIT_HASH-$DATE_STAMP"
fi

for image_name in "${IMAGES[@]}"; do
image_dir=${image_name#gcr.io/clusterfuzz-images/}
for image_path in "${IMAGES[@]}"; do
image_dir=${image_path#gcr.io/clusterfuzz-images/}
image_name="$REGISTRY_PREFIX/$image_dir"

if [ "$VERSION_TAG" == "latest" ]; then
dockerfile="$image_dir/Dockerfile"
Expand All @@ -102,22 +129,25 @@ for image_name in "${IMAGES[@]}"; do
image_with_version_tag="$image_name:$VERSION_TAG"
image_with_stamp="$image_name:$stamp"

# Copy Pipfile to base for the ubuntu-24.04 build, as it's
# needed but not in the build context.
if [[ "$image_dir" == "base" && "$dockerfile" == *"ubuntu-24-04"* ]]; then
# Copy Pipfile to base as it's needed but not in the base build context.
if [[ "$image_dir" == "base" ]]; then
NEEDS_ROOT_PIPFILE=true
cp ../Pipfile ../Pipfile.lock base/
fi

docker build -t "$image_with_version_tag" -f "$dockerfile" "$image_dir"
if [ "$SKIP_LATEST_TAG" == "true" ]; then
docker build -t "$image_with_stamp" -f "$dockerfile" "$image_dir"
else
docker build -t "$image_with_version_tag" -f "$dockerfile" "$image_dir"
docker tag "$image_with_version_tag" "$image_with_stamp"
fi

# Clean up the copied files.
if [[ "$NEEDS_ROOT_PIPFILE" == "true" ]]; then
rm base/Pipfile base/Pipfile.lock
NEEDS_ROOT_PIPFILE=false
fi

docker tag "$image_with_version_tag" "$image_with_stamp"
docker_push
done

Expand Down
14 changes: 8 additions & 6 deletions docker/chromium/base/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
# limitations under the License.


DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi
if [ -z "$DEPLOYMENT_ZIP" ]; then
DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi

if [ ! -z $USE_TEST_DEPLOYMENT ]; then
DEPLOYMENT_ZIP="test-deployment/$DEPLOYMENT_ZIP"
if [ ! -z $USE_TEST_DEPLOYMENT ]; then
DEPLOYMENT_ZIP="test-deployment/$DEPLOYMENT_ZIP"
fi
fi

export DEPLOYMENT_ZIP
Expand Down
8 changes: 5 additions & 3 deletions docker/chromium/builder/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
if [ -z "$DEPLOYMENT_ZIP" ]; then
DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi
fi
export DEPLOYMENT_ZIP

Expand Down
2 changes: 1 addition & 1 deletion docker/chromium/tests-syncer/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DEPLOYMENT_ZIP="linux-3-chrome-tests-syncer.zip"
DEPLOYMENT_ZIP=${DEPLOYMENT_ZIP:-"linux-3-chrome-tests-syncer.zip"}

export DEPLOYMENT_ZIP

Expand Down
8 changes: 5 additions & 3 deletions docker/fuchsia/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
if [ -z "$DEPLOYMENT_ZIP" ]; then
DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi
fi
export DEPLOYMENT_ZIP

Expand Down
8 changes: 5 additions & 3 deletions docker/oss-fuzz/base/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
if [ -z "$DEPLOYMENT_ZIP" ]; then
DEPLOYMENT_ZIP="linux-3.zip"
if [[ $CLUSTERFUZZ_RELEASE == "candidate" ]]; then
DEPLOYMENT_ZIP="linux-3-candidate.zip"
fi
fi
export DEPLOYMENT_ZIP

Expand Down
2 changes: 2 additions & 0 deletions src/appengine/handlers/fuzzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def apply_fuzzer_changes(self, fuzzer, upload_info):
differential = bool(request.get('differential', False))
environment_string = request.get('additional_environment_string')
data_bundle_name = request.get('data_bundle_name')
primary_owner = request.get('primary_owner')

# Save the fuzzer file metadata.
if upload_info:
Expand All @@ -194,6 +195,7 @@ def apply_fuzzer_changes(self, fuzzer, upload_info):
fuzzer.sample_testcase = None
fuzzer.console_output = None
fuzzer.external_contribution = external_contribution
fuzzer.primary_owner = primary_owner
fuzzer.trusted = trusted
fuzzer.differential = differential
fuzzer.additional_environment_string = environment_string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@
title="Name of fuzzer. Allowed characters include letters, numbers, dashes and underscores.">
</paper-input>
</div>
<div class="inline narrow">
<paper-input
label="Primary owner (email)"
value="{{fuzzer.primary_owner}}"
title="Primary owner for VRP rewards.">
</paper-input>
</div>
<div class="inline narrow">
<paper-menu-button
class="job-select dropdown-filter"
Expand Down Expand Up @@ -257,6 +264,7 @@
'differential',
'executable_path',
'external_contribution',
'primary_owner',
'jobs',
'launcher_script',
'max_testcases',
Expand Down
4 changes: 3 additions & 1 deletion src/clusterfuzz/_internal/base/concurrency.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def make_pool(pool_size=POOL_SIZE, max_pool_size=None, use_threads=False):
if max_pool_size is not None:
pool_size = min(pool_size, max_pool_size)

# Don't use processes on Windows and unittests to avoid hangs.
# Use threads if explicitly requested (e.g. for I/O bound tasks like GCS ops
# to avoid multiprocessing memory overhead), or on Windows/unittests to
# avoid hangs.
if (use_threads or environment.get_value('PY_UNITTESTS') or
environment.platform() == 'WINDOWS'):
yield futures.ThreadPoolExecutor(pool_size)
Expand Down
3 changes: 2 additions & 1 deletion src/clusterfuzz/_internal/bot/tasks/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def _copy_testcase_to_device_and_setup_environment(testcase,
relative_testcase_file_path = (
testcase_file_path[len(local_testcases_directory) + 1:])
device_testcase_file_path = os.path.join(
android.constants.DEVICE_TESTCASES_DIR, relative_testcase_file_path)
android.constants.get_testcases_directory(),
relative_testcase_file_path)
android.adb.run_shell_command(['chmod', '0755', device_testcase_file_path])


Expand Down
Loading
Loading