Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e24df87

Browse filesBrowse files
committed
Fix package build scripts for multi-architecture and Ubuntu version support
- Update postgresml-dashboard/release.sh to match the pattern of other release scripts - Fix S3 upload locks by adding unique lock names with timestamps - Add proper Ubuntu version handling to all release scripts - Ensure sequential execution of jobs that access the S3 repository
1 parent b4b337f commit e24df87
Copy full SHA for e24df87

File tree

5 files changed

+92
-44
lines changed
Filter options

5 files changed

+92
-44
lines changed

‎.github/workflows/ubuntu-packages-and-docker-image.yml

Copy file name to clipboardExpand all lines: .github/workflows/ubuntu-packages-and-docker-image.yml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ jobs:
165165
fail-fast: false # Let the other job finish
166166
matrix:
167167
os: ["ubuntu-22.04"]
168+
ubuntu_version: ["20.04", "22.04", "24.04"]
168169
runs-on: ${{ matrix.os }}
169170
steps:
170171
- uses: actions/checkout@v3
@@ -180,6 +181,7 @@ jobs:
180181
# PostgresML dashboard.
181182
#
182183
postgresml-dashboard:
184+
needs: postgresml
183185
strategy:
184186
fail-fast: false # Let the other job finish
185187
matrix:

‎packages/postgresml-dashboard/release.sh

Copy file name to clipboardExpand all lines: packages/postgresml-dashboard/release.sh
+48-25Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ set -e
33

44
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
package_version="$1"
6+
target_ubuntu_version="$2"
67

78
if [[ -z "$package_version" ]]; then
89
echo "postgresml dashboard package build and release script"
9-
echo "Usage: $0 <package version, e.g. 2.10.0>"
10+
echo "Usage: $0 <package version, e.g. 2.10.0> [ubuntu version, e.g. 22.04]"
1011
exit 1
1112
fi
1213

@@ -17,8 +18,17 @@ declare -A ubuntu_versions=(
1718
["24.04"]="noble"
1819
)
1920

20-
# Supported architectures
21-
declare -a architectures=("amd64" "arm64")
21+
# Detect current architecture
22+
if [[ $(arch) == "x86_64" ]]; then
23+
export ARCH=amd64
24+
elif [[ $(arch) == "aarch64" ]]; then
25+
export ARCH=arm64
26+
else
27+
echo "Unsupported architecture: $(arch)"
28+
exit 1
29+
fi
30+
31+
echo "Building for architecture: ${ARCH}"
2232

2333
# Install deb-s3 if not present
2434
if ! which deb-s3; then
@@ -33,32 +43,45 @@ function package_name() {
3343
echo "postgresml-dashboard-${package_version}-ubuntu${ubuntu_version}-${arch}.deb"
3444
}
3545

36-
# Loop through Ubuntu versions
37-
for ubuntu_version in "${!ubuntu_versions[@]}"; do
38-
codename=${ubuntu_versions[$ubuntu_version]}
46+
build_package() {
47+
local ubuntu_version=$1
48+
local codename=$2
49+
3950
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
4051

41-
# Loop through architectures
42-
for arch in "${architectures[@]}"; do
43-
echo "Building for architecture: ${arch}"
44-
export ARCH=${arch}
52+
# Build the dashboard package
53+
bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version"
4554

46-
# Build the dashboard package
47-
bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version"
55+
if [[ ! -f $(package_name ${ubuntu_version} ${ARCH}) ]]; then
56+
echo "File $(package_name ${ubuntu_version} ${ARCH}) doesn't exist"
57+
exit 1
58+
fi
4859

49-
if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then
50-
echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist"
51-
exit 1
52-
fi
60+
# Upload to S3 with a unique ID to avoid lock contention
61+
deb-s3 upload \
62+
--lock \
63+
--visibility=public \
64+
--bucket apt.postgresml.org \
65+
$(package_name ${ubuntu_version} ${ARCH}) \
66+
--codename ${codename} \
67+
--lock-name="${ARCH}-${ubuntu_version}-$(date +%s)"
5368

54-
# Upload to S3
55-
deb-s3 upload \
56-
--lock \
57-
--bucket apt.postgresml.org \
58-
$(package_name ${ubuntu_version} ${arch}) \
59-
--codename ${codename}
69+
# Clean up the package file
70+
rm $(package_name ${ubuntu_version} ${ARCH})
71+
}
6072

61-
# Clean up the package file
62-
rm $(package_name ${ubuntu_version} ${arch})
73+
# If a specific Ubuntu version is provided, only build for that version
74+
if [[ ! -z "$target_ubuntu_version" ]]; then
75+
if [[ -z "${ubuntu_versions[$target_ubuntu_version]}" ]]; then
76+
echo "Error: Ubuntu version $target_ubuntu_version is not supported."
77+
echo "Supported versions: ${!ubuntu_versions[@]}"
78+
exit 1
79+
fi
80+
81+
build_package "$target_ubuntu_version" "${ubuntu_versions[$target_ubuntu_version]}"
82+
else
83+
# If no version specified, loop through all supported Ubuntu versions
84+
for ubuntu_version in "${!ubuntu_versions[@]}"; do
85+
build_package "$ubuntu_version" "${ubuntu_versions[$ubuntu_version]}"
6386
done
64-
done
87+
fi

