Skip to content

Commit 1a26087

Browse files
committed
Merge remote-tracking branch 'origin/compatible' into lyh/simplify-wire-data-snark-worker
2 parents debdaf9 + 73b805c commit 1a26087

File tree

65 files changed

+1743
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1743
-412
lines changed

CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/CODEOWNERS @bkase @dannywillems @deepthiskumar @georgeee
1+
/CODEOWNERS @dannywillems @deepthiskumar @georgeee
22
/buildkite @MinaProtocol/infra-eng-reviewers
33
/frontend/ @MinaProtocol/product-eng-reviewers
44
/dockerfiles/ @MinaProtocol/infra-eng-reviewers
55
/scripts/ @MinaProtocol/infra-eng-reviewers @MinaProtocol/protocol-eng-reviewers
66
/Makefile @MinaProtocol/infra-eng-reviewers
77
/src/config/dev.mlh @MinaProtocol/infra-eng-reviewers @MinaProtocol/protocol-eng-reviewers
8-
/CODE_OF_CONDUCT.md @bkase
8+
/CODE_OF_CONDUCT.md @deepthiskumar
99
/CONTRIBUTING.md @MinaProtocol/product-eng-reviewers
10-
/LICENSE @bkase
10+
/LICENSE @deepthiskumar
1111
/README.md @MinaProtocol/product-eng-reviewers
1212
/README-dev.md @MinaProtocol/protocol-eng-reviewers
1313

buildkite/scripts/archive/upgrade-script-check.sh

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
# upgrade-script-check.sh [OPTIONS]
1111
#
1212
# OPTIONS:
13-
# -m, --mode MODE Execution mode: 'default' or 'verbose' (default: default)
14-
# default: Returns exit code 0/1 without error messages
15-
# verbose: Prints error messages and fails with descriptive output
16-
# -b, --branch BRANCH Target branch for comparison (default: develop)
17-
# -h, --help Show this help message
13+
# -m, --mode MODE Execution mode: 'default' or 'verbose' (default: default)
14+
# default: Returns exit code 0/1 without error messages
15+
# verbose: Prints error messages and fails with descriptive output
16+
# -b, --comparison-branch BRANCH Target branch for comparison (default: develop)
17+
# -h, --help Show this help message
1818
#
1919
# EXIT CODES:
2020
# 0: Success (no schema changes or upgrade script exists)
@@ -28,7 +28,7 @@
2828
set -euo pipefail
2929

3030
MODE="default"
31-
BRANCH="develop"
31+
COMPARISION_BRANCH="develop"
3232
REPO_ROOT="$(git rev-parse --show-toplevel)"
3333

