Skip to content

Commit

Permalink
build: now we would patch the Dockerfile for corresponding version
Browse files Browse the repository at this point in the history
    - That we can aviod patch version when we create stable branch

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng committed Jul 5, 2024
1 parent 8e089b8 commit 05287ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ docker build ${DOCKER_BUILD_ARGS} \
--build-arg CACHEBUST="${CACHEBUST}" \
-t ${IMAGE} .

# restore the original Dockerfile
if [ -n "${VERSION_PATCHED}" ]; then
mv Dockerfile.bak Dockerfile
mv nvidia-driver-toolkit/Dockerfile.bak nvidia-driver-toolkit/Dockerfile
fi
14 changes: 14 additions & 0 deletions scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,17 @@ echo "==============="
echo "OS release info"
echo "==============="
cat os-release

BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [[ ! $BRANCH_NAME =~ ^harvester- ]]; then
echo "Branch name does not start with 'harvester-' prefix, skip patching version."
return || exit 0
fi
echo "Patch target baseos version with branch name: $BRANCH_NAME"
VERSION=$(echo "$BRANCH_NAME" | sed 's/harvester-//; s/\.x$//')
# Update the Dockerfile with the new version
cp Dockerfile Dockerfile.bak
cp nvidia-driver-toolkit/Dockerfile nvidia-driver-toolkit/Dockerfile.bak
sed -i "0,/dev/s//${VERSION}/" Dockerfile
sed -i "0,/dev/s//${VERSION}/" nvidia-driver-toolkit/Dockerfile
VERSION_PATCHED=true

0 comments on commit 05287ba

Please sign in to comment.