Skip to content

Commit

Permalink
Add cloudbuild for building chronos images for all C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverchang committed Oct 1, 2024
1 parent 84140e9 commit e390a00
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
3 changes: 3 additions & 0 deletions infra/experimental/chronos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM gcr.io/cloud-builders/gcloud

RUN apt-get update && apt-get install -y jq
27 changes: 27 additions & 0 deletions infra/experimental/chronos/build_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Copyright 2024 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

# Build all C/C++ projects.
c_project_yaml=$(find projects/ -name project.yaml -exec grep -l 'language: c' {} \;)
projs=$(echo $c_project_yaml | xargs dirname | xargs basename -a | sort)

for proj in $projs; do
fuzz_target=$(curl -s "https://introspector.oss-fuzz.com/api/harness-source-and-executable?project=$proj" | jq --raw-output '.pairs[0].executable')
if [ "$fuzz_target" != null ]; then
echo ./build_on_cloudbuild.sh $proj $fuzz_target c
fi
done
5 changes: 4 additions & 1 deletion infra/experimental/chronos/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ images:
timeout: 1800s
serviceAccount: 'projects/oss-fuzz/serviceAccounts/[email protected]'
options:
logging: CLOUD_LOGGING_ONLY
logging: CLOUD_LOGGING_ONLY
tags:
- ${_PROJECT}
- chronos
34 changes: 34 additions & 0 deletions infra/experimental/chronos/cloudbuild_all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
# CloudBuild for generating Chronos-cached images.
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- build
- -t
- gcloud
- .
dir: infra/experimental/chronos
- name: 'gcloud'
args:
- infra/experimental/chronos/build_all.sh
entrypoint: /bin/bash
timeout: 1800s
serviceAccount: 'projects/oss-fuzz/serviceAccounts/[email protected]'
options:
logging: CLOUD_LOGGING_ONLY
tags:
- chronos-all

0 comments on commit e390a00

Please sign in to comment.