Skip to content

Version Command failed Create Release step under Github Enterprise VCS #895

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

Closed
xesf opened this issue Apr 17, 2024 · 8 comments · Fixed by #896
Closed

Version Command failed Create Release step under Github Enterprise VCS #895

xesf opened this issue Apr 17, 2024 · 8 comments · Fixed by #896
Labels
bug Something isn't working properly released

Comments

@xesf
Copy link

xesf commented Apr 17, 2024

The problem

Semantic Release is not able to Create a Release in Github during version command.

I am trying to migrate my setup from version 7 to 9 and re-configuring from setup.cfg file to pyproject.toml

The previous single publish command no longer works due to breaking changes on v9 and the new version is partially working.
The new version is identified, changelog is updated, commits and tags pushed to github, but at the last stage semantic release is not able to create a release under github release options.

Expected behavior

Be able to create a release in VCS Github.

Environment

Running in a private Github Action Runners via command line:

python3.11 -m semantic_release version (failed command)

GHA workflow:

- name: Publish Semantic Version and Generate Changelog
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          python3.11 -m semantic_release version

python 3.11
semantic release 9.4.2
via pip

Configuration

[tool.semantic_release]
branch = "main"
changelog_file = "CHANGELOG.md"
commit_message = "chore(release): release version {version} [ci skip]"
version_variables = [
    "src/artifacts/__init__.py:__version__"
]
upload_to_vcs_release = false
remote.type = "github"
remote.domain = "git-domain.com"
remote.api_domain = "git-domain.com/api/v3"

Logs

