Skip to content

Commit b8a8508

Browse files
committed
[UPDATE][v2.5.3] Bump image version
1 parent 8a32eca commit b8a8508

3 files changed

Lines changed: 144 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# Repository Guidelines
22

33
## Project Structure & Module Organization
4-
This repository is a small Docker image build system. The root contains `Dockerfile.cpu` and `Dockerfile.cuda`, which define the CPU and CUDA variants. Shared shell entrypoints, environment setup, and container dotfiles live in `data/`. Operational wrappers live in `scripts/`: `build.sh`, `run.sh`, `exec.sh`, and `image-configs.sh`. Release automation is in `.github/workflows/cd-docker-build-push.yml`.
4+
This repository is a small Docker image build system. The root contains `Dockerfile.cpu` and `Dockerfile.cuda`, which define the CPU and CUDA variants. Shared shell entrypoints, environment setup, and container dotfiles live in `data/`. Operational wrappers live in `scripts/`: `build.sh`, `run.sh`, `exec.sh`, `image-configs.sh`, and `next-version.sh`. Release automation is in `.github/workflows/cd-docker-build-push.yml`.
55

66
## Build, Test, and Development Commands
77
Use the scripts rather than calling long `docker` commands by hand.
88

99
- `bash ./scripts/build.sh Dockerfile.cpu`: build the CPU image and print its tag.
1010
- `bash ./scripts/build.sh Dockerfile.cuda`: build the CUDA image using the version values from `scripts/image-configs.sh`.
11+
- `bash ./scripts/next-version.sh --patch --push`: bump `IMAGE_VERSION`, commit current changes, tag the release, and push the branch plus tag to start the GitHub workflow.
12+
- `bash ./scripts/next-version.sh --minor --push` or `--major --push`: same release flow for larger version bumps.
1113
- `bash ./scripts/run.sh -i jamesnulliu/deeplearning:v2.4.7-cuda12.8.0 --tmp`: start an interactive temporary container.
1214
- `bash ./scripts/run.sh -i <image> -c devbox`: start a named long-lived container.
1315
- `bash ./scripts/exec.sh devbox`: open a shell in an existing container.
1416

1517
## Coding Style & Naming Conventions
16-
Keep Dockerfiles and shell scripts POSIX/Bash-friendly, with one logical step per block and consistent four-space indentation for wrapped commands. Prefer uppercase variable names for exported build configuration (`IMAGE_VERSION`, `CUDA_VERSION`) and lowercase filenames for scripts and data assets. When you change a version, update `scripts/image-configs.sh` first so tags stay consistent.
18+
Keep Dockerfiles and shell scripts POSIX/Bash-friendly, with one logical step per block and consistent four-space indentation for wrapped commands. Prefer uppercase variable names for exported build configuration (`IMAGE_VERSION`, `CUDA_VERSION`) and lowercase filenames for scripts and data assets. When you change a version, update `scripts/image-configs.sh` first so tags stay consistent. For releases, prefer `scripts/next-version.sh` so the version bump, commit, tag, and push happen in one place.
1719

1820
## Testing Guidelines
1921
There is no automated unit test suite in this repository today. Validation is build-and-smoke-test based: rebuild the affected Dockerfile, start a container, and verify entrypoint behavior plus any installed toolchain changes. For example, after editing `data/env_setup.sh`, run the image and confirm the shell starts cleanly.
2022

2123
## Commit & Pull Request Guidelines
22-
Recent history uses short bracketed prefixes such as `[update]`, `[fix]`, and version-scoped subjects like `[UPDATE][v2.4.5] ...`. Follow that pattern and keep the subject imperative. PRs should state which image variant changed, summarize package/toolchain impact, include the exact build command used for verification, and note any release-tag implications. Do not commit credentials; Docker Hub publishing is handled by GitHub Actions secrets on tagged pushes (`v*`).
24+
Recent history uses short bracketed prefixes such as `[update]`, `[fix]`, and version-scoped subjects like `[UPDATE][v2.4.5] ...`. Follow that pattern and keep the subject imperative. The release helper stages all current repo changes, allows an empty commit when needed, creates the new `v*` tag, and only pushes to `origin` when `--push` is passed. PRs should state which image variant changed, summarize package/toolchain impact, include the exact build command used for verification, and note any release-tag implications. Do not commit credentials; Docker Hub publishing is handled by GitHub Actions secrets on tagged pushes (`v*`).

scripts/image-configs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
IMAGE_VERSION=2.5.2
3+
IMAGE_VERSION=2.5.3
44
CUDA_VERSION=12.8.0
55
UBUNTU_VERSION=24.04
66
LLVM_VERSION=20
@@ -75,7 +75,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
7575
resolve_image_name "${docker_file}"
7676
else
7777
cat <<EOF
78-
IMAGE_VERSION=${IMAGE_VERSION}
78+
IMAGE_VERSION=2.5.3
7979
CUDA_VERSION=${CUDA_VERSION}
8080
UBUNTU_VERSION=${UBUNTU_VERSION}
8181
LLVM_VERSION=${LLVM_VERSION}

