-
Notifications
You must be signed in to change notification settings - Fork 493
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
Support multiple OS and ARCH for signing #1674
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
tasks: | ||
- task: s3.BucketCopy | ||
name: upload | ||
name: amd64 | ||
src: $HOME/projects/go-algorand/tmp/node_pkgs/linux/amd64 | ||
dest: s3://$STAGING/$CHANNEL/$VERSION | ||
dest: s3://$STAGING/$CHANNEL/$VERSION/ | ||
|
||
- task: s3.BucketCopy | ||
name: arm | ||
src: $HOME/projects/go-algorand/tmp/node_pkgs/linux/arm | ||
dest: s3://$STAGING/$CHANNEL/$VERSION/ | ||
|
||
- task: s3.BucketCopy | ||
name: arm64 | ||
src: $HOME/projects/go-algorand/tmp/node_pkgs/linux/arm64 | ||
dest: s3://$STAGING/$CHANNEL/$VERSION/ | ||
|
||
jobs: | ||
package-upload: | ||
tasks: | ||
- s3.BucketCopy.upload | ||
- s3.BucketCopy.amd64 | ||
- s3.BucketCopy.arm | ||
- s3.BucketCopy.arm64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=2035,2129 | ||
# shellcheck disable=2035,2129,2162 | ||
|
||
# TODO: This needs to be reworked a bit to support Darwin. | ||
|
||
set -exo pipefail | ||
|
||
echo | ||
date "+build_release begin SIGN stage %Y%m%d_%H%M%S" | ||
echo | ||
|
||
ARCH_BIT=$(uname -m) | ||
ARCH_TYPE=$(./scripts/archtype.sh) | ||
OS_TYPE=$(./scripts/ostype.sh) | ||
VERSION=${VERSION:-$(./scripts/compute_build_number.sh -f)} | ||
BRANCH=${BRANCH:-$(./scripts/compute_branch.sh)} | ||
CHANNEL=${CHANNEL:-$(./scripts/compute_branch_channel.sh "$BRANCH")} | ||
PKG_DIR="./tmp/node_pkgs/$OS_TYPE/$ARCH_TYPE" | ||
PKG_DIR="./tmp/node_pkgs" | ||
[email protected] | ||
STATUSFILE="build_status_${CHANNEL}_${VERSION}" | ||
|
||
|
@@ -25,48 +24,59 @@ STATUSFILE="build_status_${CHANNEL}_${VERSION}" | |
find /root/.gnupg -type d -exec chmod 700 {} \; | ||
find /root/.gnupg -type f -exec chmod 600 {} \; | ||
|
||
mkdir -p "$PKG_DIR" | ||
cd "$PKG_DIR" | ||
|
||
if [ -n "$S3_SOURCE" ] | ||
then | ||
PREFIX="$S3_SOURCE/$CHANNEL/$VERSION" | ||
|
||
# deb | ||
aws s3 cp "s3://$PREFIX/algorand_${CHANNEL}_${OS_TYPE}-${ARCH_TYPE}_${VERSION}.deb" . | ||
aws s3 cp "s3://$PREFIX/algorand-devtools_${CHANNEL}_${OS_TYPE}-${ARCH_TYPE}_${VERSION}.deb" . | ||
|
||
# rpm | ||
aws s3 cp "s3://$PREFIX/algorand-${VERSION}-1.${ARCH_BIT}.rpm" . | ||
aws s3 cp "s3://$PREFIX/algorand-devtools-${VERSION}-1.${ARCH_BIT}.rpm" . | ||
aws s3 cp --recursive --exclude "*" --include "*$CHANNEL*$VERSION*" "s3://$S3_SOURCE/$CHANNEL/$VERSION" . | ||
fi | ||
|
||
# TODO: "$PKG_TYPE" == "source" | ||
|
||
# Clean package directory of any previous operations. | ||
rm -rf hashes* *.sig *.asc *.asc.gz | ||
|
||
for file in *.tar.gz *.deb | ||
do | ||
gpg -u "$SIGNING_KEY_ADDR" --detach-sign "$file" | ||
done | ||
|
||
for file in *.rpm | ||
do | ||
gpg -u [email protected] --detach-sign "$file" | ||
# https://unix.stackexchange.com/a/46259 | ||
# Grab the directories directly underneath (max-depth 1) ./tmp/node_pkgs/ into a space-delimited string. | ||
# This will help us target `linux`, `darwin` and (possibly) `windows` build assets. | ||
# Note the surrounding parens turns the string created by `find` into an array. | ||
OS_TYPES=($(find . -mindepth 1 -maxdepth 1 -type d -printf '%f\n')) | ||
for os in "${OS_TYPES[@]}"; do | ||
if [ "$os" = linux ] | ||
then | ||
ARCHS=(amd64 arm arm64) | ||
for arch in "${ARCHS[@]}"; do | ||
( | ||
mkdir -p "$os/$arch" | ||
cd "$os/$arch" | ||
|
||
# Clean package directory of any previous operations. | ||
rm -rf hashes* *.sig *.asc *.asc.gz | ||
|
||
for file in *.tar.gz *.deb | ||
do | ||
gpg -u "$SIGNING_KEY_ADDR" --detach-sign "$file" | ||
done | ||
|
||
for file in *.rpm | ||
do | ||
gpg -u [email protected] --detach-sign "$file" | ||
done | ||
|
||
HASHFILE="hashes_${CHANNEL}_${os}_${arch}_${VERSION}" | ||
|
||
md5sum *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
shasum -a 256 *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
shasum -a 512 *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
|
||
gpg -u "$SIGNING_KEY_ADDR" --detach-sign "$HASHFILE" | ||
gpg -u "$SIGNING_KEY_ADDR" --clearsign "$HASHFILE" | ||
|
||
gpg -u "$SIGNING_KEY_ADDR" --clearsign "$STATUSFILE" | ||
gzip -c "$STATUSFILE.asc" > "$STATUSFILE.asc.gz" | ||
) | ||
done | ||
fi | ||
done | ||
|
||
HASHFILE="hashes_${CHANNEL}_${OS_TYPE}_${ARCH_TYPE}_${VERSION}" | ||
|
||
md5sum *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
shasum -a 256 *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
shasum -a 512 *.tar.gz *.deb *.rpm >> "$HASHFILE" | ||
|
||
gpg -u "$SIGNING_KEY_ADDR" --detach-sign "$HASHFILE" | ||
gpg -u "$SIGNING_KEY_ADDR" --clearsign "$HASHFILE" | ||
|
||
gpg -u "$SIGNING_KEY_ADDR" --clearsign "$STATUSFILE" | ||
gzip -c "$STATUSFILE.asc" > "$STATUSFILE.asc.gz" | ||
|
||
echo | ||
date "+build_release end SIGN stage %Y%m%d_%H%M%S" | ||
echo | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to also sign the darwin builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's my understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, but we aren't building them yet. Because of the ARCHS loop below, it'd probably need to be a separate block anyway.