python3.11 -m semantic_release version
0.1.7
The next version is: 0.1.7! 🚀
No build command specified, skipping
[13:27:25] ERROR    [semantic_release.cli.commands.version] ERROR version.py:642
                    version.version: Unreadable json response                   
                    ╭──── Traceback (most recent call last) ────╮               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/requests/models.py:971 in json    │               
                    │                                           │               
                    │    968 │   │   │   │   │   raise Requests │               
                    │    969 │   │                              │               
                    │    970 │   │   try:                       │               
                    │ ❱  971 │   │   │   return complexjson.loa │               
                    │    972 │   │   except JSONDecodeError as  │               
                    │    973 │   │   │   # Catch JSON-related e │               
                    │    974 │   │   │   # This aliases json.JS │               
                    │                                           │               
                    │ /usr/lib/python3.11/json/__init__.py:346  │               
                    │ in loads                                  │               
                    │                                           │               
                    │   343 │   if (cls is None and object_hook │               
                    │   344 │   │   │   parse_int is None and p │               
                    │   345 │   │   │   parse_constant is None  │               
                    │ ❱ 346 │   │   return _default_decoder.dec │               
                    │   347 │   if cls is None:                 │               
                    │   348 │   │   cls = JSONDecoder           │               
                    │   349 │   if object_hook is not None:     │               
                    │                                           │               
                    │ /usr/lib/python3.11/json/decoder.py:337   │               
                    │ in decode                                 │               
                    │                                           │               
                    │   334 │   │   containing a JSON document) │               
                    │   335 │   │                               │               
                    │   336 │   │   """
                    │ ❱ 337 │   │   obj, end = self.raw_decode( │               
                    │   338 │   │   end = _w(s, end).end()      │               
                    │   339 │   │   if end != len(s):           │               
                    │   340 │   │   │   raise JSONDecodeError(" │               
                    │                                           │               
                    │ /usr/lib/python3.11/json/decoder.py:355   │               
                    │ in raw_decode                             │               
                    │                                           │               
                    │   352 │   │   try:                        │               
                    │   353 │   │   │   obj, end = self.scan_on │               
                    │   354 │   │   except StopIteration as err │               
                    │ ❱ 355 │   │   │   raise JSONDecodeError("
                    │   356 │   │   return obj, end             │               
                    │   357                                     │               
                    ╰───────────────────────────────────────────╯               
                    JSONDecodeError: Expecting value: line 7                    
                    column 1 (char 6)                                           
                                                                                
                    During handling of the above exception,                     
                    another exception occurred:                                 
                                                                                
                    ╭──── Traceback (most recent call last) ────╮               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/hvcs/github.py:2 │               
                    │ 03 in create_release                      │               
                    │                                           │               
                    │   [20]()0 │   │   response.raise_for_status() │               
                    │   201 │   │                               │               
                    │   202 │   │   try:                        │               
                    │ ❱ 203 │   │   │   release_id: int = respo │               
                    │   204 │   │   │   log.info("Successfully  │               
                    │   205 │   │   │   return release_id       │               
                    │   206 │   │   except JSONDecodeError as e │               
                    │                                           │               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/requests/models.py:975 in json    │               
                    │                                           │               
                    │    972 │   │   except JSONDecodeError as  │               
                    │    973 │   │   │   # Catch JSON-related e │               
                    │    974 │   │   │   # This aliases json.JS │               
                    │ ❱  975 │   │   │   raise RequestsJSONDeco │               
                    │    976 │                                  │               
                    │    977 │   @property                      │               
                    │    978 │   def links(self):               │               
                    ╰───────────────────────────────────────────╯               
                    JSONDecodeError: Expecting value: line 7                    
                    column 1 (char 6)                                           
                                                                                
                    The above exception was the direct cause of                 
                    the following exception:                                    
                                                                                
                    ╭──── Traceback (most recent call last) ────╮               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/cli/commands/ver │               
                    │ sion.py:633 in version                    │               
                    │                                           │               
                    │   630 │   │   │   noop_report(f"would hav │               
                    │   631 │   │   else:                       │               
                    │   632 │   │   │   try:                    │               
                    │ ❱ 633 │   │   │   │   release_id = hvcs_c │               
                    │   634 │   │   │   │   │   tag=new_version │               
                    │   635 │   │   │   │   │   release_notes=r │               
                    │   636 │   │   │   │   │   prerelease=new_ │               
                    │                                           │               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/helpers.py:53 in │               
                    │ _wrapper                                  │               
                    │                                           │               
                    │    50 │   │   │   )                       │               
                    │    51 │   │   │                           │               
                    │    52 │   │   │   # Call function         │               
                    │ ❱  53 │   │   │   result = func(*args, ** │               
                    │    54 │   │   │                           │               
                    │    55 │   │   │   # Log result            │               
                    │    56 │   │   │   logger.debug("%s -> %s"
                    │                                           │               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/hvcs/github.py:2 │               
                    │ 72 in create_or_update_release            │               
                    │                                           │               
                    │   269 │   │   """                         │               
                    │   270 │   │   log.info("Creating release  │               
                    │   271 │   │   try:                        │               
                    │ ❱ 272 │   │   │   return self.create_rele │               
                    │   273 │   │   except HTTPError as err:    │               
                    │   274 │   │   │   log.debug("error creati │               
                    │   275 │   │   │   log.debug("looking for  │               
                    │                                           │               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/helpers.py:53 in │               
                    │ _wrapper                                  │               
                    │                                           │               
                    │    50 │   │   │   )                       │               
                    │    51 │   │   │                           │               
                    │    52 │   │   │   # Call function         │               
                    │ ❱  53 │   │   │   result = func(*args, ** │               
                    │    54 │   │   │                           │               
                    │    55 │   │   │   # Log result            │               
                    │    56 │   │   │   logger.debug("%s -> %s"
                    │                                           │               
                    │ /home/runner/.local/lib/python3.11/site-p │               
                    │ ackages/semantic_release/hvcs/github.py:2 │               
                    │ 07 in create_release                      │               
                    │                                           │               
                    │   204 │   │   │   log.info("Successfully  │               
                    │   205 │   │   │   return release_id       │               
                    │   206 │   │   except JSONDecodeError as e │               
                    │ ❱ 207 │   │   │   raise UnexpectedRespons │               
                    ���   208 │   │   except KeyError as err:     │               
                    │   209 │   │   │   raise UnexpectedRespons │               
                    │   [21]()0                                     │               
                    ╰───────────────────────────────────────────╯               
                    UnexpectedResponse: Unreadable json response                
Usage: python -m semantic_release version [OPTIONS]
Try 'python -m semantic_release version -h' for help.

Error: Unreadable json response
Unexpected response from remote VCS!
Before re-running, make sure to clean up any artifacts on the hvcs that may have already been created.

Additional context

  • Private Github Enterprise version 3.11.6
@xesf xesf added the bug Something isn't working properly label Apr 17, 2024
@codejedi365
Copy link
Contributor

@xesf, I'm sorry that the upgrade failed for you. Ends up we don't currently support GitHub Enterprise Server's api path at this time. I noticed this issue with the last patch update of url parsing and should be able to add support over the next week.

@xesf
Copy link
Author

xesf commented Apr 17, 2024

Thanks for the quick reply @codejedi365
No worries, I will disable this piece for now and re-enable once Enterprise is supported.

Cheers

@xesf xesf changed the title Version Command failed Create Release step under Github VCS Version Command failed Create Release step under Github Enterprise VCS Apr 18, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 20, 2024
@codejedi365 codejedi365 self-assigned this Apr 20, 2024
@codejedi365
Copy link
Contributor

codejedi365 commented Apr 20, 2024

@xesf, since I do not have a GitHub Enterprise Server instance to test my changes with, would you be willing to try out this alpha release, 9.5.0-alpha.1, manually in your environment?

I recommend running the command semantic-release generate-config --pyproject >> pyproject.toml first to append the new configuration defaults and then modify them accordingly with your specialized domain settings. Note that any configuration that you don't care to change can be deleted as the initial config generation chooses all defaults. Since you are also bumping from v7 to v9, you will need to consider any deprecated settings previously used which are documented on the Migration from v7 to v8 page.

When you run the test, please use the following command to gather verbose logging

semantic-release -vv version

codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 20, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 20, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 20, 2024
@codejedi365 codejedi365 added the awaiting-reply Waiting for response label Apr 20, 2024
@xesf
Copy link
Author

xesf commented Apr 20, 2024

Sure, sounds good and thanks for the quick fix. I will try later today since I won't be at home for the entire day and let you know.

@xesf
Copy link
Author

xesf commented Apr 20, 2024

@codejedi365 I've test it and it is working fine.
The last step to create the release in GH worked great, thanks.

INFO     [semantic_release.hvcs.github] INFO            github.py:251
                    github.create_release: Creating release for                 
                    tag v0.1.10                                                 
           DEBUG    [urllib3.connectionpool] DEBUG         connectionpool.py:962
                    connectionpool._new_conn: Starting new                      
                    HTTPS connection (1):                                       
                    DOMAIN:443                                          
[18:23:03] DEBUG    [urllib3.connectionpool] DEBUG         connectionpool.py:429
                    connectionpool._make_request:                               
                    [https://DOMAIN:443] "POST                            
                    /api/v3/repos/ORG/REPO/r                
                    eleases HTTP/1.1" 201 2262                                  
           INFO     [semantic_release.hvcs.github] INFO            github.py:271
                    github.create_release: Successfully created                 
                    release with ID: 75508                                      
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:56
                    helpers._wrapper: Github.create_release ->                  
                    75508                                                       
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:56
                    helpers._wrapper:                                           
                    Github.create_or_update_release -> 75508

Not related, but I notice the new version has a different changelog default template, where it includes the fix prefix in each line not only in the Heading. Is that the expected behaviour for the default template?
image

@codejedi365
Copy link
Contributor

@xesf, excellent news! Thank you for the quick response and live testing, will include the fix in the next release this weekend.

Is that the expected behaviour for the default template?

Yes, it is as of now. That was a change from v7 to v8, by the previous maintainer, where the entire commit is included in the changelog. I believe the reason was because of the use of squash commits which does not have a working solution in PSR as of yet. I have created a milestone to improve changelogs and have many changes in the works for both squash commit parsing and cleaner changelog defaults. Hopefully completed over the next month.

If you want the change now, you can override the changelog with jinja2 templates.

codejedi365 added a commit that referenced this issue Apr 20, 2024
* test(github): adjust init test to match the Enterprise Server api url

* feat(github): extend support to on-prem GitHub Enterprise Server

  Resolves: #895
@xesf
Copy link
Author

xesf commented Apr 20, 2024

Awesome!! Thanks for the prompt fix.

Got it, it is just a small thing so not very important, I just didn't know it was on purpose. I will still have a look on how
easy it may be to use the template. Cheers

@codejedi365 codejedi365 removed the awaiting-reply Waiting for response label Apr 23, 2024
@codejedi365
Copy link
Contributor

🎉 This issue has been resolved in version 9.5.0 🎉

The release is available on:

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 released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants