From 10571d97aad122f42b36801b2e4e28067642b308 Mon Sep 17 00:00:00 2001 From: Kaung Zin Hein <83657429+Zen-cronic@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:05:15 -0400 Subject: [PATCH] Add copyright/license headers to script files (#5829) ## Which problem is this PR solving? - Resolves #5827 ## Description of the changes - Update the `update_go_license` function to handle the `.sh` files and makefiles - Update the [ALL_SRC](https://github.com/jaegertracing/jaeger/blob/dc49b1faaeee15c2498c562309bab4fc0525bd56/Makefile#L32) variable in the main `Makefile` to include the new file types, which in turn updates the `lint` and `fmt` targets ## How was this change tested? - ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Kaung Zin Hein Signed-off-by: Yuri Shkuro Co-authored-by: Yuri Shkuro --- Makefile | 12 +++- cmd/agent/Dockerfile | 3 + cmd/all-in-one/Dockerfile | 3 + cmd/anonymizer/Dockerfile | 3 + cmd/collector/Dockerfile | 3 + cmd/es-index-cleaner/Dockerfile | 3 + cmd/es-rollover/Dockerfile | 3 + cmd/ingester/Dockerfile | 3 + cmd/jaeger/Dockerfile | 3 + cmd/query/Dockerfile | 3 + cmd/remote-storage/Dockerfile | 3 + cmd/tracegen/Dockerfile | 3 + crossdock/Dockerfile | 3 + crossdock/rules.mk | 3 + docker-compose/monitor/Makefile | 3 + docker/Makefile | 3 + docker/base/Dockerfile | 3 + docker/debug/Dockerfile | 3 + examples/hotrod/Dockerfile | 3 + pkg/config/tlscfg/testdata/gen-certs.sh | 3 + plugin/storage/cassandra/Dockerfile | 3 + plugin/storage/cassandra/schema/create.sh | 3 + plugin/storage/cassandra/schema/docker.sh | 3 + .../cassandra/schema/migration/V002toV003.sh | 3 + .../schema/migration/v001tov002part1.sh | 3 + .../schema/migration/v001tov002part2.sh | 3 + scripts/adaptive-sampling-integration-test.sh | 3 + scripts/build-all-in-one-image.sh | 3 + scripts/build-crossdock.sh | 3 + scripts/build-upload-a-docker-image.sh | 3 + scripts/build-upload-docker-images.sh | 3 + scripts/cassandra-integration-test.sh | 3 + scripts/check-go-version.sh | 3 + scripts/check-goleak-files.sh | 3 + scripts/check-semconv-version.sh | 3 + scripts/compare_metrics.py | 3 + scripts/compute-tags.sh | 3 + scripts/compute-tags.test.sh | 3 + scripts/dco_check.py | 3 + scripts/docker-login.sh | 3 + scripts/draft-release.py | 3 + scripts/es-integration-test.sh | 3 + scripts/generate-help-output.sh | 3 + scripts/hotrod-integration-test.sh | 3 + scripts/import-order-cleanup.py | 3 + scripts/kafka-integration-test.sh | 3 + scripts/package-deploy.sh | 3 + scripts/rebuild-ui.sh | 3 + scripts/release-notes.py | 3 + scripts/spm-integration-test.sh | 3 + scripts/update-semconv-version.sh | 3 + scripts/updateLicense.py | 56 ++++++++++++++++--- scripts/utils/ids-to-base64.py | 3 + 53 files changed, 210 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index eaf9228b29b..be4ef9c8fe0 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,14 @@ ALL_SRC = $(shell find . -name '*.go' \ -type f | \ sort) +# All .sh or .py or Makefile or .mk files that should be auto-formatted and linted. +SCRIPTS_SRC = $(shell find . \( -name '*.sh' -o -name '*.py' -o -name '*.mk' -o -name 'Makefile*' -o -name 'Dockerfile*' \) \ + -not -path './.git/*' \ + -not -path './idl/*' \ + -not -path './jaeger-ui/*' \ + -type f | \ + sort) + # ALL_PKGS is used with 'nocover' and 'goleak' ALL_PKGS = $(shell echo $(dir $(ALL_SRC)) | tr ' ' '\n' | sort -u) @@ -185,11 +193,11 @@ fmt: $(GOFUMPT) @echo Running gofumpt on ALL_SRC ... @$(GOFUMPT) -e -l -w $(ALL_SRC) @echo Running updateLicense.py on ALL_SRC ... - @./scripts/updateLicense.py $(ALL_SRC) + @./scripts/updateLicense.py $(ALL_SRC) $(SCRIPTS_SRC) .PHONY: lint lint: $(LINT) goleak - @./scripts/updateLicense.py $(ALL_SRC) > $(FMT_LOG) + @./scripts/updateLicense.py $(ALL_SRC) $(SCRIPTS_SRC) > $(FMT_LOG) @./scripts/import-order-cleanup.py -o stdout -t $(ALL_SRC) > $(IMPORT_LOG) @[ ! -s "$(FMT_LOG)" -a ! -s "$(IMPORT_LOG)" ] || (echo "License check or import ordering failures, run 'make fmt'" | cat - $(FMT_LOG) $(IMPORT_LOG) && false) ./scripts/check-semconv-version.sh diff --git a/cmd/agent/Dockerfile b/cmd/agent/Dockerfile index ae6e3378871..59b6c3c3fc9 100644 --- a/cmd/agent/Dockerfile +++ b/cmd/agent/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/all-in-one/Dockerfile b/cmd/all-in-one/Dockerfile index 5648eedc91d..394bb1d39b1 100644 --- a/cmd/all-in-one/Dockerfile +++ b/cmd/all-in-one/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/anonymizer/Dockerfile b/cmd/anonymizer/Dockerfile index 754c9dc8237..85456ce107b 100644 --- a/cmd/anonymizer/Dockerfile +++ b/cmd/anonymizer/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM scratch ARG TARGETARCH ARG USER_UID=10001 diff --git a/cmd/collector/Dockerfile b/cmd/collector/Dockerfile index 9cfc0e37362..649ed004372 100644 --- a/cmd/collector/Dockerfile +++ b/cmd/collector/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/es-index-cleaner/Dockerfile b/cmd/es-index-cleaner/Dockerfile index 3712c36c19f..54d927b4bb7 100644 --- a/cmd/es-index-cleaner/Dockerfile +++ b/cmd/es-index-cleaner/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image FROM $base_image AS release diff --git a/cmd/es-rollover/Dockerfile b/cmd/es-rollover/Dockerfile index d8764d249a6..36d0bb17afd 100644 --- a/cmd/es-rollover/Dockerfile +++ b/cmd/es-rollover/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image FROM $base_image AS release diff --git a/cmd/ingester/Dockerfile b/cmd/ingester/Dockerfile index 12bb8a5e144..1b131522c8d 100644 --- a/cmd/ingester/Dockerfile +++ b/cmd/ingester/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/jaeger/Dockerfile b/cmd/jaeger/Dockerfile index c9dcb240368..1028c8c58b8 100644 --- a/cmd/jaeger/Dockerfile +++ b/cmd/jaeger/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/query/Dockerfile b/cmd/query/Dockerfile index 1a92d1f060a..bfe003c373c 100644 --- a/cmd/query/Dockerfile +++ b/cmd/query/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/remote-storage/Dockerfile b/cmd/remote-storage/Dockerfile index 359a750b2d1..95fba6948d1 100644 --- a/cmd/remote-storage/Dockerfile +++ b/cmd/remote-storage/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + ARG base_image ARG debug_image diff --git a/cmd/tracegen/Dockerfile b/cmd/tracegen/Dockerfile index 138f9b5bce4..b2dcd926352 100644 --- a/cmd/tracegen/Dockerfile +++ b/cmd/tracegen/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM scratch ARG TARGETARCH ARG USER_UID=10001 diff --git a/crossdock/Dockerfile b/crossdock/Dockerfile index 2d17d240981..544fb29dceb 100644 --- a/crossdock/Dockerfile +++ b/crossdock/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM scratch ARG TARGETARCH diff --git a/crossdock/rules.mk b/crossdock/rules.mk index 8d4ca66fb3d..c6ec946b8ec 100644 --- a/crossdock/rules.mk +++ b/crossdock/rules.mk @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + XDOCK_YAML=crossdock/docker-compose.yml JAEGER_COMPOSE_YAML ?= crossdock/jaeger-docker-compose.yml diff --git a/docker-compose/monitor/Makefile b/docker-compose/monitor/Makefile index e5d53688124..b4bee22b110 100644 --- a/docker-compose/monitor/Makefile +++ b/docker-compose/monitor/Makefile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + BINARY ?= all-in-one # Default value uses v1 binary .PHONY: build diff --git a/docker/Makefile b/docker/Makefile index 3edf6d8803e..777085d489b 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + VERSION := 1.0.0 DOCKER_REGISTRY ?= localhost:5000 diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 3e0a3b38400..f7a04c05f8e 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM alpine:3.20.2 AS cert RUN apk add --update --no-cache ca-certificates mailcap diff --git a/docker/debug/Dockerfile b/docker/debug/Dockerfile index 8413e09c72b..b3fcbf724a9 100644 --- a/docker/debug/Dockerfile +++ b/docker/debug/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM golang:1.22.6-alpine AS build ARG TARGETARCH ENV GOPATH /go diff --git a/examples/hotrod/Dockerfile b/examples/hotrod/Dockerfile index b93de0e6151..3916c5b75b4 100644 --- a/examples/hotrod/Dockerfile +++ b/examples/hotrod/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM scratch ARG TARGETARCH EXPOSE 8080 8081 8082 8083 diff --git a/pkg/config/tlscfg/testdata/gen-certs.sh b/pkg/config/tlscfg/testdata/gen-certs.sh index dcdf31f086d..9d5d8e3135f 100755 --- a/pkg/config/tlscfg/testdata/gen-certs.sh +++ b/pkg/config/tlscfg/testdata/gen-certs.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # The following commands were used to create the CA, server and client's certificates and keys in this directory used by unit tests. # These certificates use the Subject Alternative Name extension rather than the Common Name, which will be unsupported in Go 1.15. diff --git a/plugin/storage/cassandra/Dockerfile b/plugin/storage/cassandra/Dockerfile index 994cde43a20..98070005738 100644 --- a/plugin/storage/cassandra/Dockerfile +++ b/plugin/storage/cassandra/Dockerfile @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + FROM cassandra:5.0 COPY schema/* /cassandra-schema/ diff --git a/plugin/storage/cassandra/schema/create.sh b/plugin/storage/cassandra/schema/create.sh index b53c15b3708..fe539de67a9 100755 --- a/plugin/storage/cassandra/schema/create.sh +++ b/plugin/storage/cassandra/schema/create.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + function usage { >&2 echo "Error: $1" >&2 echo "" diff --git a/plugin/storage/cassandra/schema/docker.sh b/plugin/storage/cassandra/schema/docker.sh index 785d74b0573..942d478d6a8 100755 --- a/plugin/storage/cassandra/schema/docker.sh +++ b/plugin/storage/cassandra/schema/docker.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 # # This script is used in the Docker image jaegertracing/jaeger-cassandra-schema # that allows installing Jaeger keyspace and schema without installing cqlsh. diff --git a/plugin/storage/cassandra/schema/migration/V002toV003.sh b/plugin/storage/cassandra/schema/migration/V002toV003.sh index b0a531b2995..cc1bcedb689 100755 --- a/plugin/storage/cassandra/schema/migration/V002toV003.sh +++ b/plugin/storage/cassandra/schema/migration/V002toV003.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # Create a new operation_names_v2 table and copy all data from operation_names table # Sample usage: KEYSPACE=jaeger_v1 CQL_CMD='cqlsh host 9042 -u test_user -p test_password --request-timeout=3000' bash # ./v002tov003.sh diff --git a/plugin/storage/cassandra/schema/migration/v001tov002part1.sh b/plugin/storage/cassandra/schema/migration/v001tov002part1.sh index 7d3ab108ace..c39bba9194b 100755 --- a/plugin/storage/cassandra/schema/migration/v001tov002part1.sh +++ b/plugin/storage/cassandra/schema/migration/v001tov002part1.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euo pipefail function usage { diff --git a/plugin/storage/cassandra/schema/migration/v001tov002part2.sh b/plugin/storage/cassandra/schema/migration/v001tov002part2.sh index 23933f82c51..506e4b48974 100755 --- a/plugin/storage/cassandra/schema/migration/v001tov002part2.sh +++ b/plugin/storage/cassandra/schema/migration/v001tov002part2.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euo pipefail function usage { diff --git a/scripts/adaptive-sampling-integration-test.sh b/scripts/adaptive-sampling-integration-test.sh index 99be9e59fd1..dac7a6e86c1 100644 --- a/scripts/adaptive-sampling-integration-test.sh +++ b/scripts/adaptive-sampling-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail # This script is currently a placeholder. diff --git a/scripts/build-all-in-one-image.sh b/scripts/build-all-in-one-image.sh index f693b0e1398..b73e24dbe51 100755 --- a/scripts/build-all-in-one-image.sh +++ b/scripts/build-all-in-one-image.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail print_help() { diff --git a/scripts/build-crossdock.sh b/scripts/build-crossdock.sh index b4fc2b7eaec..30b8f3b3469 100755 --- a/scripts/build-crossdock.sh +++ b/scripts/build-crossdock.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euxf -o pipefail BRANCH=${BRANCH:?'missing BRANCH env var'} diff --git a/scripts/build-upload-a-docker-image.sh b/scripts/build-upload-a-docker-image.sh index a1b9961c139..2712200696c 100644 --- a/scripts/build-upload-a-docker-image.sh +++ b/scripts/build-upload-a-docker-image.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail base_debug_img_arg="" diff --git a/scripts/build-upload-docker-images.sh b/scripts/build-upload-docker-images.sh index 2c8e6893764..635284e8c62 100755 --- a/scripts/build-upload-docker-images.sh +++ b/scripts/build-upload-docker-images.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail print_help() { diff --git a/scripts/cassandra-integration-test.sh b/scripts/cassandra-integration-test.sh index 0cd685d4c68..8e6bfd784e6 100755 --- a/scripts/cassandra-integration-test.sh +++ b/scripts/cassandra-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -uxf -o pipefail usage() { diff --git a/scripts/check-go-version.sh b/scripts/check-go-version.sh index 20c2720f3bc..42052affa7c 100755 --- a/scripts/check-go-version.sh +++ b/scripts/check-go-version.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + version_regex='[0-9]\.[0-9][0-9]' update=false verbose=false diff --git a/scripts/check-goleak-files.sh b/scripts/check-goleak-files.sh index e15fc790e57..7e97bcba81b 100755 --- a/scripts/check-goleak-files.sh +++ b/scripts/check-goleak-files.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euo pipefail bad_pkgs=0 diff --git a/scripts/check-semconv-version.sh b/scripts/check-semconv-version.sh index 38d6fae1b32..e5ed500a1ff 100755 --- a/scripts/check-semconv-version.sh +++ b/scripts/check-semconv-version.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail package_name="go.opentelemetry.io/otel/semconv" diff --git a/scripts/compare_metrics.py b/scripts/compare_metrics.py index a34d25556b8..36fe190d592 100644 --- a/scripts/compare_metrics.py +++ b/scripts/compare_metrics.py @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + import json v1_metrics_path = "./V1_Metrics.json" diff --git a/scripts/compute-tags.sh b/scripts/compute-tags.sh index 9c6038a7a92..143fb9670ab 100644 --- a/scripts/compute-tags.sh +++ b/scripts/compute-tags.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # Compute major/minor/etc image tags based on the current branch set -ef -o pipefail diff --git a/scripts/compute-tags.test.sh b/scripts/compute-tags.test.sh index 3935106d391..01f61ae8b49 100644 --- a/scripts/compute-tags.test.sh +++ b/scripts/compute-tags.test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # This script uses https://github.com/kward/shunit2 to run unit tests. # The path to this repo must be provided via SHUNIT2 env var. diff --git a/scripts/dco_check.py b/scripts/dco_check.py index cc3a3481bf5..f737c3c9124 100644 --- a/scripts/dco_check.py +++ b/scripts/dco_check.py @@ -1,3 +1,6 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # Script copied from https://github.com/christophebedard/dco-check/blob/master/dco_check/dco_check.py # # Copyright 2020 Christophe Bedard diff --git a/scripts/docker-login.sh b/scripts/docker-login.sh index 22561d1d84b..2090b48176a 100644 --- a/scripts/docker-login.sh +++ b/scripts/docker-login.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -exu DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME:-"jaegertracingbot"} diff --git a/scripts/draft-release.py b/scripts/draft-release.py index 5e21990c7b9..2d33647158c 100755 --- a/scripts/draft-release.py +++ b/scripts/draft-release.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + import argparse import re import subprocess diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index a9d98d9798e..d5b0327d40a 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + PS4='T$(date "+%H:%M:%S") ' set -euf -o pipefail diff --git a/scripts/generate-help-output.sh b/scripts/generate-help-output.sh index 68c884c118e..b69f281d1e5 100755 --- a/scripts/generate-help-output.sh +++ b/scripts/generate-help-output.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # This script runs the `help` command on all Jaeger binaries (using go run) with variations of SPAN_STORAGE_TYPE. # It can be used to compare the CLI API changes between releases. diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 7f56eb7a85c..0d8b804bbff 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euxf -o pipefail print_help() { diff --git a/scripts/import-order-cleanup.py b/scripts/import-order-cleanup.py index 7f3ce7f640d..b4c74e1c67b 100755 --- a/scripts/import-order-cleanup.py +++ b/scripts/import-order-cleanup.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + import argparse def cleanup_imports_and_return(imports): diff --git a/scripts/kafka-integration-test.sh b/scripts/kafka-integration-test.sh index eed185727a7..b46e809ff45 100755 --- a/scripts/kafka-integration-test.sh +++ b/scripts/kafka-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail compose_file="docker-compose/kafka-integration-test/docker-compose.yml" diff --git a/scripts/package-deploy.sh b/scripts/package-deploy.sh index f065aa2b108..bdbdc6d2d95 100755 --- a/scripts/package-deploy.sh +++ b/scripts/package-deploy.sh @@ -1,4 +1,7 @@ #!/bin/bash + +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 set -euxf -o pipefail TARCMD=${TARCMD:-tar} diff --git a/scripts/rebuild-ui.sh b/scripts/rebuild-ui.sh index 04d61c8e581..9da911f3f4e 100644 --- a/scripts/rebuild-ui.sh +++ b/scripts/rebuild-ui.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euxf -o pipefail cd jaeger-ui diff --git a/scripts/release-notes.py b/scripts/release-notes.py index 68e9b9c1a96..4cc2d46f56d 100755 --- a/scripts/release-notes.py +++ b/scripts/release-notes.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + # This script can read N latest commits from one of Jaeger repos # and output them in the release notes format: # * {title} ({author} in {pull_request}) diff --git a/scripts/spm-integration-test.sh b/scripts/spm-integration-test.sh index b9cf9204a8a..4e8573cd61d 100755 --- a/scripts/spm-integration-test.sh +++ b/scripts/spm-integration-test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + set -euf -o pipefail print_help() { diff --git a/scripts/update-semconv-version.sh b/scripts/update-semconv-version.sh index 73a5b83779f..334faf91405 100755 --- a/scripts/update-semconv-version.sh +++ b/scripts/update-semconv-version.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + package_name="go.opentelemetry.io/otel/semconv" version_regex="v[0-9]\.[0-9]\+\.[0-9]\+" diff --git a/scripts/updateLicense.py b/scripts/updateLicense.py index 5297861eaa0..f5c7c02190c 100755 --- a/scripts/updateLicense.py +++ b/scripts/updateLicense.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + import logging import re import sys @@ -13,14 +16,16 @@ LICENSE_BLOB = """Copyright (c) %d The Jaeger Authors. SPDX-License-Identifier: Apache-2.0""" % CURRENT_YEAR -LICENSE_BLOB_LINES_GO = [ - ('// ' + l).strip() + '\n' for l in LICENSE_BLOB.split('\n') -] +def get_license_blob_lines(comment_prefix): + return [ + (comment_prefix + ' ' + l).strip() + '\n' for l in LICENSE_BLOB.split('\n') + ] COPYRIGHT_RE = re.compile(r'Copyright \(c\) (\d+)', re.I) +SHEBANG_RE = re.compile(r'^#!\s*/[^\s]+') -def update_go_license(name, force=False): +def update_license(name, license_lines): with open(name) as f: orig_lines = list(f) lines = list(orig_lines) @@ -50,18 +55,29 @@ def update_go_license(name, force=False): # print('found=%s, changed=%s, jaeger=%s' % (found, changed, jaeger)) + first_line = lines[0] + shebang_match = SHEBANG_RE.match(first_line) + def replace(header_lines): - if 'Code generated by' in lines[0]: + + if 'Code generated by' in first_line: lines[1:1] = ['\n'] + header_lines + elif shebang_match: + lines[1:1] = header_lines else: lines[0:0] = header_lines if not found: - replace(LICENSE_BLOB_LINES_GO + ['\n']) + # depend on file type + if(shebang_match): + replace(['\n'] + license_lines) + else: + replace(license_lines + ['\n']) + changed = True else: if not jaeger: - replace(LICENSE_BLOB_LINES_GO[0]) + replace(license_lines[0]) changed = True if changed: @@ -70,6 +86,27 @@ def replace(header_lines): f.write(line) print(name) +def get_license_type(file): + license_blob_lines_go = get_license_blob_lines('//') + license_blob_lines_script = get_license_blob_lines('#') + + ext_map = { + '.go' : license_blob_lines_go, + '.mk' : license_blob_lines_script, + 'Makefile' : license_blob_lines_script, + 'Dockerfile' : license_blob_lines_script, + '.py' : license_blob_lines_script, + '.sh' : license_blob_lines_script, + } + + license_type = None + + for ext, license in ext_map.items(): + if file.endswith(ext): + license_type = license + break + + return license_type def main(): if len(sys.argv) == 1: @@ -77,9 +114,10 @@ def main(): sys.exit(1) for name in sys.argv[1:]: - if name.endswith('.go'): + license_type = get_license_type(name) + if license_type: try: - update_go_license(name) + update_license(name, license_type) except Exception as error: logger.error('Failed to process file %s', name) logger.exception(error) diff --git a/scripts/utils/ids-to-base64.py b/scripts/utils/ids-to-base64.py index 8e55737dbd3..70dd6365e95 100755 --- a/scripts/utils/ids-to-base64.py +++ b/scripts/utils/ids-to-base64.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + import base64 import os import re