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/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 814617e..1da0e3a 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 6dbda0f..17a8bce 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 77d5f89..6fcfd4c 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/config/default.yaml b/sentryflow/config/default.yaml index da0a9bb..1eb007b 100644 --- a/sentryflow/config/default.yaml +++ b/sentryflow/config/default.yaml @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Authors of SentryFlow + filters: envoy: sha256: 809145740ed57c96093b770ff8049436b81b0d3f738388017fb84e8849999d07 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 f675851..9dadf73 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 09b95b9..7ad4b8c 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 677aed9..3aa780b 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 61dfb70..7ce61a7 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 97f2681..1db8ba3 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 d650791..7c93a7d 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 69b9275..910ad2a 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 (