Skip to content

Commit

Permalink
chore(build): support tag in longhorn/dep-versions
Browse files Browse the repository at this point in the history
Longhorn 10208

Signed-off-by: Derek Su <[email protected]>
(cherry picked from commit 261ae97)
  • Loading branch information
derekbit authored and mergify[bot] committed Feb 18, 2025
1 parent 32a5ea2 commit f5d290d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

FROM registry.suse.com/bci/bci-base:15.6 AS build

ARG BRANCH=main
ARG SRC_BRANCH=main
ARG SRC_TAG

RUN zypper -n ref && \
zypper update -y
Expand All @@ -19,7 +20,12 @@ RUN zypper -n install autoconf bison curl cmake doxygen make git gcc14 gcc14-c++
tar gzip dbus-1-devel lsb-release graphviz-devel libnsl-devel libcurl-devel libjson-c-devel libacl-devel jq && \
rm -rf /var/cache/zypp/*

RUN git clone https://github.com/longhorn/dep-versions.git -b ${BRANCH} /usr/src/dep-versions
RUN git clone https://github.com/longhorn/dep-versions.git -b ${SRC_BRANCH} /usr/src/dep-versions && \
cd /usr/src/dep-versions && \
if [ -n "${SRC_TAG}" ] && git show-ref --tags ${SRC_TAG} > /dev/null 2>&1; then \
echo "Checking out tag ${SRC_TAG}"; \
cd /usr/src/dep-versions && git checkout tags/${SRC_TAG}; \
fi

# Build nfs-ganesha
RUN export REPO_OVERRIDE="" && \
Expand Down
6 changes: 4 additions & 2 deletions scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function get_branch() {
fi
}

BRANCH=$(get_branch)
SRC_BRANCH=$(get_branch)
SRC_TAG=$(git tag --points-at HEAD | head -n 1)

# update base image to get latest changes
BASE_IMAGE=`grep FROM package/Dockerfile | grep -v AS | awk '{print $2}'`
Expand All @@ -63,7 +64,8 @@ echo "Building image ${IMAGE} based on ${BASE_IMAGE}"
buildx build \
--load \
--build-arg ARCH="${ARCH}" \
--build-arg BRANCH="${BRANCH}" \
--build-arg SRC_BRANCH="${SRC_BRANCH}" \
--build-arg SRC_TAG="${SRC_TAG}" \
-t "${IMAGE}" \
-f package/Dockerfile .

Expand Down

0 comments on commit f5d290d

Please sign in to comment.