scripts/next-version.sh

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
7+
VERSION_FILE="${REPO_ROOT}/scripts/image-configs.sh"
8+
9+
BUMP_TYPE=""
10+
DO_PUSH="false"
11+
12+
print_help() {
13+
cat <<'EOF'
14+
Usage: ./scripts/next-version.sh [--patch|--minor|--major] [--push]
15+
16+
Bump the release version, commit current changes, tag the commit, and optionally push
17+
the branch plus tag to origin to trigger the GitHub workflow.
18+
19+
Options:
20+
--patch Bump the patch version. Default when no bump flag is set.
21+
--minor Bump the minor version and reset patch to 0.
22+
--major Bump the major version and reset minor and patch to 0.
23+
--push Push the current branch and new tag to origin.
24+
-h, --help Show this help message and exit.
25+
26+
Examples:
27+
./scripts/next-version.sh --patch
28+
./scripts/next-version.sh --minor --push
29+
./scripts/next-version.sh --major --push
30+
EOF
31+
}
32+
33+
error() {
34+
printf '[next-version.sh] ERROR: %s\n' "$1" >&2
35+
exit 1
36+
}
37+
38+
bump_version() {
39+
local version="$1"
40+
local bump="$2"
41+
local major minor patch
42+
43+
if [[ ! "${version}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
44+
error "Unsupported version format: ${version}"
45+
fi
46+
47+
major="${BASH_REMATCH[1]}"
48+
minor="${BASH_REMATCH[2]}"
49+
patch="${BASH_REMATCH[3]}"
50+
51+
case "${bump}" in
52+
patch)
53+
patch="$((patch + 1))"
54+
;;
55+
minor)
56+
minor="$((minor + 1))"
57+
patch=0
58+
;;
59+
major)
60+
major="$((major + 1))"
61+
minor=0
62+
patch=0
63+
;;
64+
*)
65+
error "Unsupported bump type: ${bump}"
66+
;;
67+
esac
68+
69+
printf '%s.%s.%s\n' "${major}" "${minor}" "${patch}"
70+
}
71+
72+
while [[ $# -gt 0 ]]; do
73+
case "$1" in
74+
--patch|--minor|--major)
75+
if [[ -n "${BUMP_TYPE}" ]]; then
76+
error "Only one bump flag can be provided."
77+
fi
78+
BUMP_TYPE="${1#--}"
79+
shift
80+
;;
81+
--push)
82+
DO_PUSH="true"
83+
shift
84+
;;
85+
-h|--help)
86+
print_help
87+
exit 0
88+
;;
89+
*)
90+
error "Unknown argument: $1"
91+
;;
92+
esac
93+
done
94+
95+
if [[ -z "${BUMP_TYPE}" ]]; then
96+
BUMP_TYPE="patch"
97+
fi
98+
99+
if [[ ! -f "${VERSION_FILE}" ]]; then
100+
error "Version file not found: ${VERSION_FILE}"
101+
fi
102+
103+
source "${VERSION_FILE}"
104+
105+
if [[ -z "${IMAGE_VERSION:-}" ]]; then
106+
error "IMAGE_VERSION is not set in ${VERSION_FILE}"
107+
fi
108+
109+
CURRENT_VERSION="${IMAGE_VERSION}"
110+
NEW_VERSION="$(bump_version "${CURRENT_VERSION}" "${BUMP_TYPE}")"
111+
NEW_TAG="v${NEW_VERSION}"
112+
113+
if git -C "${REPO_ROOT}" rev-parse -q --verify "refs/tags/${NEW_TAG}" >/dev/null; then
114+
error "Tag already exists: ${NEW_TAG}"
115+
fi
116+
117+
sed -i "s/^IMAGE_VERSION=.*/IMAGE_VERSION=${NEW_VERSION}/" "${VERSION_FILE}"
118+
119+
git -C "${REPO_ROOT}" add -A
120+
git -C "${REPO_ROOT}" commit --allow-empty -m "[UPDATE][${NEW_TAG}] Bump image version"
121+
git -C "${REPO_ROOT}" tag "${NEW_TAG}"
122+
123+
printf '[next-version.sh] Created commit and tag %s from %s\n' "${NEW_TAG}" "${CURRENT_VERSION}"
124+
125+
if [[ "${DO_PUSH}" == "true" ]]; then
126+
CURRENT_BRANCH="$(git -C "${REPO_ROOT}" branch --show-current)"
127+
128+
if [[ -z "${CURRENT_BRANCH}" ]]; then
129+
error "Cannot push from a detached HEAD."
130+
fi
131+
132+
git -C "${REPO_ROOT}" push origin "${CURRENT_BRANCH}"
133+
git -C "${REPO_ROOT}" push origin "${NEW_TAG}"
134+
printf '[next-version.sh] Pushed %s and %s to origin\n' "${CURRENT_BRANCH}" "${NEW_TAG}"
135+
else
136+
printf '[next-version.sh] Run with --push to publish the branch and tag to origin.\n'
137+
fi

0 commit comments

Comments
 (0)