Skip to content

Commit 4df159b

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
images/server: add devbuilds package source
Add a new package source 'devbuilds' that is intended to install the same samba builds as the 'nightly' source but also development builds of ceph available from the shaman system. Signed-off-by: John Mulligan <[email protected]>
1 parent 9501576 commit 4df159b

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

images/server/install-packages.sh

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,44 @@
22

33
set -ex
44

5+
6+
need_curl() {
7+
if command -v curl >/dev/null ; then
8+
return 0
9+
fi
10+
dnf install --setopt=install_weak_deps=False -y /usr/bin/curl
11+
}
12+
513
get_custom_repo() {
614
url="$1"
715
fname="$(basename "$url")"
816
dest="/etc/yum.repos.d/${fname}"
9-
dnf install --setopt=install_weak_deps=False -y /usr/bin/curl
17+
need_curl
1018
curl -L "$url" -o "$dest"
1119
}
1220

21+
generate_repo_from_shaman() {
22+
url="$1"
23+
dest="/etc/yum.repos.d/$2"
24+
need_curl
25+
tmpfile=/tmp/shaman.json
26+
curl -L "$url" -o "${tmpfile}" && python3 <<EOF
27+
json_file = "${tmpfile}"
28+
dest = "${dest}"
29+
import json
30+
r = json.load(open(json_file))
31+
url = r[0]["url"]
32+
ref = r[0]["ref"]
33+
with open(dest, "w") as out:
34+
print(f"[ceph-{ref}]", file=out)
35+
print(f"name=Ceph Development Build ({ref})", file=out)
36+
print(f"baseurl={url}/x86_64", file=out)
37+
print("enabled=1", file=out)
38+
print("gpgcheck=0", file=out)
39+
EOF
40+
rm -rf "${tmpfile}"
41+
}
42+
1343
install_packages_from="$1"
1444
samba_version_suffix="$2"
1545
install_custom_repo="$3"
@@ -23,12 +53,25 @@ case "${install_packages_from}" in
2353
get_custom_repo "https://artifacts.ci.centos.org/samba/pkgs/master/${OS_BASE}/samba-nightly-master.repo"
2454
package_selection=${package_selection:-nightly}
2555
;;
56+
devbuilds)
57+
# devbuilds - samba nightly dev builds and ceph dev builds
58+
get_custom_repo "https://artifacts.ci.centos.org/samba/pkgs/master/${OS_BASE}/samba-nightly-master.repo"
59+
generate_repo_from_shaman "https://shaman.ceph.com/api/search/?project=ceph&distros=${OS_BASE}/9/x86_64&flavor=default&ref=main&sha1=latest" ceph-main.repo
60+
dnf install --setopt=install_weak_deps=False -y epel-release
61+
package_selection=${package_selection:-devbuilds}
62+
;;
2663
custom-repo)
2764
get_custom_repo "${install_custom_repo}"
2865
;;
2966
esac
3067

3168

69+
dnf_cmd=(dnf)
70+
if [[ "${OS_BASE}" = centos ]]; then
71+
dnf_cmd+=(--enablerepo=crb --enablerepo=resilientstorage)
72+
fi
73+
74+
3275
# Assorted packages that must be installed in the container image to
3376
# support the functioning of the container
3477
support_packages=(\
@@ -50,6 +93,14 @@ case "${package_selection}-${OS_BASE}" in
5093
*-fedora|allvfs-*)
5194
samba_packages+=(samba-vfs-cephfs samba-vfs-glusterfs)
5295
;;
96+
devbuilds-centos|forcedevbuilds-*)
97+
dnf_cmd+=(--enablerepo=epel)
98+
samba_packages+=(samba-vfs-cephfs)
99+
# these packages should be installed as deps. of sambacc extras
100+
# however, the sambacc builds do not enable the extras on centos atm.
101+
# Once this is fixed this line ought to be removed.
102+
support_packages+=(python3-pyyaml python3-tomli python3-rados)
103+
;;
53104
esac
54105

55106
# Assign version suffix to samba packages
@@ -58,10 +109,6 @@ for p in "${samba_packages[@]}"; do
58109
samba_versioned_packages+=("${p}${samba_version_suffix}")
59110
done
60111

61-
dnf_cmd=(dnf)
62-
if [[ "${OS_BASE}" = centos ]]; then
63-
dnf_cmd+=(--enablerepo=crb --enablerepo=resilientstorage)
64-
fi
65112

66113
"${dnf_cmd[@]}" \
67114
install --setopt=install_weak_deps=False -y \

0 commit comments

Comments
 (0)