From 02b88e69253e24b1f633240c8da937183f5f9a3f Mon Sep 17 00:00:00 2001 From: Lucas Manuel Rodriguez Date: Tue, 23 Jul 2024 14:57:27 -0300 Subject: [PATCH] Improvements to releaser script and adding arm64 to tuf.md (#20635) - Improvements to the releaser.sh script - Added arm64 https://github.com/fleetdm/fleet/blob/main/orbit/TUF.md. --- tools/tuf/releaser.sh | 43 +++++++++++++++++++--------------- tools/tuf/status/tuf-status.go | 25 +++++++++++--------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/tools/tuf/releaser.sh b/tools/tuf/releaser.sh index cab40567d4..cf669577c2 100755 --- a/tools/tuf/releaser.sh +++ b/tools/tuf/releaser.sh @@ -58,9 +58,9 @@ setup () { cp -r "$KEYS_SOURCE_DIRECTORY" "$KEYS_DIRECTORY" if ! aws sts get-caller-identity &> /dev/null; then - prompt "You need to login to AWS using the cli, press any key to continue..." + prompt "You need to login to AWS using the cli." aws sso login - prompt "AWS SSO login was successful, press any key to continue..." + prompt "AWS SSO login was successful." fi # GITHUB_TOKEN is only necessary when releasing to edge. @@ -71,9 +71,9 @@ setup () { # We only need to be logged in to github when releasing to edge. if [[ $ACTION == "release-to-edge" ]]; then if ! gh auth status >/dev/null 2>&1; then - prompt "You need to login to Github using the cli, press any key to continue..." + prompt "You need to login to Github using the cli." gh auth login - prompt "Github login was successful, press any key to continue..." + prompt "Github login was successful." fi fi @@ -97,7 +97,7 @@ setup () { pull_from_remote () { echo "Pulling repository from tuf.fleetctl.com... (--dryrun first)" aws s3 sync s3://fleet-tuf-repo "$REPOSITORY_DIRECTORY" --exact-timestamps --dryrun - prompt "If the --dryrun looks good, press any key to continue... (no output means nothing to update)" + prompt "Check if the above --dry-run looks good (no output means nothing to update)." aws s3 sync s3://fleet-tuf-repo "$REPOSITORY_DIRECTORY" --exact-timestamps } @@ -157,7 +157,7 @@ release_fleetd_to_edge () { BRANCH_NAME="release-fleetd-v$VERSION" ORBIT_TAG="orbit-v$VERSION" if [[ "$SKIP_PR_AND_TAG_PUSH" != "1" ]]; then - prompt "A PR for bumping the fleetd version will be created to trigger a Github Action that will build 'Fleet Desktop'. Press any key to continue..." + prompt "A PR will be created to trigger a Github Action to build desktop." pushd "$GIT_REPOSITORY_DIRECTORY" git checkout -b "$BRANCH_NAME" make changelog-orbit version="$VERSION" @@ -166,10 +166,8 @@ release_fleetd_to_edge () { git add .github/workflows/generate-desktop-targets.yml "$ORBIT_CHANGELOG" git commit -m "Release fleetd $VERSION" git push origin "$BRANCH_NAME" - prompt "A PR will be created, press any key to continue..." gh pr create -f -B main -t "Release fleetd $VERSION" - prompt "Press any key to continue after the PR is created and you have made all the necessary edits to it..." - prompt "A 'git tag' will be created to trigger a Github Action to build orbit, press any key to continue..." + prompt "A 'git tag' will be created to trigger a Github Action to build orbit." git tag "$ORBIT_TAG" git push origin "$ORBIT_TAG" popd @@ -202,7 +200,7 @@ release_fleetd_to_edge () { release_osqueryd_to_edge () { echo "Releasing osqueryd to edge..." - prompt "A branch and PR for bumping the osquery version will be created. Press any key to continue..." + prompt "A branch and PR for bumping the osquery version will be created." BRANCH_NAME=release-osqueryd-v$VERSION if [[ "$SKIP_PR_AND_TAG_PUSH" != "1" ]]; then pushd "$GIT_REPOSITORY_DIRECTORY" @@ -211,8 +209,8 @@ release_osqueryd_to_edge () { git add .github/workflows/generate-osqueryd-targets.yml git commit -m "Bump osqueryd version to $VERSION" git push origin "$BRANCH_NAME" - open "https://github.com/fleetdm/fleet/pull/new/$BRANCH_NAME" - prompt "Press any key to continue after the PR is created..." + prompt "A PR will be created to trigger a Github Action to build osqueryd." + gh pr create -f -B main -t "Release osqueryd $VERSION" popd fi OSQUERYD_ARTIFACT_DOWNLOAD_DIRECTORY="$ARTIFACTS_DOWNLOAD_DIRECTORY/osqueryd" @@ -253,7 +251,7 @@ push_to_remote () { aws s3 sync "$REPOSITORY_DIRECTORY" s3://fleet-tuf-repo --dryrun if [[ $PUSH_TO_REMOTE == "1" ]]; then echo "WARNING: This step will push the release to tuf.fleetctl.com (production)..." - prompt "If the --dryrun looks good, press any key to continue..." + prompt "Check if the above --dry-run looks good." aws s3 sync "$REPOSITORY_DIRECTORY" s3://fleet-tuf-repo echo "Release has been pushed!" echo "NOTE: You might see some clients failing to upgrade due to some sha256 mismatches." @@ -265,7 +263,14 @@ push_to_remote () { prompt () { printf "%s\n" "$1" - read -r -s -n 1 + printf "Type 'yes' to continue... " + while read -r word; + do + if [[ "$word" == "yes" ]]; then + printf "\n" + return + fi + done } setup_to_become_publisher () { @@ -279,7 +284,7 @@ setup_to_become_publisher () { mkdir -p "$KEYS_DIRECTORY" if ! aws sts get-caller-identity &> /dev/null; then aws sso login - prompt "AWS SSO login was successful, press any key to continue..." + prompt "AWS SSO login was successful." fi # These need to be exported for use by `tuf` commands. FLEET_TARGETS_PASSPHRASE=$(op read "op://$TARGETS_PASSPHRASE_1PASSWORD_PATH") @@ -306,15 +311,15 @@ fi print_reminder () { if [[ $ACTION == "release-to-edge" ]]; then if [[ $COMPONENT == "fleetd" ]]; then - prompt "Make sure to install fleetd with '--orbit-channel=edge --desktop-channel=edge' on a Linux, Windows and macOS VM. (To smoke test the release.) Press any key to continue..." + prompt "Make sure to install fleetd with '--orbit-channel=edge --desktop-channel=edge' on a Linux, Windows and macOS VM. (To smoke test the release.)" elif [[ $COMPONENT == "osqueryd" ]]; then - prompt "Make sure to install fleetd with '--osqueryd-channel=edge' on a Linux, Windows and macOS VM. (To smoke test the release.) Press any key to continue..." + prompt "Make sure to install fleetd with '--osqueryd-channel=edge' on a Linux, Windows and macOS VM. (To smoke test the release.)" fi elif [[ $ACTION == "promote-edge-to-stable" ]]; then if [[ $COMPONENT == "fleetd" ]]; then - prompt "Make sure to install fleetd with '--orbit-channel=stable --desktop-channel=stable' on a Linux, Windows and macOS VM. (To smoke test the release.) Press any key to continue..." + prompt "Make sure to install fleetd with '--orbit-channel=stable --desktop-channel=stable' on a Linux, Windows and macOS VM. (To smoke test the release.)" elif [[ $COMPONENT == "osqueryd" ]]; then - prompt "Make sure to install fleetd with '--osqueryd-channel=stable' on a Linux, Windows and macOS VM. (To smoke test the release.) Press any key to continue..." + prompt "Make sure to install fleetd with '--osqueryd-channel=stable' on a Linux, Windows and macOS VM. (To smoke test the release.)" fi else echo "Unsupported action: $ACTION" diff --git a/tools/tuf/status/tuf-status.go b/tools/tuf/status/tuf-status.go index 56e57d5349..6f8aa6fd36 100644 --- a/tools/tuf/status/tuf-status.go +++ b/tools/tuf/status/tuf-status.go @@ -163,19 +163,22 @@ func byteCountSI(b int64) string { func channelVersionCommand() *cli.Command { componentFileMap := map[string]map[string]string{ "orbit": { - "linux": "orbit", - "macos": "orbit", - "windows": "orbit.exe", + "linux": "orbit", + "linux-arm64": "orbit", + "macos": "orbit", + "windows": "orbit.exe", }, "desktop": { - "linux": "desktop.tar.gz", - "macos": "desktop.app.tar.gz", - "windows": "fleet-desktop.exe", + "linux": "desktop.tar.gz", + "linux-arm64": "desktop.tar.gz", + "macos": "desktop.app.tar.gz", + "windows": "fleet-desktop.exe", }, "osqueryd": { - "linux": "osqueryd", - "macos-app": "osqueryd.app.tar.gz", - "windows": "osqueryd.exe", + "linux": "osqueryd", + "linux-arm64": "osqueryd", + "macos-app": "osqueryd.app.tar.gz", + "windows": "osqueryd.exe", }, "nudge": { "macos": "nudge.app.tar.gz", @@ -305,7 +308,7 @@ func channelVersionCommand() *cli.Command { fmt.Printf("%s\n", b) } else if format == "markdown" { table := tablewriter.NewWriter(os.Stdout) - table.SetHeader([]string{"Component\\OS", "macOS", "Linux", "Windows"}) + table.SetHeader([]string{"Component\\OS", "macOS", "Linux", "Windows", "Linux (arm64)"}) table.SetAutoFormatHeaders(false) table.SetCenterSeparator("|") table.SetHeaderLine(true) @@ -332,7 +335,7 @@ func channelVersionCommand() *cli.Command { for _, component := range componentsInOrder { oss := outputMap[component] row := []string{component} - for _, os := range []string{"macos", "linux", "windows"} { + for _, os := range []string{"macos", "linux", "windows", "linux-arm64"} { row = append(row, setIfEmpty(oss, os)) } rows = append(rows, row)