mirror of https://github.com/kubernetes/kops.git
105 lines
3.2 KiB
Bash
Executable File
105 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright 2024 The Kubernetes 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 -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "${REPO_ROOT}"
|
|
|
|
|
|
function generate_k8s_hashes() {
|
|
prefix=$1
|
|
max_patch=$2
|
|
|
|
cat > "${REPO_ROOT}/pkg/assets/assetdata/k8s-${prefix}.yaml" <<EOF
|
|
# This file is generated by generate-asset-hashes.sh
|
|
|
|
filestores:
|
|
- base: https://dl.k8s.io/release/
|
|
|
|
files:
|
|
EOF
|
|
|
|
for ((patch = 0 ; patch <= max_patch ; patch++ )); do
|
|
version="${prefix}.${patch}"
|
|
echo "k8s ${version}"
|
|
|
|
# We exclude some files that we don't currently need, to keep the size down
|
|
go run ./pkg/assets/assetdata/tools/cmd/generatefileassets \
|
|
--base https://dl.k8s.io/release/ \
|
|
--prefix "v${version}/" \
|
|
--exclude "**/arm/**" \
|
|
--exclude "**/386/**" \
|
|
--exclude "**/ppc64le/**" \
|
|
--exclude "**/s390x/**" \
|
|
--exclude "**/windows/**" \
|
|
--exclude "**/*.docker_tag" \
|
|
--exclude "**/*.spdx" \
|
|
--exclude "**/*.tar" \
|
|
--exclude "**/*.tar.gz" \
|
|
| sed "s@files:@# kubernetes ${version}@g" >> "${REPO_ROOT}/pkg/assets/assetdata/k8s-${prefix}.yaml"
|
|
done
|
|
}
|
|
|
|
function generate_runc_hashes() {
|
|
prefix=$1
|
|
max_patch=$2
|
|
|
|
cat > "${REPO_ROOT}/pkg/assets/assetdata/runc-${prefix}.yaml" <<EOF
|
|
# This file is generated by generate-asset-hashes.sh
|
|
|
|
filestores:
|
|
- base: https://github.com/opencontainers/runc/releases/download/
|
|
|
|
files:
|
|
EOF
|
|
|
|
for ((patch = 0 ; patch <= max_patch ; patch++ )); do
|
|
version="${prefix}.${patch}"
|
|
echo "runc ${version}"
|
|
|
|
# We exclude some files that we don't currently need, to keep the size down
|
|
go run ./pkg/assets/assetdata/tools/cmd/generatefileassets \
|
|
--base https://github.com/opencontainers/runc/releases/download/ \
|
|
--prefix "v${version}/" \
|
|
--exclude "**/*.armel" \
|
|
--exclude "**/*.armhf" \
|
|
--exclude "**/*.ppc64le" \
|
|
--exclude "**/*.riscv64" \
|
|
--exclude "**/*.s390x" \
|
|
--exclude "**/*.tar.xz" \
|
|
--sums "https://github.com/opencontainers/runc/releases/download/v${version}/runc.sha256sum" \
|
|
| sed "s@files:@# runc ${version}@g" >> "${REPO_ROOT}/pkg/assets/assetdata/runc-${prefix}.yaml"
|
|
done
|
|
}
|
|
|
|
# Generate k8s hashes.
|
|
# The first argument is the major and minor version, the second is the maximum patch version.
|
|
generate_k8s_hashes 1.25 16
|
|
generate_k8s_hashes 1.26 15
|
|
generate_k8s_hashes 1.27 16
|
|
generate_k8s_hashes 1.28 15
|
|
generate_k8s_hashes 1.29 11
|
|
generate_k8s_hashes 1.30 7
|
|
generate_k8s_hashes 1.31 3
|
|
|
|
# Generate runc hashes.
|
|
# The first argument is the major and minor version, the second is the maximum patch version.
|
|
generate_runc_hashes 1.1 15
|
|
generate_runc_hashes 1.2 3
|