Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

build_command environment variables not working after upgrade from 9.6.0 to 9.7.0 #922

Closed
tkcontiant opened this issue May 9, 2024 · 8 comments · Fixed by #925
Closed
Assignees
Labels
bug Something isn't working properly confirmed Prevent from becoming stale

Comments

@tkcontiant
Copy link

tkcontiant commented May 9, 2024

The problem

I am using environment variables in the build command and this use to work.

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.

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

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.

semantic-release -vv version
[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.

@tkcontiant tkcontiant added the bug Something isn't working properly label May 9, 2024
@tkcontiant tkcontiant changed the title build_command issues after upgrade from 9.6.0 to 9.7.1 build_command environment variables not working after upgrade from 9.6.0 to 9.7.0 May 9, 2024
@codejedi365
Copy link
Contributor

@tkcontiant, thank you for the bug report. The change in 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.

@codejedi365 codejedi365 added the confirmed Prevent from becoming stale label May 10, 2024
@codejedi365 codejedi365 self-assigned this May 10, 2024
@tkcontiant
Copy link
Author

tkcontiant commented May 10, 2024 via email

@codejedi365
Copy link
Contributor

codejedi365 commented May 10, 2024

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

@tkcontiant
Copy link
Author

tkcontiant commented May 10, 2024 via email

@tkcontiant
Copy link
Author

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.

codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 12, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 12, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 13, 2024
codejedi365 added a commit that referenced this issue May 13, 2024
- test(version): add test of user defined env variables in build command

  ref: #922

- fix(version): enable user config of `build_command` env variables

  Resolves: #922

- docs(configuration): document `build_command_env` configuration option
@codejedi365
Copy link
Contributor

🎉 This issue has been resolved in version 9.7.2 🎉

The release is available on:

@codejedi365
Copy link
Contributor

@tkcontiant, Thank you for your input and issue report. The following configuration should provide the environment that you seek. Let me know if it doesn't work for you.

diff a/pyproject.toml b/pyproject.toml

  [tool.semantic_release]
  build_command = "buildah bud -t ${APPLICATION_NAME}:${CI_JOB_ID} ."
+ build_command_env = [
+     "APPLICATION_NAME",
+     "CI_JOB_ID",
+ ]

ref: https://python-semantic-release.readthedocs.io/en/latest/configuration.html#build-command-env

@tkcontiant
Copy link
Author

tkcontiant commented May 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly confirmed Prevent from becoming stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants