cert-manager/hack/concat-yaml.sh
Ashley Davis 32d716654a
Add a makefile flow for building artifacts
Includes targets for:

- all "server" binaries, for all arches
- all containers for all server binaries for all arches
- all client binaries (kubectl plugin / cmctl) for all arches
- the cert-manager helm chart + signature
- the cert-manager static manifests + CRDs
- tools which bazel would download, with checksum verification
- (commented out) a signed SHA256SUM file for client binaries

Upgrades from the bazel flow include that:

- we use OS-specific base images rather than just using amd64 everywhere
- we easily add support for signing artifacts at build time
- we add ".exe" to the end of windows executables
- we add a zip file for windows executables, for easier consumption
- we concatenate YAML files more robustly
- staging a full release should be much faster
- hopefully, it's easier to change things!
- licenses are trimmed down to reduce bloat in images (the license
  bundle was 1.4MB in size alone)

Changes from the bazel flow include:

- containers no longer have a symlink to the binary at an unusual
  path, but instead just have the binary at a more predictable path
  (e.g. /app/cmd/webhook/webhook instead of
  /app/cmd/webhook/webhook.runfiles/com_github_jetstack_cert_manager/cmd/webhook/webhook_/webhook)

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-15 09:54:15 +00:00

44 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2021 The cert-manager Authors.
#
# 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.
set -eu -o pipefail
while (($#)); do
f=$1
if [[ ! -f "$f" ]]; then
echo "$f doesn't exist, exiting" 1>&2
exit 1
fi
# The YAML spec requires that a YAML directive only appears once in a document
# We probably won't have any directives, so we just check for any directive and
# fail if there's one in any of the files
# https://yaml.org/spec/1.2.2/#681-yaml-directives
if grep -q "%YAML" $f; then
echo "found %YAML directive in file; this can't be handled safely by this script" 1>&2
exit 1
fi
cat $f
shift
# if there's at least one more file left, output the YAML file separator
if [[ $# -gt 0 ]]; then
echo "---"
fi
done