Skip to content

Commit 00b13a6

Browse files
committed
feat(ci): Build containers without python deps
This change allows building the container images without the python dependencies that are getting harder to get by. Signed-off-by: Antoni Segura Puimedon <[email protected]>
1 parent 5d3f4d7 commit 00b13a6

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ COPY . .
1313
RUN if [ -f "${BUILD_IMAGE_CUSTOMIZATION}" ]; then "${BUILD_IMAGE_CUSTOMIZATION}"; fi
1414

1515
RUN if [ -e "/activation-key/org" ]; then unlink /etc/rhsm-host; subscription-manager register --force --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey"); fi
16-
RUN python3 -m ensurepip
1716
ENV GO=${GO}
1817
RUN make build-hiveutil
1918

@@ -29,7 +28,6 @@ RUN if [ -f "${BUILD_IMAGE_CUSTOMIZATION}" ]; then "${BUILD_IMAGE_CUSTOMIZATION}
2928

3029
ENV SMDEV_CONTAINER_OFF=${CONTAINER_SUB_MANAGER_OFF}
3130
RUN if [ -e "/activation-key/org" ]; then unlink /etc/rhsm-host; subscription-manager register --force --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey"); fi
32-
RUN python3 -m ensurepip
3331
ENV GO=${GO}
3432
RUN make build-hiveadmission build-manager build-operator && \
3533
make build-hiveutil

Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ endif
7676
# we don't tag versions. Override using the same versioning we apply to OperatorHub builds:
7777
# v{major}.{minor}.{commitcount}-{sha}
7878
# Note that building against a local commit may result in {major}.{minor} being rendered as
79-
# `UnknownBranch`. However, the {commitcount} and {sha} should still be accurate.
80-
SOURCE_GIT_TAG := $(shell export HOME=$(HOME); python3 -m ensurepip >&2; python3 -mpip --no-cache install --user gitpython pyyaml >&2; hack/version2.py)
79+
# 0.0.x-y if it is an `UnknownBranch`. However, the {commitcount} and {sha}
80+
# should still be accurate.
81+
SOURCE_GIT_TAG := $(shell hack/version2.sh)
8182

8283
BINDATA_INPUTS :=./config/sharded_controllers/... ./config/hiveadmission/... ./config/controllers/... ./config/rbac/... ./config/configmaps/...
8384
$(call add-bindata,operator,$(BINDATA_INPUTS),,assets,pkg/operator/assets/bindata.go)

hack/ubi-build-deps.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
dnf install -y \
33
git \
44
golang \
5-
make \
6-
python3
5+
make
76

87
# Since go 1.23.x is not available in ubi8, let's go upstream
98
go install golang.org/dl/go1.23.6@latest

hack/version2.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
declare -r UNKNOWN_BRANCH_PREFIX="0.0"
3+
declare -r MASTER_BRANCH_PREFIX="1.2"
4+
5+
function prefix_from_branch() {
6+
declare -r branch_name="$1"
7+
8+
if [[ "$branch_name" =~ ^([^/]+/)?mce-([[:digit:]]+.[[:digit:]]+) ]]; then
9+
echo "${BASH_REMATCH[2]}"
10+
elif [[ "$branch_name" =~ ^([^/]+/)?master$ ]]; then
11+
echo "$MASTER_BRANCH_PREFIX"
12+
else
13+
echo "$UNKNOWN_BRANCH_PREFIX"
14+
fi
15+
}
16+
17+
function commit_count() {
18+
git rev-list --count "$(git rev-list --max-parents=0 HEAD)..HEAD"
19+
}
20+
21+
function short_sha() {
22+
git rev-parse --short HEAD
23+
}
24+
25+
echo "$(prefix_from_branch "$(git rev-parse --abbrev-ref HEAD)").$(commit_count)-$(short_sha)"

0 commit comments

Comments
 (0)