From 42934572e88a0831eac03173eceefd54ab974edf Mon Sep 17 00:00:00 2001 From: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> Date: Thu, 28 Oct 2021 13:31:47 +0100 Subject: [PATCH] [fluxcd] Initial integration (#6539) --- projects/fluxcd/Dockerfile | 29 ++++++++++++++++++ projects/fluxcd/build.sh | 58 ++++++++++++++++++++++++++++++++++++ projects/fluxcd/project.yaml | 13 ++++++++ 3 files changed, 100 insertions(+) create mode 100644 projects/fluxcd/Dockerfile create mode 100644 projects/fluxcd/build.sh create mode 100644 projects/fluxcd/project.yaml diff --git a/projects/fluxcd/Dockerfile b/projects/fluxcd/Dockerfile new file mode 100644 index 000000000..387215cad --- /dev/null +++ b/projects/fluxcd/Dockerfile @@ -0,0 +1,29 @@ +# Copyright 2021 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. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-go +RUN apt-get update && apt-get install -y wget zlib1g-dev pkg-config +RUN git clone --depth 1 --branch fuzz1 https://github.com/AdamKorcz/kustomize-controller +RUN git clone --depth 1 --branch fuzz1 https://github.com/AdamKorcz/pkg +RUN git clone --depth 1 --branch fuzz1 https://github.com/AdamKorcz/notification-controller + +# Go 1.16 is needed to build the notification-controller +RUN cd /tmp \ + && wget https://golang.org/dl/go1.16.8.linux-amd64.tar.gz \ + && tar -xf go1.16.8.linux-amd64.tar.gz + +COPY build.sh $SRC/ +WORKDIR $SRC diff --git a/projects/fluxcd/build.sh b/projects/fluxcd/build.sh new file mode 100644 index 000000000..e807c1b50 --- /dev/null +++ b/projects/fluxcd/build.sh @@ -0,0 +1,58 @@ +#!/bin/bash -eu +# Copyright 2021 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. +# +################################################################################ + +# Notification-controller + +# The notification-controller needs to be built with go 1.16 +export OLD_PATH=$PATH +export PATH=/tmp/go/bin:$PATH +# We are now using go 1.16 +cd $SRC/notification-controller/controllers +cp ../fuzzing/fuzz.go ./ +rm *_test.go +compile_go_fuzzer . Fuzz notification_fuzzer +export PATH=$OLD_PATH + +# Kustomize-controller: +cd $SRC/kustomize-controller +sed 's/filippo.io\/age v1.0.0-beta7/filippo.io\/age v1.0.0/g' -i go.mod +mv fuzz/fuzz.go ./controllers/ +cd controllers +rm ./*_test.go +compile_go_fuzzer . Fuzz kustomize_fuzzer + +# Pkg: +cd $SRC/pkg +mv ./fuzz/tls_fuzzer.go runtime/tls/ +mv ./fuzz/conditions_fuzzer.go ./runtime/conditions/ +go mod init pkg +cd fuzz +compile_go_fuzzer . FuzzUntar fuzz_untar +compile_go_fuzzer . FuzzLibGit2Error fuzz_libgit_2_error +compile_go_fuzzer . FuzzEventInfof fuzz_event_infof +cd - + +cd ./runtime/tls +compile_go_fuzzer . FuzzTlsConfig fuzz_tls_config +cd - + +cd ./runtime/conditions +compile_go_fuzzer . FuzzGetterConditions fuzz_getter_conditions +compile_go_fuzzer . FuzzConditionsMatch fuzz_conditions_match +compile_go_fuzzer . FuzzPatchApply fuzz_patch_apply +compile_go_fuzzer . FuzzConditionsUnstructured fuzz_conditions_unstructured +cd $SRC diff --git a/projects/fluxcd/project.yaml b/projects/fluxcd/project.yaml new file mode 100644 index 000000000..3e71ffe0d --- /dev/null +++ b/projects/fluxcd/project.yaml @@ -0,0 +1,13 @@ +homepage: "https://fluxcd.io/" +main_repo: "https://github.com/fluxcd/flux2" +primary_contact: "michael@weave.works" +auto_ccs : + - "stefan@weave.works" + - "hidde@weave.works" + - "david@adalogics.com" + - "adam@adalogics.com" +language: go +fuzzing_engines: + - libfuzzer +sanitizers: + - address