Repository: python-semantic-release/python-semantic-release (language: python)

Issue:
build_command environment variables not working after upgrade from 9.6.0 to 9.7.0
## The problem

I am using environment variables in the build command and this use to work.

```bash
build_command = "buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} ."
semantic-release version --patch
```

I found that semantic-release is not able to access environment variables at all.
I tried with simple echo and I got empty strings.

```code
build_command = "echo $APPLICATION_NAME:$CI_JOB_ID"
```

```
Error: tag :: invalid reference format
Usage: semantic-release version [OPTIONS]
Try 'semantic-release version -h' for help.

Error: Command '['bash', '-c', 'buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .']' returned non-zero exit status 125.
```

## Expected behavior

Execute the build and respect my environment variables

## Environment
alpine:3.19.1
semantic-release, version 9.7.1

```output
python --version
pip --version
semantic-release --version
pip freeze
Python 3.11.9
pip 23.3.1 from /usr/lib/python3.11/site-packages/pip (python 3.11)
semantic-release, version 9.7.1
annotated-types==0.6.0
awscli==2.13.25
awscrt==0.19.2
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
click-option-group==0.5.6
colorama==0.4.6
cryptography==41.0.7
distro==1.8.0
docutils==0.20.1
dotty-dict==1.3.1
gitdb==4.0.11
GitPython==3.1.43
idna==3.7
importlib_resources==6.4.0
Jinja2==3.1.4
jmespath==1.0.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
packaging==23.2
prompt-toolkit==3.0.41
pycparser==2.21
pydantic==2.7.1
pydantic_core==2.18.2
Pygments==2.18.0
pyparsing==3.1.1
python-dateutil==2.8.2
python-gitlab==4.4.0
python-semantic-release==9.7.1
requests==2.31.0
requests-toolbelt==1.0.0
rich==13.7.1
ruamel.yaml==0.17.28
ruamel.yaml.clib==0.2.7
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
tomlkit==0.12.5
typing_extensions==4.11.0
urllib3==1.26.18
wcwidth==0.2.10
```


Please also indicate which Python build tool(s) you are using (e.g. `pip`, `build`,
`poetry`, etc.), including the version number too.

## Configuration

Please add your `semantic-release` configuration, and if applicable also provide
your `build-system` configuration from `pyproject.toml`.

## Logs

Please provide debug logs for the command you are using with the `-vv` flag, e.g.

```shell
semantic-release -vv version
```

