-
Notifications
You must be signed in to change notification settings - Fork 236
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
IndexError: list index out of range :: semantic-release -vvv version #724
Comments
I've got the same issue while running from Azure DevOps. It looks like this command returns None if working with detached HEAD that was re-attached by
|
Any update for that issue ? i'm having the same problem using azure devops too, doing the same steps as @pavel-henrykhsen and having the same output |
@intex46, @pavel-henrykhsen, just took a look at your issue and the code. It looks like just previously to the error the call to git merge-base $LATEST_TAG $CURRENT_BRANCH Python Semantic Release is expecting the result of this to be 1 commit hash but given your error I believe this command isn't returning anything. Please try running this command locally with your respective branches and make sure it provides the expected commit hash. My hypothesis is that it will work locally but it fails in the CI environments because of the CI setup's that you may not be in control of (especially GitLab). GitLab, by default, will check out a shallow repo of If my hypothesis is correct, try running the following command in the CI prior to git fetch --unshallow --prune --prune-tags --tags
The |
@codejedi365 thank you so much for your help , it did resolve the problem , now i'm facing a new issue , the generated |
@intex46, sweet! Glad that worked.
Yes, just looked at the code, I just noticed this configuration is a bit convoluted but we don't look at the URL of your git remote (although I think we should after reviewing this). We use a hardcoded default since you have selected Ex: [tool.semantic_release.remote]
type = "github"
# if you want it to dynamically read from the env
domain = { env: "GITHUB_SERVER_URL" }
# or hardcoded (do NOT include protocol prefix)
domain = "dev.asure" I'm not familiar with Asure DevOps but looks like to me that it doesn't have as nice Environment variables to pull the domain from, instead it gives a full url or uri to the project. Likely not what you are looking for. This may still have some issues depending on what the full path references in your changelog are supposed to be. Let me know how this works for you. |
What can i say : thank you so much !!! it worked using your suggestion |
Merge-base errors generally occur from a shallow clone that is primarily used by CI environments and will cause PSR to explode prior to this change. Now it exits with an appropriate error. Resolves: python-semantic-release#724
Merge-base errors generally occur from a shallow clone that is primarily used by CI environments and will cause PSR to explode prior to this change. Now it exits with an appropriate error. Resolves: python-semantic-release#724
Release In the future, I will be looking to see if we can automatically unshallow the repository to further eliminate the possibility of a missing merge-base. Separately, the undocumented domain setting was broken out into its one issue #868. |
The problem
Facing error while the command
semantic-release -vvv version
. It leadsIndexError: list index out of range
Expected behavior
It will determining the next version, applying the changes to the project metadata according to the configuration, writing a changelog, and committing/pushing changes to the remote Git repository
Environment
I'm facing this while running my script in Gitlab CI/CD
Python 3.9.18 pip 23.2.1 semantic-release, version 8.1.1 annotated-types==0.5.0 attrs==23.1.0 build==0.10.0 CacheControl==0.13.1 certifi==2023.5.7 cffi==1.16.0 charset-normalizer==3.1.0 cleo==2.0.1 click==8.1.7 crashtest==0.4.1 cryptography==41.0.4 distlib==0.3.7 dotty-dict==1.3.1 dulwich==0.21.6 -e git+ssh://git@gitlab.com/health-ec/platform/core/libraries/etl-libraries.git@22f03b4578d085b428cba0c0c073eab760f6220c#egg=fhirclient&subdirectory=fhirclient filelock==3.12.4 gitdb==4.0.10 GitPython==3.1.37 idna==3.4 importlib-metadata==6.8.0 importlib-resources==5.13.0 installer==0.7.0 jaraco.classes==3.3.0 jeepney==0.8.0 Jinja2==3.1.2 jsonschema==4.17.3 keyring==24.2.0 markdown-it-py==3.0.0 MarkupSafe==2.1.3 mdurl==0.1.2 more-itertools==10.1.0 msgpack==1.0.7 packaging==23.1 pexpect==4.8.0 pkginfo==1.9.6 pkgutil_resolve_name==1.3.10 platformdirs==3.10.0 poetry==1.6.1 poetry-core==1.7.0 poetry-plugin-export==1.5.0 ptyprocess==0.7.0 pycparser==2.21 pydantic==2.4.2 pydantic_core==2.10.1 Pygments==2.16.1 pyproject_hooks==1.0.0 pyrsistent==0.19.3 python-gitlab==3.15.0 python-semantic-release==8.1.1 rapidfuzz==2.15.1 requests==2.31.0 requests-toolbelt==1.0.0 rich==13.5.3 SecretStorage==3.3.3 shellingham==1.5.3 smmap==5.0.1 tomli==2.0.1 tomlkit==0.12.1 trove-classifiers==2023.9.19 typing_extensions==4.8.0 urllib3==2.0.3 virtualenv==20.24.5 zipp==3.17.0
Using poetry as build tool
Configuration
[tool.semantic_release]
version_toml = [
"pyproject.toml:tool.poetry.version"
]
branch = "main"
build_command = "poetry build"
commit_author = "semantic-release-bot my@somemail.com"
commit_subject = "chore(release): fhirclient {version}"
commit_message = "chore(release): fhirclient {version} [skip ci]"
hvcs = "gitlab"
pre_commit_command = "git pull origin main"
tag_format="fhirclient/v{version}"
upload_to_vcs_release = false
version_source = "tag"
Logs
$ poetry run semantic-release -vvv version
[13:04:27] DEBUG [semantic_release.cli.commands.main] DEBUG main.py:104
main.main: logging level set to: DEBUG
DEBUG [semantic_release.cli.commands.main] DEBUG main.py:122
main.main: global cli options:
GlobalCommandLineOptions(noop=False,
verbosity=2, config_file='pyproject.toml',
strict=False)
INFO [semantic_release.cli.util] INFO util.py:78
util.load_raw_config_file: Loading configuration
from pyproject.toml
DEBUG [semantic_release.cli.util] DEBUG util.py:81
util.load_raw_config_file: Trying to parse
configuration pyproject.toml in TOML format
INFO [semantic_release.cli.config] INFO config.py:228
config.select_branch_options: Using group
'main' options, as '(main|master)' matches
'main'
DEBUG [semantic_release.hvcs.util] DEBUG util.py:48
util.build_requests_session: setting up default
session authentication
DEBUG [semantic_release.changelog.template] DEBUG template.py:55
template.environment: {'template_dir':
'templates', 'block_start_string': '{%',
'block_end_string': '%}',
'variable_start_string': '{{',
'variable_end_string': '}}',
'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.py:40
translator._invert_tag_format_to_re:
inverted tag_format 'fhirclient/v{version}'
to 'fhirclient/v(?P.*)'
DEBUG [semantic_release.cli.masking_filter] masking_filter.py:30
DEBUG masking_filter.add_mask_for:
Adding redact pattern
'context.hvcs_client.token' to
_redact_patterns
DEBUG [semantic_release.cli.masking_filter] masking_filter.py:30
DEBUG masking_filter.add_mask_for:
Adding redact pattern
'context.hvcs_client.token' to
_redact_patterns
DEBUG [semantic_release.cli.commands.version] DEBUG version.py:50
version.is_forced_prerelease: force_prerelease
= False, force_level = None, prerelease =
False
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.1.0' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.1.0 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.1.0
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.2.0' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.2.0 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.2.0
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.2.1' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.2.1 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.2.1
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.2.2' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.2.2 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.2.2
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.5.0' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.5.0 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.5.0
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.7.0' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.7.0 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.7.0
INFO [semantic_release.version.algorithm] INFO algorithm.py:60
algorithm.tags_and_versions: found 6
previous tags
INFO [semantic_release.version.algorithm] INFO algorithm.py:255
algorithm.next_version: Found 6 full
releases (excluding prereleases)
DEBUG [semantic_release.version.version] DEBUG version.py:120
version.parse: attempting to parse string
'0.0.0' as Version
DEBUG [semantic_release.version.version] DEBUG version.py:144
version.parse: version string 0.0.0 parsed as
a non-prerelease
DEBUG [semantic_release.version.version] DEBUG version.py:147
version.parse: parsed build metadata '' from
version string 0.0.0
INFO [semantic_release.version.algorithm] INFO algorithm.py:277
algorithm.next_version: The last full
release was 0.7.0, tagged as
'fhirclient/v0.7.0'
DEBUG [git.cmd] DEBUG cmd.execute: Popen(['git', cmd.py:977
'merge-base', 'fhirclient/v0.7.0', 'main'],
cwd=/builds/health-ec/platform/core/libraries/etl
-libraries, universal_newlines=False, shell=None,
istream=None)
Traceback (most recent call last):
File "/usr/local/bin/semantic-release", line 8, in
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/semantic_release/cli/commands/version.py", line 277, in version
new_version = next_version(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/semantic_release/version/algorithm.py", line 288, in next_version
merge_base = merge_bases[0]
~~~~~~~~~~~^^^
IndexError: list index out of range
If using GitHub actions, ensure the
root_options
contains the-vv
flagfor 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.
The text was updated successfully, but these errors were encountered: