From 0dfbf3f7b77bebeef8832d2dee28723d2ab8e777 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 9 Oct 2023 19:13:28 -0700 Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?= =?UTF-8?q?itial=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- .github/renovate.json | 8 ++++++++ tools/renovate-post-upgrade.sh | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .github/renovate.json create mode 100755 tools/renovate-post-upgrade.sh diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000000..723b74751b --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "local>oxidecomputer/renovate-config", + "local>oxidecomputer/renovate-config//rust/autocreate", + "helpers:pinGitHubActionDigests" + ] +} diff --git a/tools/renovate-post-upgrade.sh b/tools/renovate-post-upgrade.sh new file mode 100755 index 0000000000..9207b554bd --- /dev/null +++ b/tools/renovate-post-upgrade.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# This script is run after Renovate upgrades dependencies or lock files. + +set -euo pipefail + +# Download and install cargo-hakari if it is not already installed. +if ! command -v cargo-hakari &> /dev/null; then + # Need cargo-binstall to install cargo-hakari. + if ! command -v cargo-binstall &> /dev/null; then + # Fetch cargo binstall. + echo "Installing cargo-binstall..." + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + fi + + # Install cargo-hakari. + echo "Installing cargo-hakari..." + cargo binstall cargo-hakari --no-confirm +fi + +# Run cargo hakari to regenerate the workspace-hack file. +echo "Running cargo-hakari..." +cargo hakari generate From 752dcef7f27d08050cb9faaff8b2fb07771e2cc2 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 9 Oct 2023 19:16:41 -0700 Subject: [PATCH 2/3] Import post-upgrade config correctly Created using spr 1.3.4 --- .github/renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json b/.github/renovate.json index 723b74751b..405a3e282b 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -3,6 +3,7 @@ "extends": [ "local>oxidecomputer/renovate-config", "local>oxidecomputer/renovate-config//rust/autocreate", + "local>oxidecomputer/renovate-config:post-upgrade", "helpers:pinGitHubActionDigests" ] } From 5ea9a14dd77942ad3046612189745e3c5d46e625 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 10 Oct 2023 12:05:30 -0700 Subject: [PATCH 3/3] Add retries Created using spr 1.3.4 --- tools/renovate-post-upgrade.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/renovate-post-upgrade.sh b/tools/renovate-post-upgrade.sh index 9207b554bd..c21832e0a9 100755 --- a/tools/renovate-post-upgrade.sh +++ b/tools/renovate-post-upgrade.sh @@ -4,18 +4,37 @@ set -euo pipefail +# Function to retry a command up to 3 times. +function retry_command { + local retries=3 + local delay=5 + local count=0 + until "$@"; do + exit_code=$? + count=$((count+1)) + if [ $count -lt $retries ]; then + echo "Command failed with exit code $exit_code. Retrying in $delay seconds..." + sleep $delay + else + echo "Command failed with exit code $exit_code after $count attempts." + return $exit_code + fi + done +} + # Download and install cargo-hakari if it is not already installed. if ! command -v cargo-hakari &> /dev/null; then # Need cargo-binstall to install cargo-hakari. if ! command -v cargo-binstall &> /dev/null; then # Fetch cargo binstall. echo "Installing cargo-binstall..." - curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + curl --retry 3 -L --proto '=https' --tlsv1.2 -sSfO https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh + retry_command bash install-from-binstall-release.sh fi # Install cargo-hakari. echo "Installing cargo-hakari..." - cargo binstall cargo-hakari --no-confirm + retry_command cargo binstall cargo-hakari --no-confirm fi # Run cargo hakari to regenerate the workspace-hack file.