hack: remove redundant license headers in release (#171)
* remove per-yaml license headers in release manifests * manually insert a license header in release manifests * add README.md to /kubernetes-manifests indicating they're not ready to use (and refer to /release instead). * regenerate manifests Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
d23fe9cf33
commit
342318a9ae
5 changed files with 96 additions and 223 deletions
13
hack/license_header.txt
Normal file
13
hack/license_header.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Copyright 2018 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.
|
|
@ -27,12 +27,31 @@ TAG="${TAG:?TAG env variable must be specified}"
|
|||
REPO_PREFIX="${REPO_PREFIX:?REPO_PREFIX env variable must be specified}"
|
||||
OUT_DIR="${OUT_DIR:-${SCRIPTDIR}/../release}"
|
||||
|
||||
print_license_header() {
|
||||
cat "${SCRIPTDIR}/license_header.txt"
|
||||
echo
|
||||
}
|
||||
|
||||
print_autogenerated_warning() {
|
||||
cat<<EOF
|
||||
----------------------------------------------------------
|
||||
WARNING: This file is autogenerated. Do not manually edit.
|
||||
----------------------------------------------------------
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
read_manifests() {
|
||||
local dir
|
||||
dir="$1"
|
||||
|
||||
while IFS= read -d $'\0' -r file; do
|
||||
cat "${file}"
|
||||
# strip license headers (pattern "^# ")
|
||||
awk '
|
||||
/^[^# ]/ { found = 1 }
|
||||
found { print }' "${file}"
|
||||
|
||||
echo "---"
|
||||
done < <(find "${dir}" -name '*.yaml' -type f -print0)
|
||||
}
|
||||
|
@ -50,6 +69,9 @@ mk_kubernetes_manifests() {
|
|||
replace="\1image: $image\3"
|
||||
out_manifest="$(gsed -r "s|$pattern|$replace|g" <(echo "${out_manifest}") )"
|
||||
done
|
||||
|
||||
print_license_header
|
||||
print_autogenerated_warning
|
||||
echo "${out_manifest}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue