Skip to content

Commit 5b8c6f1

Browse files
authored
Merge pull request #17970 from MinaProtocol/dkijania/filter_out_arm_amd
[CI] Support archs argument in aptly
2 parents 9845659 + d8d392d commit 5b8c6f1

File tree

4 files changed

+61
-27
lines changed

4 files changed

+61
-27
lines changed

buildkite/scripts/debian/start_local_repo.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ if [ -z $MINA_DEB_CODENAME ]; then
55
exit 1
66
fi
77

8+
# Parse command line arguments
9+
ARCH="amd64" # default architecture
10+
11+
while [[ $# -gt 0 ]]; do
12+
case $1 in
13+
--arch)
14+
ARCH="$2"
15+
shift 2
16+
;;
17+
*)
18+
echo "Unknown option: $1"
19+
exit 1
20+
;;
21+
esac
22+
done
23+
824
LOCAL_DEB_FOLDER=_build
925

1026
set -eou pipefail
@@ -16,4 +32,4 @@ mkdir -p $LOCAL_DEB_FOLDER
1632
source ./buildkite/scripts/export-git-env-vars.sh
1733
./buildkite/scripts/cache/manager.sh read --root legacy/debians "$MINA_DEB_CODENAME/*" _build
1834
./buildkite/scripts/cache/manager.sh read "debians/$MINA_DEB_CODENAME/*" _build
19-
./scripts/debian/aptly.sh start --codename $MINA_DEB_CODENAME --debians $LOCAL_DEB_FOLDER --component unstable --clean --background --wait
35+
./scripts/debian/aptly.sh start --codename $MINA_DEB_CODENAME --debians $LOCAL_DEB_FOLDER --component unstable --clean --background --wait --archs $ARCH

buildkite/scripts/release/manager.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,10 @@ function pull(){
19151915
__networks=${2:?$error_message}
19161916
shift 2;
19171917
;;
1918+
--archs )
1919+
__archs=${2:?$error_message}
1920+
shift 2;
1921+
;;
19181922
* )
19191923
echo -e "${RED} !! Unknown option: $1${CLEAR}\n";
19201924
echo "";
@@ -1936,6 +1940,8 @@ function pull(){
19361940
echo " - Target: $__target"
19371941
echo " - Codenames: $__codenames"
19381942
echo " - Networks: $__networks"
1943+
echo " - Architectures: $__archs"
1944+
19391945
if [[ -n ${__from_special_folder+x} ]]; then
19401946
echo " - From special folder: $__from_special_folder"
19411947
fi
@@ -1947,26 +1953,28 @@ function pull(){
19471953
read -r -a __artifacts_arr <<< "$__artifacts"
19481954
read -r -a __codenames_arr <<< "$__codenames"
19491955
read -r -a __networks_arr <<< "$__networks"
1956+
read -r -a __archs_arr <<< "$__archs"
19501957

1951-
for __artifact in "${__artifacts_arr[@]}"; do
1952-
for __codename in "${__codenames_arr[@]}"; do
1953-
for network in "${__networks_arr[@]}"; do
1954-
echo " 📥 Pulling $__artifact for $__codename codename and $network network"
1955-
local __artifact_full_name
1956-
local __source_path
1957-
__artifact_full_name=$(get_artifact_with_suffix $__artifact $network)
1958-
1959-
if [[ -n ${__from_special_folder+x} ]]; then
1960-
__source_path="$(storage_root "$__backend")/$__from_special_folder/${__artifact_full_name}_*"
1961-
else
1962-
__source_path="$(storage_root "$__backend")/$__buildkite_build_id/debians/$__codename/${__artifact_full_name}_*"
1963-
fi
1964-
1965-
storage_download "$__backend" "$__source_path" "$__target"
1958+
for __arch in "${__archs_arr[@]}"; do
1959+
for __artifact in "${__artifacts_arr[@]}"; do
1960+
for __codename in "${__codenames_arr[@]}"; do
1961+
for network in "${__networks_arr[@]}"; do
1962+
echo " 📥 Pulling $__artifact for $__codename codename and $network network"
1963+
local __artifact_full_name
1964+
local __source_path
1965+
__artifact_full_name=$(get_artifact_with_suffix $__artifact $network)
1966+
1967+
if [[ -n ${__from_special_folder+x} ]]; then
1968+
__source_path="$(storage_root "$__backend")/$__from_special_folder/${__artifact_full_name}_*_${__arch}.deb"
1969+
else
1970+
__source_path="$(storage_root "$__backend")/$__buildkite_build_id/debians/$__codename/${__artifact_full_name}_*_${__arch}.deb"
1971+
fi
1972+
1973+
storage_download "$__backend" "$__source_path" "$__target"
1974+
done
19661975
done
19671976
done
19681977
done
1969-
19701978
echo " ✅ Done."
19711979
echo ""
19721980
}

buildkite/src/Command/DockerImage.dhall

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ let generateStep =
109109
then " && echo Skipping local debian repo setup "
110110

111111
else " && ./buildkite/scripts/debian/update.sh --verbose"
112-
++ " && apt-get install aptly -y && ./buildkite/scripts/debian/start_local_repo.sh"
112+
++ " && apt-get install aptly -y && ./buildkite/scripts/debian/start_local_repo.sh --arch ${Arch.lowerName
113+
spec.arch}"
113114

114115
let maybeStopDebianRepo =
115116
if spec.no_debian

scripts/debian/aptly.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,27 @@ check_required jq
2828
function start_aptly() {
2929
local __distribution=$1
3030
local __debs=$2
31-
local __background=$3
32-
local __clean=$4
33-
local __component=$5
31+
local __archs=$3
32+
local __background=$4
33+
local __clean=$5
34+
local __component=$6
3435
local __repo="${__distribution}"-"${__component}"
35-
local __port=$6
36-
local __wait=$7
36+
local __port=$7
37+
local __wait=$8
3738

3839
if [ "${__clean}" = 1 ]; then
3940
rm -rf ~/.aptly
4041
fi
4142

42-
aptly repo create -component "${__component}" -distribution "${__distribution}" "${__repo}"
43+
aptly repo list | grep -q "^${__repo}$" && aptly repo drop "${__repo}" || true
4344

44-
aptly repo add "${__repo}" "${__debs}"
45+
aptly repo create -component "${__component}" -distribution "${__distribution}" -architectures "${__archs}" "${__repo}"
4546

46-
aptly snapshot create "${__component}" from repo "${__repo}"
47+
aptly repo add -architectures "${__archs}" "${__repo}" "${__debs}"
4748

48-
aptly publish snapshot -distribution="${__distribution}" -skip-signing "${__component}"
49+
aptly snapshot create -architectures "${__archs}" "${__component}" from repo "${__repo}"
50+
51+
aptly publish snapshot -architectures "${__archs}" -distribution "${__distribution}" -skip-signing "${__component}"
4952

5053
if [ "${__background}" = 1 ]; then
5154
aptly serve -listen 0.0.0.0:"${__port}" &
@@ -101,6 +104,7 @@ function start(){
101104
local __background=0
102105
local __clean=0
103106
local __component="unstable"
107+
local __archs="amd64"
104108
local __port=$PORT
105109
local __wait=0
106110

@@ -127,6 +131,10 @@ function start(){
127131
__debs=${2:?$error_message}
128132
shift 2;
129133
;;
134+
-a | --archs )
135+
__archs=${2:?$error_message}
136+
shift 2;
137+
;;
130138
-m | --component )
131139
__component=${2:?$error_message}
132140
shift 2;
@@ -149,6 +157,7 @@ function start(){
149157

150158
start_aptly $__distribution \
151159
$__debs \
160+
$__archs \
152161
$__background \
153162
$__clean \
154163
$__component \

0 commit comments

Comments
 (0)