```output
[19:04:28] DEBUG    [semantic_release.cli.commands.main] DEBUG main.main: logging level set to: DEBUG                                                                                                                               main.py:93
           DEBUG    [semantic_release.cli.commands.main] DEBUG main.main: global cli options: GlobalCommandLineOptions(noop=False, verbosity=2, config_file='pyproject.toml', strict=False)                                        main.py:105
           INFO     [semantic_release.cli.util] INFO util.load_raw_config_file: Loading configuration from pyproject.toml                                                                                                           util.py:79
           DEBUG    [semantic_release.cli.util] DEBUG util.load_raw_config_file: Trying to parse configuration pyproject.toml in TOML format                                                                                        util.py:82
           DEBUG    [git.util] DEBUG util._is_cygwin_git: Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'No such file or directory')                                                                           util.py:472
           INFO     [semantic_release.cli.config] INFO config.select_branch_options: Using group 'main' options, as '(main|master)' matches 'main'                                                                               config.py:374
           DEBUG    [semantic_release.changelog.template] DEBUG template.environment: {'template_dir': 'templates', 'block_start_string': '{%', 'block_end_string': '%}', 'variable_start_string': '{{', 'variable_end_string': template.py:57
                    '}}', 'comment_start_string': '{#', 'comment_end_string': '#}', 'line_statement_prefix': None, 'line_comment_prefix': None, 'trim_blocks': False, 'lstrip_blocks': False, 'newline_sequence': '\n',
                    'keep_trailing_newline': False, 'extensions': (), 'autoescape': True, 'autoescape_value': True}
           DEBUG    [semantic_release.version.translator] DEBUG translator._invert_tag_format_to_re: inverted tag_format 'v{version}' to 'v(?P<version>.*)'                                                                   translator.py:40
           DEBUG    [semantic_release.cli.masking_filter] DEBUG masking_filter.add_mask_for: Adding redact pattern 'context.hvcs_client.token' to _redact_patterns                                                        masking_filter.py:30
           DEBUG    [semantic_release.cli.masking_filter] DEBUG masking_filter.add_mask_for: Adding redact pattern 'context.hvcs_client.token' to _redact_patterns                                                        masking_filter.py:30
           DEBUG    [semantic_release.cli.commands.version] DEBUG version.is_forced_prerelease: is_forced_prerelease: as_prerelease = False, forced_level_bump = None, prerelease = False                                        version.py:55
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: Found 2 full releases (excluding prereleases)                                                                                           algorithm.py:282
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The last full release was 1.0.0, tagged as <git.TagReference "refs/tags/v1.0.0">                                                        algorithm.py:324
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'merge-base', 'v1.0.0', 'main'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)                                            cmd.py:1253
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'cat-file', '--batch-check'], cwd=/builds/contiant/projects/titan, stdin=<valid stream>, shell=False, universal_newlines=False)                                     cmd.py:1253
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'cat-file', '--batch'], cwd=/builds/contiant/projects/titan, stdin=<valid stream>, shell=False, universal_newlines=False)                                           cmd.py:1253
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.bfs: checking if commit 4233e68e688121cd957e64f7befa9395e81676dc matches any tags                                                                    algorithm.py:101
           INFO     [semantic_release.version.algorithm] INFO algorithm.bfs: found latest version in branch history: '1.0.0' (4233e68)                                                                                        algorithm.py:105
           INFO     [semantic_release.version.algorithm] INFO algorithm._bfs_for_latest_version_in_history: the latest version in this branch's history is 1.0.0                                                              algorithm.py:129
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The last full version in this branch's history was 1.0.0                                                                                algorithm.py:358
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'rev-list', 'v1.0.0...', '--'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)                                             cmd.py:1253
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 588c66d058b2f0b852f0fa4fa212c33d2714b957                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 0c081c97005afca88ced1b20c584cb9f79e4edd8                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit c81056bc0c9379b2343dcdbbf907f14f553ded92 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit c81056bc0c9379b2343dcdbbf907f14f553ded92 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit c81056bc0c9379b2343dcdbbf907f14f553ded92                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 6bff75018917ec770d3c746e99c600e34fce4634 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 6bff75018917ec770d3c746e99c600e34fce4634 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 6bff75018917ec770d3c746e99c600e34fce4634                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 2c00dd2731907c839daa58da988c55e3aa8a3d79                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0e0841d1ce383e07081381b48c572a1217984989 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 0e0841d1ce383e07081381b48c572a1217984989 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 0e0841d1ce383e07081381b48c572a1217984989                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit ba10465062135ca13f8a4ec38c49b69e0315177a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit ba10465062135ca13f8a4ec38c49b69e0315177a matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit ba10465062135ca13f8a4ec38c49b69e0315177a                                                                  algorithm.py:413
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: parsed the following distinct levels from the commits since the last release: {<LevelBump.PATCH: 2>}                                   algorithm.py:427
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The type of the next release release is: patch                                                                                          algorithm.py:433
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm._increment_version: _increment_version: latest_version = 1.0.0, latest_full_version = 1.0.0, latest_full_version_in_history = 1.0.0, level_bump =    algorithm.py:161
                    patch, prerelease = False, prerelease_token = rc, major_on_zero = True, allow_zero_version = True
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm._increment_version: prerelease=false and 1.0.0 is not a prerelease; bumping with a patch release                                                     algorithm.py:257
           DEBUG    [semantic_release.version.version] DEBUG version.bump: performing a patch level bump                                                                                                                        version.py:221
1.0.1
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
The next version is: 1.0.1! 🚀
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'rev-list', 'afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122', '--'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)              cmd.py:1253
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit c81056bc0c9379b2343dcdbbf907f14f553ded92 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit c81056bc0c9379b2343dcdbbf907f14f553ded92 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 6bff75018917ec770d3c746e99c600e34fce4634 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 6bff75018917ec770d3c746e99c600e34fce4634 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0e0841d1ce383e07081381b48c572a1217984989 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 0e0841d1ce383e07081381b48c572a1217984989 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit ba10465062135ca13f8a4ec38c49b69e0315177a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit ba10465062135ca13f8a4ec38c49b69e0315177a to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: 1.0.0                                                                                            angular.py:26

                    Automatically generated by release-ci

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: found commit 4233e68e688121cd957e64f7befa9395e81676dc for tag v1.0.0                                            release_history.py:71
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: Skipping excluded commit 4233e68e688121cd957e64f7befa9395e81676dc (1.0.0  Automatically)                       release_history.py:108
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: 0.0.1                                                                                            angular.py:26

                    Automatically generated by release-ci

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: found commit 0f9b2d71fd664f0f526b8f8cb217718384708b3d for tag v0.0.1                                            release_history.py:71
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: Skipping excluded commit 0f9b2d71fd664f0f526b8f8cb217718384708b3d (0.0.1  Automatically)                       release_history.py:108
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit a5d2af555e1254c187fde48737a7ee6753ac2f8b introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit a5d2af555e1254c187fde48737a7ee6753ac2f8b with type feature to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit da7dcac62ce373e75898ae658fb3043a5b4ac12e introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit da7dcac62ce373e75898ae658fb3043a5b4ac12e with type feature to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: ADM-26-When-admin-unverifies-Merchant-in-BO-merchant-is-no-longer-able-to-use-Contiant-Services  angular.py:26

                    Adds:

                      - create and delete user pool clients depending on merchant update request - verify and unverify respectively

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 2e61cd3d9ade4cc445a0d3dda831780934497b63 with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: Trigger deploy                                                                                   angular.py:26

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit d7310c19a54d9d985015ffb1bf10cb00ca181495 with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: Trigger build                                                                                    angular.py:26

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 8e165295eff13fd213b1b226841492c56adee01e with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: ADM-9-Incorrect-created-date-shown-on-merchants-tab                                              angular.py:26

                    Updates:

                      - API call to get the merchats will return the create at from the custom attribute, not the userCreatedDate since the last is broken

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 1435715a3c37c8065aa6b6850697041900eed24d with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.hvcs.gitlab] DEBUG gitlab._get_repository_owner_and_name: getting repository owner and name from environment variables                                                                      gitlab.py:76
           INFO     [semantic_release.cli.commands.version] INFO version.version: Path '/builds/contiant/projects/titan/templates' not found, using default changelog template                                                  version.py:474
           DEBUG    [semantic_release.cli.commands.version] DEBUG version.apply_version_to_source_files: writing version 1.0.1 to source paths []                                                                               version.py:130
           INFO     [semantic_release.cli.commands.version] INFO version.version: Running build command buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .                                                                       version.py:508
🛠 Running build command: buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .
Error: tag :: invalid reference format
           INFO     [semantic_release.cli.github_actions_output] INFO github_actions_output.write_if_possible: not writing GitHub Actions output, as no file specified                                             github_actions_output.py:71
Usage: semantic-release version [OPTIONS]
Try 'semantic-release version -h' for help.

Error: Command '['bash', '-c', 'buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .']' returned non-zero exit status 125.
```

If using GitHub actions, ensure the `root_options` contains the `-vv` flag
for verbosity, and attach your workflow definition.

## Additional context

_Add any other information that could be useful, such as a link to your project
(if public), links to a failing GitHub Action, or an example commit._

build_command environment variables not working after upgrade from 9.6.0 to 9.7.0
## The problem

I am using environment variables in the build command and this use to work.

```bash
build_command = "buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} ."
semantic-release version --patch
```

I found that semantic-release is not able to access environment variables at all.
I tried with simple echo and I got empty strings.

```code
build_command = "echo $APPLICATION_NAME:$CI_JOB_ID"
```

```
Error: tag :: invalid reference format
Usage: semantic-release version [OPTIONS]
Try 'semantic-release version -h' for help.

Error: Command '['bash', '-c', 'buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .']' returned non-zero exit status 125.
```

## Expected behavior

Execute the build and respect my environment variables

## Environment
alpine:3.19.1
semantic-release, version 9.7.1

```output
python --version
pip --version
semantic-release --version
pip freeze
Python 3.11.9
pip 23.3.1 from /usr/lib/python3.11/site-packages/pip (python 3.11)
semantic-release, version 9.7.1
annotated-types==0.6.0
awscli==2.13.25
awscrt==0.19.2
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
click-option-group==0.5.6
colorama==0.4.6
cryptography==41.0.7
distro==1.8.0
docutils==0.20.1
dotty-dict==1.3.1
gitdb==4.0.11
GitPython==3.1.43
idna==3.7
importlib_resources==6.4.0
Jinja2==3.1.4
jmespath==1.0.1
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
packaging==23.2
prompt-toolkit==3.0.41
pycparser==2.21
pydantic==2.7.1
pydantic_core==2.18.2
Pygments==2.18.0
pyparsing==3.1.1
python-dateutil==2.8.2
python-gitlab==4.4.0
python-semantic-release==9.7.1
requests==2.31.0
requests-toolbelt==1.0.0
rich==13.7.1
ruamel.yaml==0.17.28
ruamel.yaml.clib==0.2.7
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
tomlkit==0.12.5
typing_extensions==4.11.0
urllib3==1.26.18
wcwidth==0.2.10
```


Please also indicate which Python build tool(s) you are using (e.g. `pip`, `build`,
`poetry`, etc.), including the version number too.

## Configuration

Please add your `semantic-release` configuration, and if applicable also provide
your `build-system` configuration from `pyproject.toml`.

## Logs

Please provide debug logs for the command you are using with the `-vv` flag, e.g.

```shell
semantic-release -vv version
```

