File tree Expand file tree Collapse file tree 3 files changed +38
-7
lines changed Expand file tree Collapse file tree 3 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ usage() {
2020Usage: $SELF_NAME [--platform PF] <version>
2121... where <version> is a 'x.y' version such as 8.0.
2222
23- --platform override the default platform for the build container.
23+ --platform override the default platform for the build container.
24+ --bootstrap generate a bootstrap image, needed to build xcp-ng-release.
2425EOF
2526}
2627
2728PLATFORM=
29+ BOOTSTRAP=0
2830while [ $# -ge 1 ]; do
2931 case " $1 " in
3032 --help|-h)
@@ -36,6 +38,9 @@ while [ $# -ge 1 ]; do
3638 PLATFORM=" $2 "
3739 shift
3840 ;;
41+ --bootstrap)
42+ BOOTSTRAP=1
43+ ;;
3944 -* )
4045 die_usage " unknown flag '$1 '"
4146 ;;
4853
4954[ -n " $1 " ] || die_usage " version parameter missing"
5055
56+ case " $1 " in
57+ 8.* )
58+ [ $BOOTSTRAP = 0 ] || die " --bootstrap is only supported for XCP-ng 9.0 and newer"
59+ ;;
60+ esac
61+
5162RUNNER=" "
5263if [ -n " $XCPNG_OCI_RUNNER " ]; then
5364 RUNNER=" $XCPNG_OCI_RUNNER "
110121CUSTOM_ARGS+=( " --build-arg" " CUSTOM_BUILDER_UID=${CUSTOM_UID} " )
111122CUSTOM_ARGS+=( " --build-arg" " CUSTOM_BUILDER_GID=${CUSTOM_GID} " )
112123
124+ if [ $BOOTSTRAP = 0 ]; then
125+ TAG=${1}
126+ else
127+ TAG=${1} -bootstrap
128+ CUSTOM_ARGS+=( " --build-arg" " BOOTSTRAP=1" )
129+ fi
130+
113131" $RUNNER " build \
114132 --platform " $PLATFORM " \
115133 " ${CUSTOM_ARGS[@]} " \
116- -t ghcr.io/xcp-ng/xcp-ng-build-env:${1 } \
134+ -t ghcr.io/xcp-ng/xcp-ng-build-env:${TAG } \
117135 --build-arg XCP_NG_BRANCH=${1} \
118136 --ulimit nofile=1024 \
119137 -f $DOCKERFILE .
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ def add_common_args(parser):
5656 'If both --enablerepo and --disablerepo are set, --disablerepo will be applied first' )
5757 group .add_argument ('--no-update' , action = 'store_true' ,
5858 help = 'do not run "yum update" on container start, use it as it was at build time' )
59+ group .add_argument ('--bootstrap' , action = 'store_true' ,
60+ help = 'use a bootstrap build-env, able to build xc-ng-release' )
5961
6062def add_container_args (parser ):
6163 group = parser .add_argument_group ("container arguments" )
@@ -228,8 +230,12 @@ def container(args):
228230 # no argument
229231 pass
230232
233+ tag = args .container_version
234+ if args .bootstrap :
235+ tag += "-bootstrap"
236+
231237 # exec "docker run"
232- docker_args += [f"{ CONTAINER_PREFIX } :{ args . container_version } " ,
238+ docker_args += [f"{ CONTAINER_PREFIX } :{ tag } " ,
233239 "/usr/local/bin/init-container.sh" ]
234240 print ("Launching docker with args %s" % docker_args , file = sys .stderr )
235241 return subprocess .call (docker_args )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ FROM ghcr.io/almalinux/10-base:10.0
22
33ARG CUSTOM_BUILDER_UID=" "
44ARG CUSTOM_BUILDER_GID=" "
5+ ARG BOOTSTRAP=0
56
67# Add our repositories
78# temporary bootstrap repository
@@ -12,6 +13,11 @@ COPY files/Alma10-devel.repo /etc/yum.repos.d/
1213# Install GPG key
1314RUN curl -sSf https:// xcp-ng.org/RPM-GPG-KEY-xcpng -o /etc/pki/rpm-gpg/RPM-GPG-KEY-xcpng
1415
16+ # dnf config-manager not available yet?
17+ RUN if [ " ${BOOTSTRAP}" = 1 ]; then \
18+ sed -i -e ' s/^enabled=1$/enabled=0/' /etc/yum.repos.d/xcp-ng.repo; \
19+ fi
20+
1521# Update
1622RUN dnf update -y
1723
@@ -43,11 +49,12 @@ RUN dnf install -y \
4349# clean package cache to avoid download errors
4450RUN yum clean all
4551
46- # -release*, to be commented out to boostrap the build-env until it gets built
4752# FIXME: isn' t it already pulled as almalinux-release when available?
48- RUN dnf install -y \
49- xcp-ng-release \
50- xcp-ng-release-presets
53+ RUN if [ "${BOOTSTRAP}" = 0 ]; then \
54+ dnf install -y \
55+ xcp-ng-release \
56+ xcp-ng-release-presets ; \
57+ fi
5158
5259# enable repositories commonly required to build
5360RUN dnf config-manager --enable crb
You can’t perform that action at this time.
0 commit comments