Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ALL_BUILDABLE_FLAVORS := \
luminous,debian,9 \
mimic,centos,7 \
nautilus,centos,7 \
nautilus,centos,8 \
octopus,centos,7 \
Comment thread
dsavineau marked this conversation as resolved.
Resolved
octopus,centos,8 \
master,centos,8

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ This is only available on CentOS with the following command :

Alternatively, you can build a container image based on `wip-*` branch:

`make FLAVORS="wip-super-code,centos,7" build`
`make FLAVORS="wip-nautilus-superb,centos,7" build`

To build your branch on Centos 7 on the `wip-super-code` branch.
To build your branch on Centos 7 on the `wip-nautilus-superb` branch. But please make sure the
branch name contains the release name from which the branch is created.

It's also possible to use the Ceph development builds instead of the stable one (except for master).
The ceph packages will be pulled from shaman/chacra repositories.
Expand Down
8 changes: 4 additions & 4 deletions ceph-releases/ALL/centos/daemon-base/__DOCKERFILE_INSTALL__
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ bash -c ' \
if [ -n "__GANESHA_PACKAGES__" ]; then \
echo "[ganesha]" > /etc/yum.repos.d/ganesha.repo ; \
echo "name=ganesha" >> /etc/yum.repos.d/ganesha.repo ; \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]]; then \
if [[ "${CEPH_VERSION}" =~ master ]]; then \
echo "baseurl=https://buildlogs.centos.org/centos/\$releasever/storage/\$basearch/nfsganesha-3/" >> /etc/yum.repos.d/ganesha.repo ; \
elif [[ "${CEPH_VERSION}" == octopus ]]; then \
echo "baseurl=https://download.ceph.com/nfs-ganesha/rpm-V3.3-stable/$CEPH_VERSION/el\$releasever/\$basearch/" >> /etc/yum.repos.d/ganesha.repo ; \
Expand All @@ -23,7 +23,7 @@ bash -c ' \
fi ; \
if [ -n "__ISCSI_PACKAGES__" ]; then \
curl -s -L https://shaman.ceph.com/api/repos/tcmu-runner/master/latest/__ENV_[BASEOS_REPO]__/__ENV_[BASEOS_TAG]__/repo > /etc/yum.repos.d/tcmu-runner.repo ; \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]]; then \
if [[ "${CEPH_VERSION}" =~ master ]]; then \
curl -s -L https://shaman.ceph.com/api/repos/ceph-iscsi/master/latest/__ENV_[BASEOS_REPO]__/__ENV_[BASEOS_TAG]__/repo > /etc/yum.repos.d/ceph-iscsi.repo ; \
elif [[ "${CEPH_VERSION}" =~ nautilus|octopus ]]; then \
curl -s -L https://download.ceph.com/ceph-iscsi/3/rpm/el__ENV_[BASEOS_TAG]__/ceph-iscsi.repo -o /etc/yum.repos.d/ceph-iscsi.repo ; \
Expand All @@ -43,8 +43,8 @@ if [[ "${CEPH_VERSION}" == nautilus ]]; then \
fi ; \
fi && \
bash -c ' \
if [[ "${CEPH_VERSION}" =~ master|^wip* ]] || ${CEPH_DEVEL}; then \
REPO_URL=$(curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/__ENV_[BASEOS_TAG]__&flavor=${OSD_FLAVOR}&ref=${CEPH_VERSION}&sha1=latest" | jq -a ".[0] | .url"); \
if [[ "${CEPH_VERSION}" =~ master ]] || ${CEPH_DEVEL}; then \
REPO_URL=$(curl -s "https://shaman.ceph.com/api/search/?project=ceph&distros=centos/__ENV_[BASEOS_TAG]__&flavor=${OSD_FLAVOR}&ref=${CEPH_REF}&sha1=latest" | jq -a ".[0] | .url"); \
RELEASE_VER=0 ;\
if [[ "${OSD_FLAVOR}" == "crimson" ]]; then \
CRIMSON_PACKAGES="ceph-crimson-osd__ENV_[CEPH_POINT_RELEASE]__";\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tcmu-runner ceph-iscsi python-rtslib
1 change: 0 additions & 1 deletion ceph-releases/nautilus/daemon-base/__ISCSI_PACKAGES__

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ceph-mgr__ENV_[CEPH_POINT_RELEASE]__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tcmu-runner ceph-iscsi python-rtslib
88 changes: 58 additions & 30 deletions contrib/build-push-ceph-container-imgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ CN_RELEASE="v2.3.1"