3434
# Parse command line arguments
@@ -43,8 +43,8 @@ parse_args() {
4343
fi
4444
shift 2
4545
;;
46-
-b|--branch)
47-
BRANCH="$2"
46+
-b|--comparison-branch)
47+
COMPARISION_BRANCH="$2"
4848
shift 2
4949
;;
5050
-h|--help)
@@ -80,18 +80,53 @@ has_changes() {
8080
fi
8181

8282
# Fetch latest branch to ensure accurate comparison
83-
git fetch origin "$BRANCH" >/dev/null 2>&1 || {
83+
git fetch origin "$COMPARISION_BRANCH" >/dev/null 2>&1 || {
84+
echo "Error: Failed to fetch origin/$COMPARISION_BRANCH" >&2
85+
exit 1
86+
}
87+
88+
# Check if file has differences
89+
if ! git diff --quiet "origin/$COMPARISION_BRANCH" -- "$REPO_ROOT/$file" 2>/dev/null; then
90+
return 0
91+
else
92+
return 1
93+
fi
94+
}
95+
96+
has_changes_in_git() {
97+
local file="$1"
98+
if ! check_file_exists "$file"; then
99+
return 1
100+
fi
101+
102+
# Fetch latest branch to ensure accurate comparison
103+
git fetch origin "$COMPARISION_BRANCH" >/dev/null 2>&1 || {
84104
if [[ "$MODE" == "verbose" ]]; then
85-
echo "Error: Failed to fetch origin/$BRANCH" >&2
105+
echo "Error: Failed to fetch origin/$COMPARISION_BRANCH" >&2
86106
fi
87107
return 1
88108
}
89109

90-
# Check if file has differences
91-
git diff --quiet "origin/$BRANCH" -- "$REPO_ROOT/$file" 2>/dev/null
92-
return $?
110+
# Check if file was modified in last commit, staged, or has unstaged changes
111+
local file_path="$REPO_ROOT/$file"
112+
113+
# Check if file was modified in last commit
114+
if git diff --quiet HEAD~1 HEAD -- "$file_path" 2>/dev/null; then
115+
# No changes in last commit, check staged changes
116+
if git diff --quiet --cached -- "$file_path" 2>/dev/null; then
117+
# No staged changes, check unstaged changes
118+
if git diff --quiet -- "$file_path" 2>/dev/null; then
119+
# No changes found
120+
return 1
121+
fi
122+
fi
123+
fi
124+
125+
# File has changes in one of the three states
126+
return 0
93127
}
94128

129+
95130
# Main execution
96131
main() {
97132
parse_args "$@"
@@ -120,6 +155,12 @@ main() {
120155

121156
# If schema files changed, verify upgrade script exists
122157
if [[ "$schema_changed" == "true" ]]; then
158+
159+
if ./buildkite/scripts/git/check-bypass.sh "!ci-bypass-upgrade-script-check"; then
160+
echo "⏭️ Skipping upgrade script check as PR is bypassed"
161+
exit 0
162+
fi
163+
123164
# Check that all required scripts exist
124165
for script_path in "${scripts[@]}"; do
125166
if ! check_file_exists "$script_path"; then
@@ -130,6 +171,23 @@ main() {
130171
fi
131172
exit 1
132173
fi
174+
175+
# Check if the upgrade script itself has changes
176+
if has_changes_in_git "$script_path"; then
177+
if [[ "$MODE" == "verbose" ]]; then
178+
echo "✓ Upgrade script has been modified: $script_path"
179+
fi
180+
else
181+
if [[ "$MODE" == "verbose" ]]; then
182+
echo "Error: Schema changed but upgrade script not updated: $script_path"
183+
echo "Please update the upgrade script to reflect schema changes."
184+
echo "This is critical to ensure smooth database migrations in production."
185+
echo "Upgrade/Rollback scripts must be updated together with schema changes, in the same commit."
186+
echo "For local testing, scripts can be modified in staged/unstaged git states."
187+
exit 1
188+
fi
189+
fi
190+
133191
done
134192

135193
if [[ "$MODE" == "verbose" ]]; then

buildkite/scripts/changelog.sh

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -eou pipefail
4+
35
# This script checks if a changelog entry is required for a given pull request.
46
# It compares the current commit with the base branch of the pull request and looks for changes
57
# in the specified trigger files. If changes are found, it checks if the required changelog entry
@@ -20,9 +22,6 @@ BASE_PATH=""
2022
CHANGELOG_FILE=""
2123
# List of users who can bypass the changelog check by commenting !ci-bypass-changelog
2224
# separated by space
23-
GITHUB_USERS_ELIGIBLE_FOR_BYPASS="amc-ie deepthiskumar Trivo25 45930 SanabriaRusso nicc georgeee dannywillems cjjdespres"
24-
25-
BYPASS_PHRASE="!ci-bypass-changelog"
2625

2726
PIPELINE_SLUG="mina-o-1-labs"
2827

@@ -75,23 +74,7 @@ if [[ ! "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]]; then
7574
exit 1
7675
fi
7776

78-
# Check if PR is bypassed by a !ci-bypass-changelog comment
79-
pip install -r scripts/github/github_info/requirements.txt
80-
81-
COMMENTED_CODE=0
82-
(python3 scripts/github/github_info is_pr_commented --comment "$BYPASS_PHRASE" \
83-
--by $GITHUB_USERS_ELIGIBLE_FOR_BYPASS --pr "$BUILDKITE_PULL_REQUEST") \
84-
|| COMMENTED_CODE=$?
85-
86-
if [[ "$COMMENTED_CODE" == 0 ]]; then
87-
echo "⏭️ Skipping run as PR is bypassed"
88-
exit 0
89-
elif [[ "$COMMENTED_CODE" == 1 ]]; then
90-
echo "⚙️ PR is not bypassed. Proceeding with changelog check..."
91-
else
92-
echo "❌ Failed to check PR for being eligible for changelog check bypass"
93-
exit 1
94-
fi
77+
./buildkite/scripts/git/check-bypass.sh "!ci-bypass-changelog" && exit 0;
9578

9679
REMOTE_BRANCH="origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
9780

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Git Bypass Check Script
4+
#
5+
# This script checks if a pull request has been bypassed for certain CI checks
6+
# by authorized users through GitHub comments.
7+
#
8+
# DESCRIPTION:
9+
# Verifies if a PR contains a bypass comment (e.g., !ci-bypass-changelog)
10+
# made by users who are eligible to bypass CI checks. Uses a Python script
11+
# to interact with GitHub API and check for the presence of bypass comments.
12+
#
13+
# USAGE:
14+
# ./check-bypass.sh <bypass_phrase>
15+
#
16+
# ARGUMENTS:
17+
# bypass_phrase - The comment phrase to look for (e.g., "!ci-bypass-changelog")
18+
#
19+
# ENVIRONMENT VARIABLES:
20+
# BUILDKITE_PULL_REQUEST - Pull request number (set by Buildkite)
21+
#
22+
# EXIT CODES:
23+
# 0 - PR is bypassed, skip the check
24+
# 1 - Error occurred during bypass check
25+
# (continues execution if PR is not bypassed)
26+
#
27+
# DEPENDENCIES:
28+
# - Python 3
29+
# - pip packages from scripts/github/github_info/requirements.txt
30+
# - scripts/github/github_info Python module
31+
#
32+
# AUTHORIZED USERS:
33+
# Only users listed in GITHUB_USERS_ELIGIBLE_FOR_BYPASS can bypass checks
34+
35+
GITHUB_USERS_ELIGIBLE_FOR_BYPASS="amc-ie deepthiskumar Trivo25 45930 SanabriaRusso georgeee dannywillems cjjdespres"
36+
37+
BYPASS_PHRASE=$1
38+
39+
40+
# Check if PR is bypassed by a !ci-bypass-changelog comment
41+
pip install -r scripts/github/github_info/requirements.txt
42+
43+
COMMENTED_CODE=0
44+
(python3 scripts/github/github_info is_pr_commented --comment "$BYPASS_PHRASE" \
45+
--by $GITHUB_USERS_ELIGIBLE_FOR_BYPASS --pr "$BUILDKITE_PULL_REQUEST") \
46+
|| COMMENTED_CODE=$?
47+
48+
if [[ "$COMMENTED_CODE" == 0 ]]; then
49+
echo "⏭️ Skipping run as PR is bypassed"
50+
exit 0
51+
elif [[ "$COMMENTED_CODE" == 1 ]]; then
52+
echo "⚙️ PR is not bypassed. Proceeding with check..."
53+
exit 2
54+
else
55+
echo "❌ Failed to check PR for being eligible for check bypass"
56+
exit 1
57+
fi

buildkite/scripts/release/manager.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,9 @@ function publish_debian() {
402402
local __backend=$9
403403
local __debian_repo=${10}
404404
local __arch=${11:-DEFAULT_ARCHITECTURE}
405-
local __debian_sign_key=${12}
406-
local __new_artifact_name=${13:-""}
405+
local __force_upload_debians=${12:-0}
406+
local __debian_sign_key=${13}
407+
local __new_artifact_name=${14:-""}
407408

408409
get_cached_debian_or_download $__backend $__artifact $__codename "$__network" "$__arch"
409410
local __artifact_full_name
@@ -438,11 +439,12 @@ function publish_debian() {
438439
echo " 🍥 Publishing $__artifact debian to $__channel channel with $__target_version version"
439440
echo " 📦 Target debian version: $(calculate_debian_version $__artifact $__target_version $__codename "$__network" "$__arch")"
440441
if [[ $__dry_run == 0 ]]; then
441-
# shellcheck disable=SC2068
442+
# shellcheck disable=SC2068,SC2046
442443
prefix_cmd "$SUBCOMMAND_TAB" source $SCRIPTPATH/../../../scripts/debian/publish.sh \
443444
--names "$DEBIAN_CACHE_FOLDER/$__codename/${__new_artifact_name}_${__target_version}_${__arch}.deb" \
444445
--version $__target_version \
445446
--bucket $__debian_repo \
447+
$(if [[ $__force_upload_debians == 1 ]]; then echo "--force"; fi) \
446448
-c $__codename \
447449
-r $__channel \
448450
--arch $__arch \
@@ -604,6 +606,8 @@ function publish_help(){
604606
printf " %-25s %s\n" "--backend" "[string] backend to use for storage. e.g gs,hetzner. default: gs";
605607
printf " %-25s %s\n" "--debian-repo" "[string] debian repository to publish to. default: $DEBIAN_REPO";
606608
printf " %-25s %s\n" "--debian-sign-key" "[string] debian signing key to use. default: lack of presence = no signing";
609+
printf " %-25s %s\n" "--strip-network-from-archive" "[bool] strip network from archive name. E.g mina-archive-devnet -> mina-archive";
610+
printf " %-25s %s\n" "--force-upload-debians" "[bool] force upload debian packages even if they exist already in the repository";
607611
echo ""
608612
echo "Example:"
609613
echo ""
@@ -636,6 +640,7 @@ function publish(){
636640
local __debian_sign_key=""
637641
local __strip_network_from_archive=0
638642
local __arch=${DEFAULT_ARCHITECTURE}
643+
local __force_upload_debians=0
639644

640645
while [ ${#} -gt 0 ]; do
641646
error_message="❌ Error: a value is needed for '$1'";
@@ -711,6 +716,10 @@ function publish(){
711716
__arch=${2:?$error_message}
712717
shift 2;
713718
;;
719+
--force-upload-debians )
720+
__force_upload_debians=1
721+
shift 1;
722+
;;
714723
* )
715724
echo -e "${RED} !! Unknown option: $1${CLEAR}\n";
716725
echo "";
@@ -758,6 +767,7 @@ function publish(){
758767
echo " - Debian sign key: $__debian_sign_key"
759768
echo " - Strip network from archive: $__strip_network_from_archive"
760769
echo " - Architecture: $__arch"
770+
echo " - Force upload debians: $__force_upload_debians"
761771
echo ""
762772

763773
if [[ $__backend != "gs" && $__backend != "hetzner" && $__backend != "local" ]]; then
@@ -798,6 +808,7 @@ function publish(){
798808
$__backend \
799809
$__debian_repo \
800810
"$__arch" \
811+
"$__force_upload_debians" \
801812
"$__debian_sign_key"
802813
fi
803814

@@ -827,6 +838,7 @@ function publish(){
827838
$__backend \
828839
$__debian_repo \
829840
"$__arch" \
841+
"$__force_upload_debians" \
830842
"$__debian_sign_key" \
831843
"$new_name"
832844
fi
@@ -850,6 +862,7 @@ function publish(){
850862
$__backend \
851863
$__debian_repo \
852864
"$__arch" \
865+
"$__force_upload_debians" \
853866
"$__debian_sign_key"
854867
fi
855868

@@ -872,6 +885,7 @@ function publish(){
872885
$__backend \
873886
$__debian_repo \
874887
"$__arch" \
888+
"$__force_upload_debians" \
875889
"$__debian_sign_key"
876890
fi
877891

0 commit comments

Comments
 (0)