From 604052dca9ef97647b2c00feb655199a488fbe79 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:24:09 +0000 Subject: [PATCH 1/4] Add Ubuntu version-specific tags for Docker images - Add support for Ubuntu version-specific tags (e.g., ubuntu-24.04, ubuntu-noble) - Modify build_images.sh to extract Ubuntu version from Dockerfile and create additional tags - Update push_images.sh to push version-specific tags to Docker Hub - Update README.md to document the new Ubuntu version-specific tags - Resolves issue with workspaces breaking when Ubuntu base version changes Co-authored-by: matifali <10648092+matifali@users.noreply.github.com> --- README.md | 22 +++++++++++++++ scripts/build_images.sh | 62 ++++++++++++++++++++++++++++++++++++++++- scripts/push_images.sh | 59 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ff2d5b9..4be7d12 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,28 @@ https://hub.docker.com/r/codercom/enterprise-base. The tag is taken from the filename of the Dockerfile. For example, `base/ubuntu.Dockerfile` is under the `ubuntu` tag. +### Ubuntu Version-Specific Tags + +For Ubuntu-based images, additional version-specific tags are automatically created +to provide stability and prevent unexpected breaking changes when the base Ubuntu +version is updated: + +- `ubuntu-24.04` - Ubuntu 24.04 LTS (Noble Numbat) +- `ubuntu-noble` - Ubuntu Noble Numbat (24.04 LTS) +- `ubuntu-22.04` - Ubuntu 22.04 LTS (Jammy Jellyfish) +- `ubuntu-jammy` - Ubuntu Jammy Jellyfish (22.04 LTS) + +Example usage: +```yaml +# Use a specific Ubuntu version to ensure stability +image: codercom/enterprise-base:ubuntu-24.04 +# or +image: codercom/enterprise-base:ubuntu-noble +``` + +This prevents workspaces from breaking when the base Ubuntu version is updated +in the main `ubuntu` tag. + ## Contributing See our [contributing guide](.github/CONTRIBUTING.md). diff --git a/scripts/build_images.sh b/scripts/build_images.sh index 2033375..34586dc 100755 --- a/scripts/build_images.sh +++ b/scripts/build_images.sh @@ -101,9 +101,69 @@ for image in "${IMAGES[@]}"; do continue fi + # Build tag arguments for depot build command + tag_args=("--tag=$image_ref") + + # For Ubuntu images, add version-specific tags + if [ "$TAG" = "ubuntu" ]; then + # Extract Ubuntu version from Dockerfile + ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) + if [ -n "$ubuntu_base" ]; then + # Map Ubuntu codenames to version numbers + case "$ubuntu_base" in + "noble") + ubuntu_version="24.04" + ;; + "jammy") + ubuntu_version="22.04" + ;; + "focal") + ubuntu_version="20.04" + ;; + *) + # If it's already a version number, use it directly + if [[ "$ubuntu_base" =~ ^[0-9]+\.[0-9]+$ ]]; then + ubuntu_version="$ubuntu_base" + # Map version numbers to codenames + case "$ubuntu_version" in + "24.04") + ubuntu_codename="noble" + ;; + "22.04") + ubuntu_codename="jammy" + ;; + "20.04") + ubuntu_codename="focal" + ;; + esac + else + ubuntu_version="" + fi + ;; + esac + + # Add version-specific tags + if [ -n "$ubuntu_version" ]; then + tag_args+=("--tag=codercom/enterprise-$image:ubuntu-$ubuntu_version") + if [ $QUIET = false ]; then + echo "Adding Ubuntu version tag: ubuntu-$ubuntu_version" >&2 + fi + fi + + # Add codename tag if we have one + if [ -n "${ubuntu_codename:-}" ] || [ "$ubuntu_base" != "$ubuntu_version" ]; then + codename="${ubuntu_codename:-$ubuntu_base}" + tag_args+=("--tag=codercom/enterprise-$image:ubuntu-$codename") + if [ $QUIET = false ]; then + echo "Adding Ubuntu codename tag: ubuntu-$codename" >&2 + fi + fi + fi + fi + run_trace $DRY_RUN depot build --project "gb3p8xrshk" --load --platform linux/arm64,linux/amd64,linux/arm/v7 --save --metadata-file="build_${image}.json" \ "${docker_flags[@]}" \ "$image_dir" \ --file="$image_path" \ - --tag="$image_ref" \| indent + "${tag_args[@]}" \| indent done diff --git a/scripts/push_images.sh b/scripts/push_images.sh index 4046dcb..166357c 100755 --- a/scripts/push_images.sh +++ b/scripts/push_images.sh @@ -107,4 +107,63 @@ for image in "${IMAGES[@]}"; do run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$image_ref" "$build_id" run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$image_ref_date" "$build_id" run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "codercom/enterprise-${image}:latest" "$build_id" + + # For Ubuntu images, also push version-specific tags + if [ "$TAG" = "ubuntu" ]; then + # Extract Ubuntu version from Dockerfile + ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) + if [ -n "$ubuntu_base" ]; then + # Map Ubuntu codenames to version numbers + case "$ubuntu_base" in + "noble") + ubuntu_version="24.04" + ;; + "jammy") + ubuntu_version="22.04" + ;; + "focal") + ubuntu_version="20.04" + ;; + *) + # If it's already a version number, use it directly + if [[ "$ubuntu_base" =~ ^[0-9]+\.[0-9]+$ ]]; then + ubuntu_version="$ubuntu_base" + # Map version numbers to codenames + case "$ubuntu_version" in + "24.04") + ubuntu_codename="noble" + ;; + "22.04") + ubuntu_codename="jammy" + ;; + "20.04") + ubuntu_codename="focal" + ;; + esac + else + ubuntu_version="" + fi + ;; + esac + + # Push version-specific tags + if [ -n "$ubuntu_version" ]; then + version_tag="codercom/enterprise-$image:ubuntu-$ubuntu_version" + run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$version_tag" "$build_id" + if [ $QUIET = false ]; then + echo "Pushed Ubuntu version tag: ubuntu-$ubuntu_version" >&2 + fi + fi + + # Push codename tag if we have one + if [ -n "${ubuntu_codename:-}" ] || [ "$ubuntu_base" != "$ubuntu_version" ]; then + codename="${ubuntu_codename:-$ubuntu_base}" + codename_tag="codercom/enterprise-$image:ubuntu-$codename" + run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$codename_tag" "$build_id" + if [ $QUIET = false ]; then + echo "Pushed Ubuntu codename tag: ubuntu-$codename" >&2 + fi + fi + fi + fi done From 59903a3fad4bf96361a7704f5486e1e12d2e3518 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:26:03 +0000 Subject: [PATCH 2/4] Fix README formatting for dprint Add missing blank line before code block in Ubuntu version tags documentation. Co-authored-by: matifali <10648092+matifali@users.noreply.github.com> --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4be7d12..2bcc459 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ version is updated: - `ubuntu-jammy` - Ubuntu Jammy Jellyfish (22.04 LTS) Example usage: + ```yaml # Use a specific Ubuntu version to ensure stability image: codercom/enterprise-base:ubuntu-24.04 From 5b2a84a3e134a870f74312a1d9af81de13854629 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:27:17 +0000 Subject: [PATCH 3/4] Limit Ubuntu version support to 24.04 only - Update build and push scripts to only support Ubuntu 24.04 (Noble) - Keep extensible structure for future Ubuntu version support - Add warning messages for unsupported Ubuntu versions - Update README to reflect current Ubuntu 24.04 only support Co-authored-by: matifali <10648092+matifali@users.noreply.github.com> --- README.md | 6 +++--- scripts/build_images.sh | 30 ++++++++---------------------- scripts/push_images.sh | 30 ++++++++---------------------- 3 files changed, 19 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 2bcc459..edab937 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ under the `ubuntu` tag. For Ubuntu-based images, additional version-specific tags are automatically created to provide stability and prevent unexpected breaking changes when the base Ubuntu -version is updated: +version is updated. + +Currently supported Ubuntu versions: - `ubuntu-24.04` - Ubuntu 24.04 LTS (Noble Numbat) - `ubuntu-noble` - Ubuntu Noble Numbat (24.04 LTS) -- `ubuntu-22.04` - Ubuntu 22.04 LTS (Jammy Jellyfish) -- `ubuntu-jammy` - Ubuntu Jammy Jellyfish (22.04 LTS) Example usage: diff --git a/scripts/build_images.sh b/scripts/build_images.sh index 34586dc..b297f86 100755 --- a/scripts/build_images.sh +++ b/scripts/build_images.sh @@ -110,34 +110,20 @@ for image in "${IMAGES[@]}"; do ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) if [ -n "$ubuntu_base" ]; then # Map Ubuntu codenames to version numbers + # Currently only Ubuntu 24.04 (Noble) is supported case "$ubuntu_base" in "noble") ubuntu_version="24.04" ;; - "jammy") - ubuntu_version="22.04" - ;; - "focal") - ubuntu_version="20.04" + "24.04") + ubuntu_version="24.04" + ubuntu_codename="noble" ;; *) - # If it's already a version number, use it directly - if [[ "$ubuntu_base" =~ ^[0-9]+\.[0-9]+$ ]]; then - ubuntu_version="$ubuntu_base" - # Map version numbers to codenames - case "$ubuntu_version" in - "24.04") - ubuntu_codename="noble" - ;; - "22.04") - ubuntu_codename="jammy" - ;; - "20.04") - ubuntu_codename="focal" - ;; - esac - else - ubuntu_version="" + # Unsupported Ubuntu version - skip version-specific tags + ubuntu_version="" + if [ $QUIET = false ]; then + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 (Noble) is currently supported." >&2 fi ;; esac diff --git a/scripts/push_images.sh b/scripts/push_images.sh index 166357c..3195c84 100755 --- a/scripts/push_images.sh +++ b/scripts/push_images.sh @@ -114,34 +114,20 @@ for image in "${IMAGES[@]}"; do ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) if [ -n "$ubuntu_base" ]; then # Map Ubuntu codenames to version numbers + # Currently only Ubuntu 24.04 (Noble) is supported case "$ubuntu_base" in "noble") ubuntu_version="24.04" ;; - "jammy") - ubuntu_version="22.04" - ;; - "focal") - ubuntu_version="20.04" + "24.04") + ubuntu_version="24.04" + ubuntu_codename="noble" ;; *) - # If it's already a version number, use it directly - if [[ "$ubuntu_base" =~ ^[0-9]+\.[0-9]+$ ]]; then - ubuntu_version="$ubuntu_base" - # Map version numbers to codenames - case "$ubuntu_version" in - "24.04") - ubuntu_codename="noble" - ;; - "22.04") - ubuntu_codename="jammy" - ;; - "20.04") - ubuntu_codename="focal" - ;; - esac - else - ubuntu_version="" + # Unsupported Ubuntu version - skip version-specific tags + ubuntu_version="" + if [ $QUIET = false ]; then + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 (Noble) is currently supported." >&2 fi ;; esac From cac51ecd30038c033b8130655a38d9b1f9a3d396 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:35:25 +0000 Subject: [PATCH 4/4] Simplify to use only version numbers - Update Dockerfile to use ubuntu:24.04 instead of ubuntu:noble - Simplify build and push scripts to only create ubuntu-24.04 tags - Remove codename-based tags (ubuntu-noble) for simplicity - Update README to reflect simplified approach - Keep extensible structure for future Ubuntu versions Co-authored-by: matifali <10648092+matifali@users.noreply.github.com> --- README.md | 5 +---- images/base/ubuntu.Dockerfile | 2 +- scripts/build_images.sh | 21 ++++----------------- scripts/push_images.sh | 22 ++++------------------ 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index edab937..607db9b 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,13 @@ version is updated. Currently supported Ubuntu versions: -- `ubuntu-24.04` - Ubuntu 24.04 LTS (Noble Numbat) -- `ubuntu-noble` - Ubuntu Noble Numbat (24.04 LTS) +- `ubuntu-24.04` - Ubuntu 24.04 LTS Example usage: ```yaml # Use a specific Ubuntu version to ensure stability image: codercom/enterprise-base:ubuntu-24.04 -# or -image: codercom/enterprise-base:ubuntu-noble ``` This prevents workspaces from breaking when the base Ubuntu version is updated diff --git a/images/base/ubuntu.Dockerfile b/images/base/ubuntu.Dockerfile index ac4d0c3..ce05a91 100644 --- a/images/base/ubuntu.Dockerfile +++ b/images/base/ubuntu.Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:noble +FROM ubuntu:24.04 SHELL ["/bin/bash", "-c"] ENV DEBIAN_FRONTEND=noninteractive diff --git a/scripts/build_images.sh b/scripts/build_images.sh index b297f86..2c8e064 100755 --- a/scripts/build_images.sh +++ b/scripts/build_images.sh @@ -109,41 +109,28 @@ for image in "${IMAGES[@]}"; do # Extract Ubuntu version from Dockerfile ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) if [ -n "$ubuntu_base" ]; then - # Map Ubuntu codenames to version numbers - # Currently only Ubuntu 24.04 (Noble) is supported + # Extract Ubuntu version number + # Currently only Ubuntu 24.04 is supported case "$ubuntu_base" in - "noble") - ubuntu_version="24.04" - ;; "24.04") ubuntu_version="24.04" - ubuntu_codename="noble" ;; *) # Unsupported Ubuntu version - skip version-specific tags ubuntu_version="" if [ $QUIET = false ]; then - echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 (Noble) is currently supported." >&2 + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 is currently supported." >&2 fi ;; esac - # Add version-specific tags + # Add version-specific tag if [ -n "$ubuntu_version" ]; then tag_args+=("--tag=codercom/enterprise-$image:ubuntu-$ubuntu_version") if [ $QUIET = false ]; then echo "Adding Ubuntu version tag: ubuntu-$ubuntu_version" >&2 fi fi - - # Add codename tag if we have one - if [ -n "${ubuntu_codename:-}" ] || [ "$ubuntu_base" != "$ubuntu_version" ]; then - codename="${ubuntu_codename:-$ubuntu_base}" - tag_args+=("--tag=codercom/enterprise-$image:ubuntu-$codename") - if [ $QUIET = false ]; then - echo "Adding Ubuntu codename tag: ubuntu-$codename" >&2 - fi - fi fi fi diff --git a/scripts/push_images.sh b/scripts/push_images.sh index 3195c84..8b736ee 100755 --- a/scripts/push_images.sh +++ b/scripts/push_images.sh @@ -113,26 +113,22 @@ for image in "${IMAGES[@]}"; do # Extract Ubuntu version from Dockerfile ubuntu_base=$(grep "^FROM ubuntu:" "$image_path" | head -1 | cut -d: -f2) if [ -n "$ubuntu_base" ]; then - # Map Ubuntu codenames to version numbers - # Currently only Ubuntu 24.04 (Noble) is supported + # Extract Ubuntu version number + # Currently only Ubuntu 24.04 is supported case "$ubuntu_base" in - "noble") - ubuntu_version="24.04" - ;; "24.04") ubuntu_version="24.04" - ubuntu_codename="noble" ;; *) # Unsupported Ubuntu version - skip version-specific tags ubuntu_version="" if [ $QUIET = false ]; then - echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 (Noble) is currently supported." >&2 + echo "Warning: Ubuntu version '$ubuntu_base' not supported for version-specific tags. Only Ubuntu 24.04 is currently supported." >&2 fi ;; esac - # Push version-specific tags + # Push version-specific tag if [ -n "$ubuntu_version" ]; then version_tag="codercom/enterprise-$image:ubuntu-$ubuntu_version" run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$version_tag" "$build_id" @@ -140,16 +136,6 @@ for image in "${IMAGES[@]}"; do echo "Pushed Ubuntu version tag: ubuntu-$ubuntu_version" >&2 fi fi - - # Push codename tag if we have one - if [ -n "${ubuntu_codename:-}" ] || [ "$ubuntu_base" != "$ubuntu_version" ]; then - codename="${ubuntu_codename:-$ubuntu_base}" - codename_tag="codercom/enterprise-$image:ubuntu-$codename" - run_trace $DRY_RUN depot push --project "gb3p8xrshk" --tag "$codename_tag" "$build_id" - if [ $QUIET = false ]; then - echo "Pushed Ubuntu codename tag: ubuntu-$codename" >&2 - fi - fi fi fi done