Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

fix: version update in a docker-compose.yaml file #375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commitizen/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _get_line_break_position(text: str) -> int:

def _version_to_regex(version: str):
clean_regex = version.replace(".", r"\.").replace("+", r"\+")
return re.compile(f"\\b{clean_regex}\\b")
return re.compile(f"{clean_regex}")


def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
Expand Down
30 changes: 28 additions & 2 deletions tests/test_bump_update_version_in_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@
version = "1.2.3"
"""

DOCKER_COMPOSE = """
version: "3.3"

services:
app:
image: my-repo/my-container:v1.2.3
command: my-command
"""

MULTIPLE_VERSIONS_INCREASE_STRING = 'version = "1.2.9"\n' * 30
MULTIPLE_VERSIONS_REDUCE_STRING = 'version = "1.2.10"\n' * 30

Expand Down Expand Up @@ -104,8 +113,25 @@ def multiple_versions_reduce_string(tmpdir):


@pytest.fixture(scope="function")
def version_files(commitizen_config_file, python_version_file, version_repeated_file):
return [commitizen_config_file, python_version_file, version_repeated_file]
def docker_compose_file(tmpdir):
tmp_file = tmpdir.join("docker-compose.yaml")
tmp_file.write(DOCKER_COMPOSE)
return str(tmp_file)


@pytest.fixture(scope="function")
def version_files(
commitizen_config_file,
python_version_file,
version_repeated_file,
docker_compose_file,
):
return [
commitizen_config_file,
python_version_file,
version_repeated_file,
docker_compose_file,
]


def test_update_version_in_files(version_files):
Expand Down