```output
[19:04:28] DEBUG    [semantic_release.cli.commands.main] DEBUG main.main: logging level set to: DEBUG                                                                                                                               main.py:93
           DEBUG    [semantic_release.cli.commands.main] DEBUG main.main: global cli options: GlobalCommandLineOptions(noop=False, verbosity=2, config_file='pyproject.toml', strict=False)                                        main.py:105
           INFO     [semantic_release.cli.util] INFO util.load_raw_config_file: Loading configuration from pyproject.toml                                                                                                           util.py:79
           DEBUG    [semantic_release.cli.util] DEBUG util.load_raw_config_file: Trying to parse configuration pyproject.toml in TOML format                                                                                        util.py:82
           DEBUG    [git.util] DEBUG util._is_cygwin_git: Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'No such file or directory')                                                                           util.py:472
           INFO     [semantic_release.cli.config] INFO config.select_branch_options: Using group 'main' options, as '(main|master)' matches 'main'                                                                               config.py:374
           DEBUG    [semantic_release.changelog.template] DEBUG template.environment: {'template_dir': 'templates', 'block_start_string': '{%', 'block_end_string': '%}', 'variable_start_string': '{{', 'variable_end_string': template.py:57
                    '}}', 'comment_start_string': '{#', 'comment_end_string': '#}', 'line_statement_prefix': None, 'line_comment_prefix': None, 'trim_blocks': False, 'lstrip_blocks': False, 'newline_sequence': '\n',
                    'keep_trailing_newline': False, 'extensions': (), 'autoescape': True, 'autoescape_value': True}
           DEBUG    [semantic_release.version.translator] DEBUG translator._invert_tag_format_to_re: inverted tag_format 'v{version}' to 'v(?P<version>.*)'                                                                   translator.py:40
           DEBUG    [semantic_release.cli.masking_filter] DEBUG masking_filter.add_mask_for: Adding redact pattern 'context.hvcs_client.token' to _redact_patterns                                                        masking_filter.py:30
           DEBUG    [semantic_release.cli.masking_filter] DEBUG masking_filter.add_mask_for: Adding redact pattern 'context.hvcs_client.token' to _redact_patterns                                                        masking_filter.py:30
           DEBUG    [semantic_release.cli.commands.version] DEBUG version.is_forced_prerelease: is_forced_prerelease: as_prerelease = False, forced_level_bump = None, prerelease = False                                        version.py:55
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: Found 2 full releases (excluding prereleases)                                                                                           algorithm.py:282
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The last full release was 1.0.0, tagged as <git.TagReference "refs/tags/v1.0.0">                                                        algorithm.py:324
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'merge-base', 'v1.0.0', 'main'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)                                            cmd.py:1253
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'cat-file', '--batch-check'], cwd=/builds/contiant/projects/titan, stdin=<valid stream>, shell=False, universal_newlines=False)                                     cmd.py:1253
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'cat-file', '--batch'], cwd=/builds/contiant/projects/titan, stdin=<valid stream>, shell=False, universal_newlines=False)                                           cmd.py:1253
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.bfs: checking if commit 4233e68e688121cd957e64f7befa9395e81676dc matches any tags                                                                    algorithm.py:101
           INFO     [semantic_release.version.algorithm] INFO algorithm.bfs: found latest version in branch history: '1.0.0' (4233e68)                                                                                        algorithm.py:105
           INFO     [semantic_release.version.algorithm] INFO algorithm._bfs_for_latest_version_in_history: the latest version in this branch's history is 1.0.0                                                              algorithm.py:129
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The last full version in this branch's history was 1.0.0                                                                                algorithm.py:358
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'rev-list', 'v1.0.0...', '--'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)                                             cmd.py:1253
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 588c66d058b2f0b852f0fa4fa212c33d2714b957                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 0c081c97005afca88ced1b20c584cb9f79e4edd8                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit c81056bc0c9379b2343dcdbbf907f14f553ded92 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit c81056bc0c9379b2343dcdbbf907f14f553ded92 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit c81056bc0c9379b2343dcdbbf907f14f553ded92                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 6bff75018917ec770d3c746e99c600e34fce4634 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 6bff75018917ec770d3c746e99c600e34fce4634 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 6bff75018917ec770d3c746e99c600e34fce4634                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 2c00dd2731907c839daa58da988c55e3aa8a3d79                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0e0841d1ce383e07081381b48c572a1217984989 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit 0e0841d1ce383e07081381b48c572a1217984989 matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit 0e0841d1ce383e07081381b48c572a1217984989                                                                  algorithm.py:413
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit ba10465062135ca13f8a4ec38c49b69e0315177a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: adding patch to the levels identified in commits_since_last_full_release                                                               algorithm.py:401
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: checking if commit ba10465062135ca13f8a4ec38c49b69e0315177a matches any tags                                                           algorithm.py:407
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: no tags correspond to commit ba10465062135ca13f8a4ec38c49b69e0315177a                                                                  algorithm.py:413
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm.next_version: parsed the following distinct levels from the commits since the last release: {<LevelBump.PATCH: 2>}                                   algorithm.py:427
           INFO     [semantic_release.version.algorithm] INFO algorithm.next_version: The type of the next release release is: patch                                                                                          algorithm.py:433
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm._increment_version: _increment_version: latest_version = 1.0.0, latest_full_version = 1.0.0, latest_full_version_in_history = 1.0.0, level_bump =    algorithm.py:161
                    patch, prerelease = False, prerelease_token = rc, major_on_zero = True, allow_zero_version = True
           DEBUG    [semantic_release.version.algorithm] DEBUG algorithm._increment_version: prerelease=false and 1.0.0 is not a prerelease; bumping with a patch release                                                     algorithm.py:257
           DEBUG    [semantic_release.version.version] DEBUG version.bump: performing a patch level bump                                                                                                                        version.py:221
1.0.1
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
The next version is: 1.0.1! 🚀
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '0.0.1' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 0.0.1 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 0.0.1                                                                                                  version.py:146
           DEBUG    [semantic_release.version.version] DEBUG version.parse: attempting to parse string '1.0.0' as Version                                                                                                       version.py:119
           DEBUG    [semantic_release.version.version] DEBUG version.parse: version string 1.0.0 parsed as a non-prerelease                                                                                                     version.py:143
           DEBUG    [semantic_release.version.version] DEBUG version.parse: parsed build metadata '' from version string 1.0.0                                                                                                  version.py:146
           INFO     [semantic_release.version.algorithm] INFO algorithm.tags_and_versions: found 2 previous tags                                                                                                               algorithm.py:58
           DEBUG    [git.cmd] DEBUG cmd.execute: Popen(['git', 'rev-list', 'afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122', '--'], cwd=/builds/contiant/projects/titan, stdin=None, shell=False, universal_newlines=False)              cmd.py:1253
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit afd18fd7a34b4ed24c6181fa2ea3f1b2ce6d6122 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 588c66d058b2f0b852f0fa4fa212c33d2714b957 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 7abc37cf2d7b237280c152cc8e3f46a73bd05d1d to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 9ee25c3cb3df1585fea5af3d411a84d46b18378a to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 0c081c97005afca88ced1b20c584cb9f79e4edd8 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit c81056bc0c9379b2343dcdbbf907f14f553ded92 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit c81056bc0c9379b2343dcdbbf907f14f553ded92 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 97eeb605d673c84d4fb31c0b6e9a9b8cf8ce25ab to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 6bff75018917ec770d3c746e99c600e34fce4634 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 6bff75018917ec770d3c746e99c600e34fce4634 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 2c00dd2731907c839daa58da988c55e3aa8a3d79 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit dfbe8f7d8fd258cb9c9d57c7f1991765c8ff0143 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit 0e0841d1ce383e07081381b48c572a1217984989 introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 0e0841d1ce383e07081381b48c572a1217984989 to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit ba10465062135ca13f8a4ec38c49b69e0315177a introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit ba10465062135ca13f8a4ec38c49b69e0315177a to unreleased commits                                   release_history.py:116
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: 1.0.0                                                                                            angular.py:26

                    Automatically generated by release-ci

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: found commit 4233e68e688121cd957e64f7befa9395e81676dc for tag v1.0.0                                            release_history.py:71
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: Skipping excluded commit 4233e68e688121cd957e64f7befa9395e81676dc (1.0.0  Automatically)                       release_history.py:108
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: 0.0.1                                                                                            angular.py:26

                    Automatically generated by release-ci

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: found commit 0f9b2d71fd664f0f526b8f8cb217718384708b3d for tag v0.0.1                                            release_history.py:71
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: Skipping excluded commit 0f9b2d71fd664f0f526b8f8cb217718384708b3d (0.0.1  Automatically)                       release_history.py:108
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit a5d2af555e1254c187fde48737a7ee6753ac2f8b introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit a5d2af555e1254c187fde48737a7ee6753ac2f8b with type feature to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular.parse: commit da7dcac62ce373e75898ae658fb3043a5b4ac12e introduces a patch level_bump                                                                 angular.py:131
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type feature                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit da7dcac62ce373e75898ae658fb3043a5b4ac12e with type feature to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: ADM-26-When-admin-unverifies-Merchant-in-BO-merchant-is-no-longer-able-to-use-Contiant-Services  angular.py:26

                    Adds:

                      - create and delete user pool clients depending on merchant update request - verify and unverify respectively

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 2e61cd3d9ade4cc445a0d3dda831780934497b63 with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: Trigger deploy                                                                                   angular.py:26

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit d7310c19a54d9d985015ffb1bf10cb00ca181495 with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: Trigger build                                                                                    angular.py:26

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 8e165295eff13fd213b1b226841492c56adee01e with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.commit_parser.angular] DEBUG angular._logged_parse_error: Unable to parse commit message: ADM-9-Incorrect-created-date-shown-on-merchants-tab                                              angular.py:26

                    Updates:

                      - API call to get the merchats will return the create at from the custom attribute, not the userCreatedDate since the last is broken

           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: commit has type unknown                                                                                         release_history.py:65
           DEBUG    [semantic_release.changelog.release_history] DEBUG release_history.from_git_history: adding commit 1435715a3c37c8065aa6b6850697041900eed24d with type unknown to release section for 0.0.1          release_history.py:123
           DEBUG    [semantic_release.hvcs.gitlab] DEBUG gitlab._get_repository_owner_and_name: getting repository owner and name from environment variables                                                                      gitlab.py:76
           INFO     [semantic_release.cli.commands.version] INFO version.version: Path '/builds/contiant/projects/titan/templates' not found, using default changelog template                                                  version.py:474
           DEBUG    [semantic_release.cli.commands.version] DEBUG version.apply_version_to_source_files: writing version 1.0.1 to source paths []                                                                               version.py:130
           INFO     [semantic_release.cli.commands.version] INFO version.version: Running build command buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .                                                                       version.py:508
🛠 Running build command: buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .
Error: tag :: invalid reference format
           INFO     [semantic_release.cli.github_actions_output] INFO github_actions_output.write_if_possible: not writing GitHub Actions output, as no file specified                                             github_actions_output.py:71
Usage: semantic-release version [OPTIONS]
Try 'semantic-release version -h' for help.

Error: Command '['bash', '-c', 'buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} .']' returned non-zero exit status 125.
```

