|
| 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 |
0 commit comments