Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate SHA512SUM for release archives #1112

Merged
merged 2 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ s2i::build::place_bins() {

# Create binary copies where specified.
local suffix=""
if [[ $platform == "windows/amd64" ]]; then
if [[ $platform =~ ^windows ]]; then
suffix=".exe"
fi
for linkname in "${S2I_BINARY_SYMLINKS[@]}"; do
Expand All @@ -306,20 +306,40 @@ s2i::build::place_bins() {

# Create the release archive.
local platform_segment="${platform//\//-}"
if [[ $platform == "windows/amd64" ]]; then
if [[ $platform =~ ^windows ]]; then
local archive_name="${S2I_RELEASE_ARCHIVE}-${S2I_GIT_VERSION}-${S2I_GIT_COMMIT}-${platform_segment}.zip"
echo "++ Creating ${archive_name}"
echo "++ Creating archive ${archive_name}"
for file in "${S2I_BINARY_RELEASE_WINDOWS[@]}"; do
zip "${S2I_LOCAL_RELEASEPATH}/${archive_name}" -qj "${release_binpath}/${file}"
done
pushd "${S2I_LOCAL_RELEASEPATH}" > /dev/null
echo "++ Generating sha512sum for ${archive_name}"
sha512sum "${archive_name}" >> "SHA512-SUMS.txt"
popd > /dev/null
else
local archive_name="${S2I_RELEASE_ARCHIVE}-${S2I_GIT_VERSION}-${S2I_GIT_COMMIT}-${platform_segment}.tar.gz"
echo "++ Creating ${archive_name}"
echo "++ Creating archive ${archive_name}"
tar -czf "${S2I_LOCAL_RELEASEPATH}/${archive_name}" -C "${release_binpath}" .
pushd "${S2I_LOCAL_RELEASEPATH}" > /dev/null
echo "++ Generating sha512sum for ${archive_name}"
sha512sum "${archive_name}" >> "SHA512-SUMS.txt"
popd > /dev/null
fi
rm -rf "${release_binpath}"
done
if [[ -d "${S2I_LOCAL_RELEASEPATH}" ]]; then
pushd "${S2I_LOCAL_RELEASEPATH}" > /dev/null
echo "++ Verifying sha512sums for archives"
if ! sha512sum -c "SHA512-SUMS.txt"; then
echo "!! Unable to verify sha512sum for archives"
exit 1
else
echo "++ Verified sha512sums for archives"
fi
popd > /dev/null
fi
)

}

# s2i::build::make_binary_symlinks makes symlinks for the sti
Expand All @@ -328,7 +348,7 @@ s2i::build::make_binary_symlinks() {
platform=$(s2i::build::host_platform)
if [[ -f "${S2I_OUTPUT_BINPATH}/${platform}/s2i" ]]; then
for linkname in "${S2I_BINARY_SYMLINKS[@]}"; do
if [[ $platform == "windows/amd64" ]]; then
if [[ $platform =~ ^windows ]]; then
cp "${S2I_OUTPUT_BINPATH}/${platform}/s2i.exe" "${S2I_OUTPUT_BINPATH}/${platform}/${linkname}.exe"
else
ln -sf s2i "${S2I_OUTPUT_BINPATH}/${platform}/${linkname}"
Expand Down
6 changes: 3 additions & 3 deletions pkg/ignore/ignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ func TestBasicDelKeepMix(t *testing.T) {
/*
Per the docker user guide, with a docker ignore list of:

LICENSE.*
!LICENSE.md
*.md
LICENSE.*
!LICENSE.md
*.md

LICENSE.MD will NOT be kept, as *.md overrides !LICENSE.md
*/
Expand Down
8 changes: 5 additions & 3 deletions pkg/util/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ func (t *TimeoutError) Error() string {
// case that the execution time of the function exceeded the provided duration.
// The provided function is passed the timer in case it wishes to reset it. If
// so, the following pattern must be used:
// if !timer.Stop() {
// return &TimeoutError{}
// }
//
// if !timer.Stop() {
// return &TimeoutError{}
// }
//
// timer.Reset(timeout)
func TimeoutAfter(t time.Duration, errorMsg string, f func(*time.Timer) error) error {
c := make(chan error, 1)
Expand Down