function _centos_release {
local release=$1
if [[ "${release}" =~ master|octopus|^wip* ]]; then
echo 8
else
echo 7
fi
case "${release}" in
*mimic*)
echo 7
;;
*nautilus*)
echo 7
;;
*)
echo 8
;;
esac
}

function cleanup_previous_run {
Expand Down Expand Up @@ -102,7 +108,7 @@ function install_podman {

function login_docker_hub {
echo "Login in the Docker Hub"
docker login -u "$CONTAINER_REPO_USERNAME" -p "$CONTAINER_REPO_PASSWORD" ${CONTAINER_REPO_HOSTNAME}
docker login -u "$CONTAINER_REPO_USERNAME" -p "$CONTAINER_REPO_PASSWORD" "${CONTAINER_REPO_HOSTNAME}"
}

function enable_experimental_docker_cli {
Expand Down Expand Up @@ -204,15 +210,29 @@ declare -F build_ceph_imgs ||
function build_ceph_imgs {
echo "Build Ceph container image(s)"
if ${CI_CONTAINER}; then
make FLAVORS="${CEPH_BRANCH},centos,$(_centos_release ${CEPH_BRANCH})" \
if [ -z "$CONTAINER_FLAVOR" ]; then
CONTAINER_FLAVOR=${CEPH_BRANCH},centos,$(_centos_release "${CEPH_BRANCH}")
else
IFS="," read -r ceph_branch distro distro_release <<< "${CONTAINER_FLAVOR}"
if [ "${ceph_branch}" != "${BRANCH}" ]; then
echo "branch \"${ceph_branch}\" in \$CONTAINER_FLAVOR does not match with \$BRANCH \"${BRANCH}\""
exit 1
fi
if [ "${distro}" != "centos" ]; then
echo "distro \"${distro}\"in \$CONTAINER_FLAVOR is not supported yet"
exit 1
fi
fi

make FLAVORS="${CONTAINER_FLAVOR}" \
CEPH_DEVEL="true" \
OSD_FLAVOR=${OSD_FLAVOR} \
RELEASE=${RELEASE} \
TAG_REGISTRY=${CONTAINER_REPO_ORGANIZATION} \
RELEASE="${RELEASE}" \
TAG_REGISTRY="${CONTAINER_REPO_ORGANIZATION}" \
IMAGES_TO_BUILD=daemon-base \
build.parallel
else
make CEPH_DEVEL=${DEVEL} RELEASE=${RELEASE} build.parallel
make CEPH_DEVEL=${DEVEL} RELEASE="${RELEASE}" build.parallel
fi
docker images
}
Expand All @@ -228,16 +248,16 @@ function build_and_push_latest_bis {
# latest-bis-$ceph_release is needed by ceph-ansible so it can test the restart handlers on an image ID change
# rebuild latest again to get a different image ID
for ceph_release in "${CEPH_RELEASES[@]}"; do
CENTOS_RELEASE=$(_centos_release ${ceph_release})
make RELEASE="$CONTAINER_BRANCH"-bis FLAVORS="${ceph_release}",centos,${CENTOS_RELEASE} build
docker tag ceph/daemon:"$CONTAINER_BRANCH"-bis-"${ceph_release}"-centos-${CENTOS_RELEASE}-"${HOST_ARCH}" ceph/daemon:latest-bis-"$ceph_release"
CENTOS_RELEASE=$(_centos_release "${ceph_release}")
make RELEASE="$CONTAINER_BRANCH"-bis FLAVORS="${ceph_release}",centos,"${CENTOS_RELEASE}" build
docker tag ceph/daemon:"$CONTAINER_BRANCH"-bis-"${ceph_release}"-centos-"${CENTOS_RELEASE}"-"${HOST_ARCH}" ceph/daemon:latest-bis-"$ceph_release"
docker push ceph/daemon:latest-bis-"$ceph_release"
done

# Now let's build the latest
CENTOS_RELEASE=$(_centos_release ${CEPH_RELEASES[-1]})
make RELEASE="$CONTAINER_BRANCH"-bis FLAVORS="${CEPH_RELEASES[-1]}",centos,${CENTOS_RELEASE} build
docker tag ceph/daemon:"$CONTAINER_BRANCH"-bis-"${CEPH_RELEASES[-1]}"-centos-${CENTOS_RELEASE}-"${HOST_ARCH}" ceph/daemon:latest-bis
CENTOS_RELEASE=$(_centos_release "${CEPH_RELEASES[-1]}")
make RELEASE="$CONTAINER_BRANCH"-bis FLAVORS="${CEPH_RELEASES[-1]}",centos,"${CENTOS_RELEASE}" build
docker tag ceph/daemon:"$CONTAINER_BRANCH"-bis-"${CEPH_RELEASES[-1]}"-centos-"${CENTOS_RELEASE}"-"${HOST_ARCH}" ceph/daemon:latest-bis
docker push ceph/daemon:latest-bis
}

Expand All @@ -246,22 +266,28 @@ function push_ceph_imgs_latest {
local latest_name

if ${CI_CONTAINER} ; then
CENTOS_RELEASE=$(_centos_release ${BRANCH})
local_tag=${CONTAINER_REPO_ORGANIZATION}/daemon-base:${RELEASE}-${BRANCH}-centos-${CENTOS_RELEASE}-${HOST_ARCH}
full_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${RELEASE}-centos-${CENTOS_RELEASE}-${HOST_ARCH}-devel
if [ -z "$CONTAINER_FLAVOR" ]; then
distro=centos
distro_release=$(_centos_release "${BRANCH}")
else
IFS="," read -r ceph_branch distro distro_release <<< "${CONTAINER_FLAVOR}"
fi
# local_tag should match with daemon_img defined in maint-lib/makelib.mk
local_tag=${CONTAINER_REPO_ORGANIZATION}/daemon-base:${RELEASE}-${CEPH_VERSION}-${distro}-${distro_release}-${HOST_ARCH}
full_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${RELEASE}-${distro}-${distro_release}-${HOST_ARCH}-devel
branch_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${BRANCH}
sha1_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${SHA1}
if [[ "${OSD_FLAVOR}" == "crimson" ]]; then
sha1_flavor_repo_tag=${CONTAINER_REPO_HOSTNAME}/${CONTAINER_REPO_ORGANIZATION}/ceph:${SHA1}-${OSD_FLAVOR}
docker tag $local_tag $sha1_flavor_repo_tag
docker push $sha1_flavor_repo_tag
docker tag "$local_tag" "$sha1_flavor_repo_tag"
docker push "$sha1_flavor_repo_tag"
else
docker tag $local_tag $full_repo_tag
docker tag $local_tag $branch_repo_tag
docker tag $local_tag $sha1_repo_tag
docker push $full_repo_tag
docker push $branch_repo_tag
docker push $sha1_repo_tag
docker tag "$local_tag" "$full_repo_tag"
docker tag "$local_tag" "$branch_repo_tag"
docker tag "$local_tag" "$sha1_repo_tag"
docker push "$full_repo_tag"
docker push "$branch_repo_tag"
docker push "$sha1_repo_tag"
fi
return
fi
Expand All @@ -278,7 +304,7 @@ function push_ceph_imgs_latest {
latest_name="${latest_name}-devel"
fi
for i in daemon-base daemon; do
tag=ceph/$i:${CONTAINER_BRANCH}-${CONTAINER_SHA}-$release-centos-$(_centos_release ${release})-${HOST_ARCH}
tag=ceph/$i:${CONTAINER_BRANCH}-${CONTAINER_SHA}-$release-centos-$(_centos_release "${release}")-${HOST_ARCH}
# tag image
docker tag "$tag" ceph/$i:"$latest_name"

Expand Down Expand Up @@ -309,11 +335,11 @@ function create_registry_manifest {
# This should normally work, by the time we get here the arm64 image should have been built and pushed
# IIRC docker manisfest will fail if the image does not exist
for image in daemon-base daemon; do
for ceph_release in ${CEPH_RELEASES[@]}; do
for ceph_release in "${CEPH_RELEASES[@]}"; do
if [ "${ceph_release}" == "master" ]; then
continue
fi
TARGET_RELEASE="ceph/${image}:${RELEASE}-${ceph_release}-centos-$(_centos_release ${ceph_release})"
TARGET_RELEASE="ceph/${image}:${RELEASE}-${ceph_release}-centos-$(_centos_release "${ceph_release}")"
DOCKER_IMAGES="$TARGET_RELEASE ${TARGET_RELEASE}-x86_64"

# Let's add ARM images if being built
Expand Down Expand Up @@ -345,6 +371,8 @@ cleanup_previous_run
login_docker_hub
if ${CI_CONTAINER}; then
RELEASE=${CEPH_BRANCH}-${SHA1:0:7}
top_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
CEPH_VERSION=$(bash "${top_dir}"/maint-lib/ceph_version.sh "${CEPH_BRANCH}" CEPH_VERSION)
else
create_head_or_point_release
fi
Expand Down
98 changes: 66 additions & 32 deletions maint-lib/ceph_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,73 @@ set -euo pipefail
CEPH_VERSION_SPEC=$1
WHAT_TO_EXTRACT=$2

# By default, we consider that CEPH_VERSION_SPEC in this style: luminous
# So no point release, just a version
CEPH_POINT_RELEASE=""
CEPH_VERSION="${CEPH_VERSION_SPEC}"
function parse_ceph_version_spec {
local version_spec="${1}"
shift
local ceph_version="${1}"
shift
# By default, we consider that CEPH_VERSION_SPEC in this style: luminous
# So no point release, just a version
local ceph_ref="${version_spec}"
local ceph_point_release=""
# Search for the two possible separators between CEPH_VERSION and CEPH_POINT_RELEASE
# Let's consider CEPH_VERSION_SPEC=luminous-12.2.0-1
for separator in "=" "-"; do
# If the line doesn't have a separator, let's try the next one
if [[ ! "${version_spec}" =~ ${separator} ]]; then
continue;
fi
ceph_ref="${CEPH_VERSION_SPEC%%${separator}*}"
# only set point_release if spec looks like "<ceph_version>=<point_release>"
if [[ "$ceph_ref" == "${ceph_version}" ]]; then
ceph_point_release="${separator}${CEPH_VERSION_SPEC#*${separator}}"
else
ceph_ref=${version_spec}
fi
# Don't continue if we found something
break
done
echo "${ceph_ref}" "${ceph_point_release}"
}

# If we pass a dev branch, we don't know the version so let's use the branch name as the ceph version
if [[ $WHAT_TO_EXTRACT == "CEPH_POINT_RELEASE" ]]; then
if [[ $CEPH_VERSION =~ ^wip* ]]; then
echo $CEPH_POINT_RELEASE
exit 0
fi
function get_ceph_version {
local spec="${1}"
case "${spec}" in
*mimic*)
echo mimic
;;
*nautilus*)
echo nautilus
;;
*octopus*)
echo octopus
;;
*pacific*)
echo pacific
;;
*)
echo master
;;
esac
}

ceph_version=$(get_ceph_version "${CEPH_VERSION_SPEC}")
if [[ "${CEPH_VERSION_SPEC}" =~ wip ]]; then
ceph_ref=${CEPH_VERSION_SPEC}
ceph_point_release=""
else
if [[ $CEPH_VERSION =~ ^wip* ]]; then
echo "$CEPH_VERSION"
exit 0
fi
read -r ceph_ref ceph_point_release <<< \
"$(parse_ceph_version_spec "${CEPH_VERSION_SPEC}" "${ceph_version}")"
fi

# Search for the two possible separators between CEPH_VERSION and CEPH_POINT_RELEASE
# Let's consider CEPH_VERSION_SPEC=luminous-12.2.0-1
for separator in "=" "-"; do
# If the line doesn't have a separator, let's try the next one
if [[ ! "${CEPH_VERSION_SPEC}" =~ ${separator} ]]; then continue; fi

# If we found it, let's save both parts in the respective variables
# shellcheck disable=SC2034
CEPH_VERSION="${CEPH_VERSION_SPEC%%${separator}*}"
# shellcheck disable=SC2034
CEPH_POINT_RELEASE="${separator}${CEPH_VERSION_SPEC#*${separator}}"

# Don't continue if we found something, it's time to print it
break
done

# Let's print the requested variable
echo "${!WHAT_TO_EXTRACT}"
case "$WHAT_TO_EXTRACT" in
CEPH_VERSION)
echo "${ceph_version}"
;;
CEPH_REF)
echo "${ceph_ref}"
;;
CEPH_POINT_RELEASE)
echo "${ceph_point_release}"
;;
esac
8 changes: 7 additions & 1 deletion maint-lib/makelib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ $(shell bash -c 'set -eu ; \
set_var HOST_ARCH "$(word 1, $(subst $(comma), ,$(1)))" ; \
ceph_version_spec="$(word 2, $(subst $(comma), ,$(1)))" ; \
set_var CEPH_VERSION "$$(bash maint-lib/ceph_version.sh "$$ceph_version_spec" CEPH_VERSION)" ; \
set_var CEPH_POINT_RELEASE "$$(bash maint-lib/ceph_version.sh "$$ceph_version_spec" CEPH_POINT_RELEASE)" ; \
if "$(CEPH_DEVEL)"; then \
set_var CEPH_REF "$$ceph_version_spec" ; \
set_var CEPH_POINT_RELEASE "" ; \
else \
set_var CEPH_REF "$$(bash maint-lib/ceph_version.sh "$$ceph_version_spec" CEPH_REF)" ; \
set_var CEPH_POINT_RELEASE "$$(bash maint-lib/ceph_version.sh "$$ceph_version_spec" CEPH_POINT_RELEASE)" ; \
fi ; \
set_var CEPH_DEVEL "$(CEPH_DEVEL)" ; \
set_var OSD_FLAVOR "$(OSD_FLAVOR)" ; \
set_var DISTRO "$(word 3, $(subst $(comma), , $(1)))" ; \
Expand Down
5 changes: 3 additions & 2 deletions maint-lib/stagelib/envglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
REQUIRED_ENV_VARS = OrderedDict([
('CEPH_VERSION', 'Ceph named version part of the ceph-releases source path' + # noqa: E241,E501
ALIGNED_NEWLINE + '(e.g., luminous, mimic)'), # noqa: E241
('CEPH_REF', 'Branch name of Ceph (e.g. wip-luminous-test)'), # noqa: E241,E501
('CEPH_POINT_RELEASE', 'Points to specific version of Ceph (e.g -12.2.0) or empty'), # noqa: E241,E501
('CEPH_DEVEL', 'Flag to enable ceph development packages (default false)'), # noqa: E241,E501
('OSD_FLAVOR', 'Choose to build between default and crimson osd (default flavor: default)'), # noqa: E241,E501
('CEPH_DEVEL', 'Flag to enable ceph development packages (default false)'), # noqa: E241,E501
('OSD_FLAVOR', 'Choose to build between default and crimson osd (default flavor: default)'), # noqa: E241,E501
('DISTRO', 'Distro part of the ceph-releases source path (e.g., opensuse, centos)'), # noqa: E241,E501
('DISTRO_VERSION', 'Distro version part of the ceph-releases source path' + # noqa: E241,E501
ALIGNED_NEWLINE + '(e.g. in quotes, opensuse/"42.3", centos/"7")'),
Expand Down
1 change: 1 addition & 0 deletions src/daemon-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __DOCKERFILE_TRACEABILITY_LABELS__
ENV CEPH_VERSION __ENV_[CEPH_VERSION]__
ENV CEPH_POINT_RELEASE "__ENV_[CEPH_POINT_RELEASE]__"
ENV CEPH_DEVEL __ENV_[CEPH_DEVEL]__
ENV CEPH_REF __ENV_[CEPH_REF]__
ENV OSD_FLAVOR __ENV_[OSD_FLAVOR]__

#======================================================
Expand Down
2 changes: 2 additions & 0 deletions tests/stage-test/test_staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail
# Integration test to make sure staging is working properly

export CEPH_VERSION_SPEC=luminous-12.2.1-0
CEPH_REF=$(maint-lib/ceph_version.sh "${CEPH_VERSION_SPEC}" "CEPH_REF")
export CEPH_REF
CEPH_VERSION=$(maint-lib/ceph_version.sh "${CEPH_VERSION_SPEC}" "CEPH_VERSION")
export CEPH_VERSION
CEPH_POINT_RELEASE=$(maint-lib/ceph_version.sh "${CEPH_VERSION_SPEC}" "CEPH_POINT_RELEASE")
Expand Down