If using GitHub actions, ensure the `root_options` contains the `-vv` flag
for verbosity, and attach your workflow definition.

## Additional context

_Add any other information that could be useful, such as a link to your project
(if public), links to a failing GitHub Action, or an example commit._



Discussion / hints:
@tkcontiant, thank you for the bug report. The change in [`v9.7.0`](https://github.com/python-semantic-release/python-semantic-release/releases/tag/v9.7.0) adjusted the environment that is passed to the build command subprocess.  Due to your report, I now know that when the subprocess parameter `env` was set to None (implicitly) that defaulted to pass all environment variables to the build process. I did not expect that as I moved to explicitly define the environment so I could insert some dynamic variables. Will need to reconsider the implementation.  I apologize for the inconvenience.
Hello, notying bad has happend I actually whanted to upgrade to 9.7.1 and
the variables are really cool.. NEXT_VERSION var is really needed.. and
awsome feature..

In my workflow I amd building docker images, so some lever of accessing nev
vars is required for docker in docker to work and application_name..

If you say I can activate env = true this will solve the entire problem.
I would search today maybe there si a parameter wich I missed.

Just to let you onow the navrs are working great.. Accrdoing to the release
9.7.x

Maybe simple map with wich vars to pass additionally from env would be
another idea? So you can keep the new vars and if someone like me needs
also to access os env would be fine and easy to transition.

On Fri, May 10, 2024, 3:35 AM codejedi365 ***@***.***> wrote:

> @tkcontiant <https://github.com/tkcontiant>, thank you for the bug
> report. The change in v9.7.0
> <https://github.com/python-semantic-release/python-semantic-release/releases/tag/v9.7.0>
> adjusted the environment that is passed to the build command subprocess.
> Due to your report, I now know that when the subprocess parameter env was
> set to None (implicitly) that defaulted to pass all environment variables
> to the build process. I did not expect that as I moved to explicitly define
> the environment so I could insert some dynamic variables. Will need to
> reconsider the implementation. I apologize for the inconvenience.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/python-semantic-release/python-semantic-release/issues/922#issuecomment-2103753156>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BFUIJ3ORGBBWB4JWMILMNNDZBQW7ZAVCNFSM6AAAAABHPKW2FWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTG42TGMJVGY>
> .
> You are receiving this because you were mentioned.Message ID:
> <python-semantic-release/python-semantic-release/issues/922/2103753156@
> github.com>
>

Thank you for the feedback! Yes, I'm leaning towards a configuration option like `build_command_env` which is a list of strings. They either need to be in the format `NAME=value` to hardcode values to be passed or just `NAME` to copy the var from the parent process env.

The reason I am steering away from just a blind copy of all env variables of the parent process is because PSR is being entrusted with users authentication tokens and I would not want to pass those on to sublibraries that should not have them.

If there are other variables that PSR should inject into the environment from internal processing please let me know 
True, I guess simple list with envs to propagte would be great addition..

On Fri, May 10, 2024, 1:11 PM codejedi365 ***@***.***> wrote:

> Thank you for the feedback! Yes, I'm leaning towards a configuration
> option like build_command_env which is a list of strings. They either
> need to be in the format NAME=value to hardcode values to be passed or
> just NAME to copy the var from the parent process env.
>
> The reason I am steering away from just a blind copy of all env variables
> of the parent process is because PSR is being entrusted with users
> authentication tokens and I would not want to pass those on to sublibraries
> that should not have them.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/python-semantic-release/python-semantic-release/issues/922#issuecomment-2104500328>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BFUIJ3KUTTAMOYIPITXBXM3ZBS2QBAVCNFSM6AAAAABHPKW2FWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUGUYDAMZSHA>
> .
> You are receiving this because you were mentioned.Message ID:
> <python-semantic-release/python-semantic-release/issues/922/2104500328@
> github.com>
>

Also, keep in mind that CI or local build environments should be considered safe.
If I run simply docker build I have access already to the whole environment, if I do mvn clean install same..

Normally people are having way worse stuff hardcoded in their build environments not just auth tokens and stuff.
But if auth token is required for mvn deploy to upload your jar file or whatever then we have an issue..

In my case I am building everything in K8s so, I consider the build environment as ephemeral... temp.
But this is not true if I have build-cache enabled.. Most of CI systems have some idea to mask and protect sensitive env vars, but nothing can stop you from accessing however if you have access to your build place OS level.. I can extract all protected secrets from /proc anyway.

@tkcontiant, thank you for the bug report. The change in [`v9.7.0`](https://github.com/python-semantic-release/python-semantic-release/releases/tag/v9.7.0) adjusted the environment that is passed to the build command subprocess.  Due to your report, I now know that when the subprocess parameter `env` was set to None (implicitly) that defaulted to pass all environment variables to the build process. I did not expect that as I moved to explicitly define the environment so I could insert some dynamic variables. Will need to reconsider the implementation.  I apologize for the inconvenience.
Hello, notying bad has happend I actually whanted to upgrade to 9.7.1 and
the variables are really cool.. NEXT_VERSION var is really needed.. and
awsome feature..

In my workflow I amd building docker images, so some lever of accessing nev
vars is required for docker in docker to work and application_name..

If you say I can activate env = true this will solve the entire problem.
I would search today maybe there si a parameter wich I missed.

Just to let you onow the navrs are working great.. Accrdoing to the release
9.7.x

Maybe simple map with wich vars to pass additionally from env would be
another idea? So you can keep the new vars and if someone like me needs
also to access os env would be fine and easy to transition.

On Fri, May 10, 2024, 3:35 AM codejedi365 ***@***.***> wrote:

> @tkcontiant <https://github.com/tkcontiant>, thank you for the bug
> report. The change in v9.7.0
> <https://github.com/python-semantic-release/python-semantic-release/releases/tag/v9.7.0>
> adjusted the environment that is passed to the build command subprocess.
> Due to your report, I now know that when the subprocess parameter env was
> set to None (implicitly) that defaulted to pass all environment variables
> to the build process. I did not expect that as I moved to explicitly define
> the environment so I could insert some dynamic variables. Will need to
> reconsider the implementation. I apologize for the inconvenience.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/python-semantic-release/python-semantic-release/issues/922#issuecomment-2103753156>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BFUIJ3ORGBBWB4JWMILMNNDZBQW7ZAVCNFSM6AAAAABHPKW2FWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTG42TGMJVGY>
> .
> You are receiving this because you were mentioned.Message ID:
> <python-semantic-release/python-semantic-release/issues/922/2103753156@
> github.com>
>

Thank you for the feedback! Yes, I'm leaning towards a configuration option like `build_command_env` which is a list of strings. They either need to be in the format `NAME=value` to hardcode values to be passed or just `NAME` to copy the var from the parent process env.

The reason I am steering away from just a blind copy of all env variables of the parent process is because PSR is being entrusted with users authentication tokens and I would not want to pass those on to sublibraries that should not have them.

If there are other variables that PSR should inject into the environment from internal processing please let me know 
True, I guess simple list with envs to propagte would be great addition..

On Fri, May 10, 2024, 1:11 PM codejedi365 ***@***.***> wrote:

> Thank you for the feedback! Yes, I'm leaning towards a configuration
> option like build_command_env which is a list of strings. They either
> need to be in the format NAME=value to hardcode values to be passed or
> just NAME to copy the var from the parent process env.
>
> The reason I am steering away from just a blind copy of all env variables
> of the parent process is because PSR is being entrusted with users
> authentication tokens and I would not want to pass those on to sublibraries
> that should not have them.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/python-semantic-release/python-semantic-release/issues/922#issuecomment-2104500328>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BFUIJ3KUTTAMOYIPITXBXM3ZBS2QBAVCNFSM6AAAAABHPKW2FWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBUGUYDAMZSHA>
> .
> You are receiving this because you were mentioned.Message ID:
> <python-semantic-release/python-semantic-release/issues/922/2104500328@
> github.com>
>

Also, keep in mind that CI or local build environments should be considered safe.
If I run simply docker build I have access already to the whole environment, if I do mvn clean install same..

Normally people are having way worse stuff hardcoded in their build environments not just auth tokens and stuff.
But if auth token is required for mvn deploy to upload your jar file or whatever then we have an issue..

In my case I am building everything in K8s so, I consider the build environment as ephemeral... temp.
But this is not true if I have build-cache enabled.. Most of CI systems have some idea to mask and protect sensitive env vars, but nothing can stop you from accessing however if you have access to your build place OS level.. I can extract all protected secrets from /proc anyway.


Fix patch:
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 631a0174d..7abd0028a 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -139,7 +139,7 @@ This setting is discussed in more detail at :ref:`multibranch-releases`
 
 ----
 
-.. _config-build-command:
+.. _config-build_command:
 
 ``build_command``
 """""""""""""""""
@@ -155,6 +155,9 @@ version. The following table summarizes all the environment variables that
 are passed on to the ``build_command`` runtime if they exist in the parent
 process.
 
+If you would like to pass additional environment variables to your build
+command, see :ref:`config-build_command_env`.
+
 ========================  ======================================================================
 Variable Name             Description
 ========================  ======================================================================
@@ -174,6 +177,37 @@ VIRTUAL_ENV               Pass-through ``VIRTUAL_ENV`` if exists in process env,
 
 ----
 
+.. _config-build_command_env:
+
+``build_command_env``
+"""""""""""""""""""""
+
+**Type:** ``Optional[list[str]]``
+
+List of environment variables to include or pass-through on to the build command that executes
+during :ref:`cmd-version`.
+
+This configuration option allows the user to extend the list of environment variables
+from the table above in :ref:`config-build_command`. The input is a list of strings
+where each individual string handles a single variable definition. There are two formats
+accepted and are detailed in the following table:
+
+==================  ===================================================================
+FORMAT              Description
+==================  ===================================================================
+``VAR_NAME``        Detects value from the PSR process environment, and passes value to
+                    ``build_command`` process
+
+``VAR_NAME=value``  Sets variable name to value inside of ``build_command`` process
+==================  ===================================================================
+
+.. note:: Although variable name capitalization is not required, it is recommended as
+          to be in-line with the POSIX-compliant recommendation for shell variable names.
+
+**Default:** ``None`` (not specified)
+
+----
+
 .. _config-commit_author:
 
 ``commit_author (str)``
diff --git a/semantic_release/cli/commands/version.py b/semantic_release/cli/commands/version.py
index 9d9123611..9608f17b4 100644
--- a/semantic_release/cli/commands/version.py
+++ b/semantic_release/cli/commands/version.py
@@ -517,7 +517,7 @@ def version(  # noqa: C901
                     filter(
                         lambda k_v: k_v[1] is not None,  # type: ignore
                         {
-                            "NEW_VERSION": str(new_version),
+                            # Common values
                             "PATH": os.getenv("PATH", ""),
                             "HOME": os.getenv("HOME", None),
                             "VIRTUAL_ENV": os.getenv("VIRTUAL_ENV", None),
@@ -535,6 +535,10 @@ def version(  # noqa: C901
                             "PSR_DOCKER_GITHUB_ACTION": os.getenv(
                                 "PSR_DOCKER_GITHUB_ACTION", None
                             ),
+                            # User defined overrides of environment (from config)
+                            **runtime.build_command_env,
+                            # PSR injected environment variables
+                            "NEW_VERSION": str(new_version),
                         }.items(),
                     )
                 ),
diff --git a/semantic_release/cli/config.py b/semantic_release/cli/config.py
index 9bd2fd8bf..9262bd4a2 100644
--- a/semantic_release/cli/config.py
+++ b/semantic_release/cli/config.py
@@ -212,6 +212,7 @@ class RawConfig(BaseModel):
     assets: List[str] = []
     branches: Dict[str, BranchConfig] = {"main": BranchConfig()}
     build_command: Optional[str] = None
+    build_command_env: List[str] = []
     changelog: ChangelogConfig = ChangelogConfig()
     commit_author: MaybeFromEnv = EnvConfigVar(
         env="GIT_COMMIT_AUTHOR", default=DEFAULT_COMMIT_AUTHOR
@@ -229,6 +230,11 @@ class RawConfig(BaseModel):
     version_toml: Optional[Tuple[str, ...]] = None
     version_variables: Optional[Tuple[str, ...]] = None
 
+    @field_validator("build_command_env", mode="after")
+    @classmethod
+    def remove_whitespace(cls, val: list[str]) -> list[str]:
+        return [entry.strip() for entry in val]
+
     @model_validator(mode="after")
     def set_default_opts(self) -> Self:
         # Set the default parser options for the given commit parser when no user input is given
@@ -352,6 +358,7 @@ class RuntimeContext:
     template_environment: Environment
     template_dir: Path
     build_command: Optional[str]
+    build_command_env: dict[str, str]
     dist_glob_patterns: Tuple[str, ...]
     upload_to_vcs_release: bool
     global_cli_options: GlobalCommandLineOptions
@@ -541,6 +548,31 @@ def from_raw_config(
             tag_format=raw.tag_format, prerelease_token=branch_config.prerelease_token
         )
 
+        build_cmd_env = {}
+
+        for i, env_var_def in enumerate(raw.build_command_env):
+            # creative hack to handle, missing =, but also = that then can be unpacked
+            # as the resulting parts array can be either 2 or 3 in length. it becomes 3
+            # with our forced empty value at the end which can be dropped
+            parts = [*env_var_def.split("=", 1), ""]
+            # removes any odd spacing around =, and extracts name=value
+            name, env_val = [part.strip() for part in parts[:2]]
+
+            if not name:
+                # Skip when invalid format (ex. starting with = and no name)
+                logging.warning(
+                    "Skipping invalid build_command_env[%s] definition",
+                    i,
+                )
+                continue
+
+            if not env_val and env_var_def[-1] != "=":
+                # avoid the edge case that user wants to define a value as empty
+                # and don't autoresolve it
+                env_val = os.getenv(name, "")
+
+            build_cmd_env[name] = env_val
+
         self = cls(
             repo=repo,
             commit_parser=commit_parser,
@@ -548,6 +580,7 @@ def from_raw_config(
             major_on_zero=raw.major_on_zero,
             allow_zero_version=raw.allow_zero_version,
             build_command=raw.build_command,
+            build_command_env=build_cmd_env,
             version_declarations=tuple(version_declarations),
             hvcs_client=hvcs_client,
             changelog_file=changelog_file,


Test patch:
diff --git a/tests/command_line/test_version.py b/tests/command_line/test_version.py
index c99b99890..26e605461 100644
--- a/tests/command_line/test_version.py
+++ b/tests/command_line/test_version.py
@@ -551,7 +551,6 @@ def test_version_prints_current_version_if_no_new_version(
 def test_version_runs_build_command(
     repo_with_git_flow_angular_commits: Repo,
     cli_runner: CliRunner,
-    example_pyproject_toml: Path,
     update_pyproject_toml: UpdatePyprojectTomlFn,
     shell: str,
 ):
@@ -604,6 +603,84 @@ def test_version_runs_build_command(
         )
 
 
+def test_version_runs_build_command_w_user_env(
+    repo_with_git_flow_angular_commits: Repo,
+    cli_runner: CliRunner,
+    update_pyproject_toml: UpdatePyprojectTomlFn,
+):
+    # Setup
+    patched_os_environment = {
+        "CI": "true",
+        "PATH": os.getenv("PATH"),
+        "HOME": os.getenv("HOME"),
+        "VIRTUAL_ENV": os.getenv("VIRTUAL_ENV", "./.venv"),
+        # Simulate that all CI's are set
+        "GITHUB_ACTIONS": "true",
+        "GITLAB_CI": "true",
+        "GITEA_ACTIONS": "true",
+        "BITBUCKET_REPO_FULL_NAME": "python-semantic-release/python-semantic-release.git",
+        "PSR_DOCKER_GITHUB_ACTION": "true",
+        # User environment variables (varying passthrough results)
+        "MY_CUSTOM_VARIABLE": "custom",
+        "IGNORED_VARIABLE": "ignore_me",
+        "OVERWRITTEN_VAR": "initial",
+        "SET_AS_EMPTY_VAR": "not_empty",
+    }
+    build_command = "bash -c \"echo 'hello world'\""
+    update_pyproject_toml("tool.semantic_release.build_command", build_command)
+    update_pyproject_toml(
+        "tool.semantic_release.build_command_env",
+        [
+            # Includes arbitrary whitespace which will be removed
+            " MY_CUSTOM_VARIABLE ",             # detect and pass from environment
+            " OVERWRITTEN_VAR = overrided",     # pass hardcoded value which overrides environment
+            " SET_AS_EMPTY_VAR = ",             # keep variable initialized but as empty string
+            " HARDCODED_VAR=hardcoded ",        # pass hardcoded value that doesn't override anything
+            "VAR_W_EQUALS = a-var===condition", # only splits on 1st equals sign
+            "=ignored-invalid-named-var",       # TODO: validation error instead, but currently just ignore
+        ]
+    )
+
+    # Mock out subprocess.run
+    with mock.patch(
+        "subprocess.run", return_value=CompletedProcess(args=(), returncode=0)
+    ) as patched_subprocess_run, mock.patch(
+        "shellingham.detect_shell", return_value=("bash", "/usr/bin/bash")
+    ), mock.patch.dict("os.environ", patched_os_environment, clear=True):
+        # ACT: run & force a new version that will trigger the build command
+        result = cli_runner.invoke(
+            main, [version_subcmd, "--patch", "--no-commit", "--no-tag", "--no-changelog", "--no-push"]
+        )
+
+        patched_subprocess_run.assert_called_once_with(
+            ["bash", "-c", build_command],
+            check=True,
+            env={
+                "NEW_VERSION": "1.2.1",  # injected into environment
+                "CI": patched_os_environment["CI"],
+                "BITBUCKET_CI": "true",  # Converted
+                "GITHUB_ACTIONS": patched_os_environment["GITHUB_ACTIONS"],
+                "GITEA_ACTIONS": patched_os_environment["GITEA_ACTIONS"],
+                "GITLAB_CI": patched_os_environment["GITLAB_CI"],
+                "HOME": patched_os_environment["HOME"],
+                "PATH": patched_os_environment["PATH"],
+                "VIRTUAL_ENV": patched_os_environment["VIRTUAL_ENV"],
+                "PSR_DOCKER_GITHUB_ACTION": patched_os_environment[
+                    "PSR_DOCKER_GITHUB_ACTION"
+                ],
+                "MY_CUSTOM_VARIABLE": patched_os_environment["MY_CUSTOM_VARIABLE"],
+                "OVERWRITTEN_VAR": "overrided",
+                "SET_AS_EMPTY_VAR": "",
+                "HARDCODED_VAR": "hardcoded",
+                # Note that IGNORED_VARIABLE is not here.
+                "VAR_W_EQUALS": "a-var===condition",
+            },
+        )
+
+        # Make sure it did not error internally
+        assert result.exit_code == 0
+
+
 def test_version_skips_build_command_with_skip_build(
     repo_with_git_flow_angular_commits, cli_runner
 ):