From 881e613175e9211c0c20d687738943a9c5a42434 Mon Sep 17 00:00:00 2001 From: Anurag Rajawat Date: Thu, 19 Sep 2024 19:37:47 +0530 Subject: [PATCH] chore: Add License Signed-off-by: Anurag Rajawat --- .licenserc.yaml | 2 ++ protobuf/Makefile | 3 +++ scripts/add-license-header | 20 +++++++++++++++++++ scripts/license.header | 2 ++ sentryflow/Dockerfile | 3 +++ sentryflow/Makefile | 3 +++ sentryflow/cmd/root.go | 3 +++ sentryflow/cmd/version.go | 3 +++ sentryflow/main.go | 3 +++ sentryflow/pkg/config/config.go | 3 +++ sentryflow/pkg/core/sentryflow.go | 3 +++ sentryflow/pkg/core/server.go | 3 +++ sentryflow/pkg/exporter/exporter.go | 3 +++ sentryflow/pkg/k8s/client.go | 3 +++ sentryflow/pkg/receiver/receiver.go | 3 +++ .../receiver/svcmesh/istio/sidecar/sidecar.go | 3 +++ sentryflow/pkg/util/util.go | 3 +++ 17 files changed, 66 insertions(+) create mode 100755 scripts/add-license-header create mode 100644 scripts/license.header diff --git a/.licenserc.yaml b/.licenserc.yaml index b683404..06090b9 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -12,6 +12,8 @@ header: paths-ignore: - "protobuf/*" + # Explicitly mention generated go files otherwise the check won't pass. + - "protobuf/**/*.go" comment: on-failure diff --git a/protobuf/Makefile b/protobuf/Makefile index 9297546..680c490 100644 --- a/protobuf/Makefile +++ b/protobuf/Makefile @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Authors of SentryFlow + PROTOS:="sentryflow.proto sentryflow_metrics.proto" .PHONY: help diff --git a/scripts/add-license-header b/scripts/add-license-header new file mode 100755 index 0000000..a92bfb5 --- /dev/null +++ b/scripts/add-license-header @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Authors of SentryFlow + +if ! command -v addlicense >/dev/null; then + echo "Installing addlicense..." + go install github.com/google/addlicense@latest +fi + +GIT_ROOT=$(git rev-parse --show-toplevel) +LICENSE_HEADER=${GIT_ROOT}/scripts/license.header + +if [ -z "$1" ]; then + echo "No Argument Supplied, Checking and Fixing all files from project root" + find "${GIT_ROOT}" -name "*.sh" -or -name "*.go" | xargs -I {} addlicense -f "${LICENSE_HEADER}" -v {} + echo "Done" +else + addlicense -f "${LICENSE_HEADER}" -v "$1" + echo "Done" +fi diff --git a/scripts/license.header b/scripts/license.header new file mode 100644 index 0000000..d7c0bd6 --- /dev/null +++ b/scripts/license.header @@ -0,0 +1,2 @@ +SPDX-License-Identifier: Apache-2.0 +Copyright 2024 Authors of SentryFlow diff --git a/sentryflow/Dockerfile b/sentryflow/Dockerfile index f32d173..cf00c0f 100644 --- a/sentryflow/Dockerfile +++ b/sentryflow/Dockerfile @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Authors of SentryFlow + FROM golang:1.23 AS builder ARG TARGETOS diff --git a/sentryflow/Makefile b/sentryflow/Makefile index 620435f..f51bbb1 100644 --- a/sentryflow/Makefile +++ b/sentryflow/Makefile @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Authors of SentryFlow + BINARY_NAME ?= sentryflow REGISTRY ?= docker.io/5gsec VERSION ?= $(shell git rev-parse HEAD) diff --git a/sentryflow/cmd/root.go b/sentryflow/cmd/root.go index 273c9d4..743831b 100644 --- a/sentryflow/cmd/root.go +++ b/sentryflow/cmd/root.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package cmd import ( diff --git a/sentryflow/cmd/version.go b/sentryflow/cmd/version.go index 5a78250..481032f 100644 --- a/sentryflow/cmd/version.go +++ b/sentryflow/cmd/version.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package cmd import ( diff --git a/sentryflow/main.go b/sentryflow/main.go index 6163445..87ed3e2 100644 --- a/sentryflow/main.go +++ b/sentryflow/main.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package main import ( diff --git a/sentryflow/pkg/config/config.go b/sentryflow/pkg/config/config.go index be6b0bf..44b3aa0 100644 --- a/sentryflow/pkg/config/config.go +++ b/sentryflow/pkg/config/config.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package config import ( diff --git a/sentryflow/pkg/core/sentryflow.go b/sentryflow/pkg/core/sentryflow.go index 55e6e10..84bb4cc 100644 --- a/sentryflow/pkg/core/sentryflow.go +++ b/sentryflow/pkg/core/sentryflow.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package core import ( diff --git a/sentryflow/pkg/core/server.go b/sentryflow/pkg/core/server.go index 6347eac..b2e303c 100644 --- a/sentryflow/pkg/core/server.go +++ b/sentryflow/pkg/core/server.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package core import ( diff --git a/sentryflow/pkg/exporter/exporter.go b/sentryflow/pkg/exporter/exporter.go index 0363778..e59061d 100644 --- a/sentryflow/pkg/exporter/exporter.go +++ b/sentryflow/pkg/exporter/exporter.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package exporter import ( diff --git a/sentryflow/pkg/k8s/client.go b/sentryflow/pkg/k8s/client.go index b6b0e8d..9d74f60 100644 --- a/sentryflow/pkg/k8s/client.go +++ b/sentryflow/pkg/k8s/client.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package k8s import ( diff --git a/sentryflow/pkg/receiver/receiver.go b/sentryflow/pkg/receiver/receiver.go index a04aa0c..31bee4e 100644 --- a/sentryflow/pkg/receiver/receiver.go +++ b/sentryflow/pkg/receiver/receiver.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package receiver import ( diff --git a/sentryflow/pkg/receiver/svcmesh/istio/sidecar/sidecar.go b/sentryflow/pkg/receiver/svcmesh/istio/sidecar/sidecar.go index 00d311b..191bdb1 100644 --- a/sentryflow/pkg/receiver/svcmesh/istio/sidecar/sidecar.go +++ b/sentryflow/pkg/receiver/svcmesh/istio/sidecar/sidecar.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package sidecar import ( diff --git a/sentryflow/pkg/util/util.go b/sentryflow/pkg/util/util.go index 3e23c65..d950d47 100644 --- a/sentryflow/pkg/util/util.go +++ b/sentryflow/pkg/util/util.go @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Authors of SentryFlow + package util import (