‎packages/postgresml-python/release.sh

Copy file name to clipboardExpand all lines: packages/postgresml-python/release.sh
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ build_package() {
6060
exit 1
6161
fi
6262

63-
# Upload to S3
63+
# Upload to S3 with a unique ID to avoid lock contention
6464
deb-s3 upload \
6565
--lock \
66+
--visibility=public \
6667
--bucket apt.postgresml.org \
6768
$(package_name ${ubuntu_version} ${ARCH}) \
68-
--codename ${codename}
69+
--codename ${codename} \
70+
--lock-name="${ARCH}-${ubuntu_version}-$(date +%s)"
6971

7072
# Clean up the package file
7173
rm $(package_name ${ubuntu_version} ${ARCH})

‎packages/postgresml/release.sh

Copy file name to clipboardExpand all lines: packages/postgresml/release.sh
+34-15Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@ set -e
33

44
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
package_version="$1"
6+
target_ubuntu_version="$2"
67

78
if [[ -z "$package_version" ]]; then
89
echo "postgresml package build and release script"
9-
echo "usage: $0 <package version, e.g. 2.10.0>"
10+
echo "usage: $0 <package version, e.g. 2.10.0> [ubuntu version, e.g. 22.04]"
1011
exit 1
1112
fi
1213

14+
# Active LTS Ubuntu versions and their codenames
15+
declare -A ubuntu_codenames=(
16+
["20.04"]="focal"
17+
["22.04"]="jammy"
18+
["24.04"]="noble"
19+
)
20+
21+
# Install deb-s3 if not present
1322
if ! which deb-s3; then
1423
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
1524
sudo gem install deb-s3-0.11.4.gem
@@ -22,18 +31,10 @@ function package_name() {
2231
echo "postgresml-${pg_version}-${package_version}-ubuntu${ubuntu_version}-all.deb"
2332
}
2433

25-
# Active LTS Ubuntu versions
26-
ubuntu_versions=("20.04" "22.04" "24.04")
27-
28-
# Map Ubuntu versions to codenames
29-
declare -A ubuntu_codenames=(
30-
["20.04"]="focal"
31-
["22.04"]="jammy"
32-
["24.04"]="noble"
33-
)
34-
35-
for ubuntu_version in "${ubuntu_versions[@]}"; do
36-
codename=${ubuntu_codenames[$ubuntu_version]}
34+
build_package() {
35+
local ubuntu_version=$1
36+
local codename=$2
37+
3738
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
3839

3940
for pg in {11..17}; do
@@ -47,10 +48,28 @@ for ubuntu_version in "${ubuntu_versions[@]}"; do
4748

4849
deb-s3 upload \
4950
--lock \
51+
--visibility=public \
5052
--bucket apt.postgresml.org \
5153
$(package_name ${pg} ${ubuntu_version}) \
52-
--codename ${codename}
54+
--codename ${codename} \
55+
--lock-name="all-${ubuntu_version}-$(date +%s)"
5356

5457
rm $(package_name ${pg} ${ubuntu_version})
5558
done
56-
done
59+
}
60+
61+
# If a specific Ubuntu version is provided, only build for that version
62+
if [[ ! -z "$target_ubuntu_version" ]]; then
63+
if [[ -z "${ubuntu_codenames[$target_ubuntu_version]}" ]]; then
64+
echo "Error: Ubuntu version $target_ubuntu_version is not supported."
65+
echo "Supported versions: ${!ubuntu_codenames[@]}"
66+
exit 1
67+
fi
68+
69+
build_package "$target_ubuntu_version" "${ubuntu_codenames[$target_ubuntu_version]}"
70+
else
71+
# If no version specified, loop through all supported Ubuntu versions
72+
for ubuntu_version in "${!ubuntu_codenames[@]}"; do
73+
build_package "$ubuntu_version" "${ubuntu_codenames[$ubuntu_version]}"
74+
done
75+
fi

‎packages/postgresql-pgml/release.sh

Copy file name to clipboardExpand all lines: packages/postgresql-pgml/release.sh
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ build_packages() {
7171
--build "$release_dir" \
7272
$(package_name ${pg} ${ubuntu_version} ${ARCH})
7373

74-
# Upload to S3
74+
# Upload to S3 with a unique ID to avoid lock contention
7575
deb-s3 upload \
7676
--lock \
77+
--visibility=public \
7778
--bucket apt.postgresml.org \
7879
$(package_name ${pg} ${ubuntu_version} ${ARCH}) \
79-
--codename ${codename}
80+
--codename ${codename} \
81+
--lock-name="${ARCH}-${ubuntu_version}-$(date +%s)"
8082

8183
# Clean up the package file
8284
rm $(package_name ${pg} ${ubuntu_version} ${ARCH})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.