1

I tried to set up my repo to automatically trigger versioning increase based on commit. But it doesn't seem to recognise that it's on Gitlab.

Here's the logs of the latest run:

semantic-release -vv publish
[05:17:10] DEBUG    [semantic_release.cli.commands.main] DEBUG       main.py:105
                    main.main: logging level set to: DEBUG                      
           DEBUG    [semantic_release.cli.commands.main] DEBUG       main.py:123
                    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:261
                    config.select_branch_options: Using group                   
                    'develop' options, as 'develop' matches                     
                    'develop'                                                   
           WARNING  [semantic_release.cli.config] WARNING          config.py:380
                    config.from_raw_config: the token for the                   
                    remote VCS is configured as stored in the                   
                    GH_TOKEN environment variable, but it is empty              
           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 'v{version}' to                         
                    'v(?P<version>.*)'                                          
           DEBUG    [semantic_release.version.version] DEBUG      version.py:121
                    version.parse: attempting to parse string                   
                    '1.4.0' as Version                                          
           DEBUG    [semantic_release.version.version] DEBUG      version.py:145
                    version.parse: version string 1.4.0 parsed as               
                    a non-prerelease                                            
           DEBUG    [semantic_release.version.version] DEBUG      version.py:148
                    version.parse: parsed build metadata '' from                
                    version string 1.4.0                                        
           INFO     [semantic_release.version.algorithm] INFO    algorithm.py:60
                    algorithm.tags_and_versions: found 1                        
                    previous tags                                               
           INFO     [semantic_release.cli.commands.publish] INFO   publish.py:48
                    publish.publish: Uploading distributions to                 
                    release                                                     
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:45
                    helpers._wrapper:                                           
                    upload_dists(<semantic_release.hvcs.github.Git              
                    hub object at 0x7efc0b7b1390>, tag='v1.4.0',                
                    dist_glob='dist/*')                                         
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:45
                    helpers._wrapper:                                           
                    get_release_id_by_tag(<semantic_release.hvcs.g              
                    ithub.Github object at 0x7efc0b7b1390>,                     
                    tag='v1.4.0')                                               
           DEBUG    [semantic_release.helpers] DEBUG              helpers.py:112
                    helpers.parse_git_url: Parsing git url                      
                    'https://gitlab-ci-token:***@gitlab.com/test/custom/projects/app/backend.               
                    git'                                                        
           DEBUG    [urllib3.connectionpool] DEBUG        connectionpool.py:1055
                    connectionpool._new_conn: Starting                          
                    new HTTPS connection (1):                                   
                    api.github.com:443                                          
           DEBUG    [urllib3.connectionpool] DEBUG         connectionpool.py:549
                    connectionpool._make_request:                               
                    https://api.github.com:443 "GET                             
                    /repos/test/custom/projects/app/backend/releases/tags/v1.4.0 HTTP/1.1" 404 91                       
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:56
                    helpers._wrapper: Github.get_release_id_by_tag              
                    -> None                                                     
           WARNING  [semantic_release.hvcs.github] WARNING         github.py:252
                    github.upload_dists: No release corresponds to              
                    tag v1.4.0, can't upload dists                              
           DEBUG    [semantic_release.hvcs.github] DEBUG           helpers.py:56
                    helpers._wrapper: Github.upload_dists -> 0                  

Cleaning up project directory and file based variables

And this is the config files to set that up:

[tool.semantic_release]
version_variable = "lambda/__init__.py:__version__" # --> version = "1.4.0"
 
[tool.semantic_release.branches.develop]
match = "develop"
prerelease = true

As you can see from the logs, it tries to interact with GitHub which is not suppose to do so? I couldn't find a way on the docs to force is on a particular VCS, it supposedly detects it automatically from environment variables. But I don't know which one is triggering this.

Anyone ever had this issue? Or if you know a better way to do the same thing?

1 Answer 1

2

What you need to do is to add remote type setting for Gitlab as described in the documentation here

Add something like this for a start:

[tool.semantic_release.remote]
type = "gitlab"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.