Sanitize branch names in app_release.py so Docker image tags stay valid

Open Beginner friendly
#4,321 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
docker, github-actions, python
Domain
devops

Research direction

Read deploy/scripts/app_release.py, focusing on get_release() and the tag construction; compare its current branch normalization with Docker's allowed tag characters. Reproduce with a branch such as v2.9.0+deploy through the Deploy Update to QA Server workflow, and consider it complete when the resulting image tag is valid while existing master and tagged-release behavior remains unaffected.

Written by the indexing model from the issue text.

Description

bug deployment python

Summary

For branch-based QA deploys, deploy/scripts/app_release.py builds the image tag as {release}-{branch_name}.{num_commits} but only sanitizes / and _ in the branch name. Git branch names can legally contain characters that are illegal in Docker image tags (e.g. +), which makes the image build fail with invalid reference format.

Reproduction

Trigger the Deploy Update to QA Server workflow from a branch whose name contains a + (e.g. v2.9.0+deploy). The build step fails:

ERROR: failed to build: invalid tag ".../combine_maint:v2.9.0-v2.9.0+deploy.5": invalid reference format

Root cause

In get_release():

branch_name = re.sub("[/_]+", "-", result.stdout) or "HEADLESS"

Only / and _ are replaced. Docker image tags allow only [A-Za-z0-9_.-] (max 128 chars), so a + (or other characters valid in git refs) passes through and produces an invalid tag.

Proposed fix

Replace any run of characters that are invalid in a Docker tag with -:

branch_name = re.sub(r"[^A-Za-z0-9.-]+", "-", result.stdout) or "HEADLESS"

This preserves the current behavior (/-, _-) and additionally handles + and any other illegal characters.

Scope

Only affects branch-based deploys whose branch name contains a Docker-illegal character. Normal QA deploys from master and tagged releases (where HEAD is exactly on the tag, so no branch suffix is appended) are unaffected.

Dominant language
TypeScript
Stars
22
Forks
10
Avg merge
2d 2h
Merged PRs (30d)
9

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sillsdev/TheCombine

All issues in sillsdev/TheCombine

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.