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

Step analyzeCommits suddenly exits 0 without analyzing commits #517

Closed
JoooostB opened this issue Aug 29, 2023 · 20 comments
Closed

Step analyzeCommits suddenly exits 0 without analyzing commits #517

JoooostB opened this issue Aug 29, 2023 · 20 comments

Comments

@JoooostB
Copy link

As part of our CI/CD-pipelines we use semantic-release to create new tags within a self-hosted GitLab instance on dozens of repositories. This has been working steadily for ~2 years, but has been broken rather inexplicable since yesterday on all of them.
While the pipelines seem to succeed, as an exit code 0 is thrown, the analyzeCommits step completes without actually analysing found commits:

...
[8:42:57 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/gitlab"
[8:42:57 AM] [semantic-release] › ℹ  Found git tag 1.0.1 associated with version 1.0.1 on branch master
[8:42:57 AM] [semantic-release] › ℹ  Found 4 commits since last release
[8:42:57 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
Cleaning up file based variables
Job succeeded

Running with --debug I verified commits are still found with correct content, and as we're experiencing it on all pipelines I'm starting to think it has something to do with the plugin itself. I tried running previous versions of both node and semantic-release, but without success.

I'm curious if anyone else experiences the same or notices a faulty configuration in YAML's above. What baffles me the most is that it has been working steadily for a long time.

Configuration

We configured the pipeline and semantic-release as follows:

.gitlab-ci.yml

default:
  interruptible: false
stages:
  - tag

tag:
  image: node:latest
  stage: tag
  before_script:
    - apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
    - npm install -g semantic-release @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/gitlab @semantic-release/git @semantic-release/npm @semantic-release/release-notes-generator conventional-changelog conventional-changelog-conventionalcommits 
  script:
    - semantic-release
  when: on_success
  only:
    - master
  except:
    refs:
      - tags
    variables:
      - $CI_COMMIT_TITLE =~ /^RELEASE:.+$/

.releaserc.yaml

plugins:
  - "@semantic-release/gitlab"
branches: ['master']
ci: true
debug: true
dryRun: false
tagFormat: '${version}'

# Global plugin options (will be passed to all plugins)
preset: 'conventionalcommits'
gitlabUrl: 'https://git.organisation.com/' # your gitlab url

verifyConditions:
  - '@semantic-release/changelog'
  - '@semantic-release/git'
  - '@semantic-release/gitlab'
  - 
analyzeCommits:
  - path: '@semantic-release/commit-analyzer'

generateNotes:
  - path: '@semantic-release/release-notes-generator'
    writerOpts:
      groupBy: 'type'
      commitGroupsSort: 'title'
      commitsSort: 'header'
    linkCompare: true
    linkReferences: true

prepare:
  - path: '@semantic-release/changelog'
  - path: '@semantic-release/git'
    message: 'RELEASE: ${nextRelease.version}'
    assets: ['CHANGELOG.md']

publish:
  - path: '@semantic-release/gitlab'
@fredrikgh
Copy link

fredrikgh commented Aug 29, 2023

We have noted the same behaviour. No hint yet.

Reproduced locally and it does indeed exit 0.

@fredrikgh
Copy link

There seems to be some activity on deps, where 4 packages were upgraded, later reverted but now one got upgraded again. Do they have a cross-dependency now causing issues?

image

@angylada
Copy link

I could reproduce this issue locally as well. I tried downgrading every npm package we need for semantic-release to run, which received a new release in the past few days.
When downgrading conventional-changelog-conventionalcommits to version 6.1.0 it worked as it did one week ago. So the bug seems to be related to this package.

@levibostian
Copy link

Huge thanks to @angylada for their debugging.

If it's helpful for others using cycjimmy/semantic-release-action on GitHub Actions, installing 6.1.0 of conventional-changelog-conventionalcommits did fix this for me.

      - name: Deploy git tag and Gradle plugin release via Semantic Release 
        uses: cycjimmy/semantic-release-action@v3
        with: 
          # Hard-coding version as workaround https://github.com/semantic-release/commit-analyzer/issues/517#issuecomment-1697193361
          extra_plugins: |
            @semantic-release/git
            @semantic-release/exec
            conventional-changelog-conventionalcommits@6.1.0 
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@travi
Copy link
Member

travi commented Aug 29, 2023

since we are seeing feedback about this issue coming in though multiple issues, i've created a tracking issue at semantic-release/semantic-release#2929 to centralize the conversation

@travi
Copy link
Member

travi commented Aug 29, 2023

summary here, exiting with zero is an issue that we do need to investigate but the root cause is the breaking updates to the conventional-changelog presets that happened over the weekend since you are using a different preset than the default (and therefore installing it separately from semantic-release itself).

our focus will be on addressing the preset updates first, but i will leave this issue open so that we follow up by investigating the lack of failure. if someone would be interested in helping to track down that problem in parallel with our efforts focused on presets, we would welcome the help.

@travi
Copy link
Member

travi commented Aug 29, 2023

There seems to be some activity on deps, where 4 packages were upgraded, later reverted but now one got upgraded again. Do they have a cross-dependency now causing issues?

appreciate the investigation here and i can certainly see how this would appear to be related. unfortunately, this was related to the preset updates exposing a gap to how our pipeline stages were protecting (or not as it turned out) against auto merging updates that failed the build. after fixing our pipeline, i reverted the presets that we test against as dev dependencies, but accidentally also reverted the prod dependency that was safe to be merged because of the related naming.

in the end, the using a custom preset and installing the latest major version that comes with breaking changes that semantic-release is not ready for is the root issue. installing the previous major version for now should resolve issues for folks seeing this problem

@efr-devgod
Copy link

efr-devgod commented Aug 29, 2023

Just digging around, not 100% sure, maybe someone can have a good look as well. In version 7.0.0 of conventional-changelog-conventionalcommits, the path of files have moves from dash-words to camelCase. I believe this is causing the commit-analyzer to fail?

conventional-changelog/conventional-changelog@8d0ffbe

https://github.com/semantic-release/commit-analyzer/blob/master/lib/load-parser-config.js#L24C30-L24C30

@spulci
Copy link

spulci commented Aug 29, 2023

Just digging around, not 100% sure, maybe someone can have a good look as well. In version 7.0.0 of conventional-changelog-conventionalcommits, the path of files have moves from dash-words to camelCase. I believe this is causing the commit-analyzer to fail?

conventional-changelog/conventional-changelog@8d0ffbe

https://github.com/semantic-release/commit-analyzer/blob/master/lib/load-parser-config.js#L24C30-L24C30

We fixed the issue in our installation reverting to

conventional-changelog-conventionalcommits@6.1.0

together with

@semantic-release/commit-analyzer@10.0.1

We're using semantic release 20.x actually. We've not tested latest commit-analyzer releases (we will do tomorrow). So it seems that the issue is related to conventional-changelog-conventionalcommits > 6.1.0 as far as we can understand

bdeneux added a commit to okp4/nemeton-leaderboard that referenced this issue Aug 29, 2023
bdeneux added a commit to okp4/nemeton-leaderboard that referenced this issue Aug 29, 2023
bdeneux added a commit to okp4/nemeton-leaderboard that referenced this issue Aug 29, 2023
@vytautas-pranskunas-
Copy link

vytautas-pranskunas- commented Aug 30, 2023

Same here... I am using github actions and specifying versions not helping. Today it was planned to do release and BAM.. it is failing... feeling frustruated...

Maybe anyone has an idea how to override versions in github action?
My current code look slike this:

  • name: Semantic Release
    uses: cycjimmy/semantic-release-action@v3
    id: semantic
    with:
    semantic_version: 19
    extra_plugins: |
    @semantic-release/commit-analyzer@9.0.2
    conventional-changelog-conventionalcommits@6.1.0
    @semantic-release/git
    @semantic-release/changelog
    @semantic-release/release-notes-generator@10.0.3
    conventional-changelog-eslint
    env:
    RUNNER_DEBUG: 1

but it does not work

@spulci are you doing this in github actions file? Maybe you can share full step config?

@spulci
Copy link

spulci commented Aug 30, 2023

Same here... I am using github actions and specifying versions not helping. Today it was planned to do release and BAM.. it is failing... feeling frustruated...
@spulci are you doing this in github actions file? Maybe you can share full step config?

Sorry, my CI is actually on Gitlab...but I've just fixed the couple of plugin version stated in my previous message, nothing more. Please double check that you've invalidated your CI cache if any..it could be of help hopefully.

@vytautas-pranskunas-
Copy link

@spulci but have you specified those versions under extra_plugins: or where? Maybe you can drop here some configs from gitlab?

@dnaprawa
Copy link

I've got the same problem as author of the issue while using official Github Action for Semantic Release – do we have any solution to fix it?

@vytautas-pranskunas-
Copy link

vytautas-pranskunas- commented Aug 30, 2023

When i do this for github actions:

- name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        id: semantic
        with:
          semantic_version: 19
          extends: |
            @semantic-release/apm-config
            @semantic-release/commit-analyzer@9.0.2
            conventional-changelog-conventionalcommits@6.1.0
          extra_plugins: |
            @semantic-release/git
            @semantic-release/changelog
            @semantic-release/release-notes-generator@10.0.3
            conventional-changelog-eslint
        env:
          RUNNER_DEBUG: 1

it starts to analyze commits but not respecting cofiguration specified in .releaserc.json file for @semantic-release/commit-analyzer

@jmarrio1
Copy link

Yes, I can also confirm this behaviour in our pipeline. We are trying to revert to older version of semantic release.

@spulci
Copy link

spulci commented Aug 30, 2023

@spulci but have you specified those versions under extra_plugins: or where? Maybe you can drop here some configs from gitlab?

In gitlab CI I've got this:

before_script:
    - npm install @semantic-release/git @semantic-release/commit-analyzer semantic-release-gitlab-registry @semantic-release/release-notes-generator @semantic-release/gitlab @semantic-release/changelog conventional-changelog-conventionalcommits@6 --force --no-save
  script:
    - npx semantic-release@21 --repositoryUrl ${CI_REPOSITORY_URL}

In the npm install you can see some of the plugins I'm using inside my .releaserc.yml I've got in the root of my projects. Just force conventionalcommits to release train 6.x using semantic 21.x.

@travi
Copy link
Member

travi commented Aug 30, 2023

When i do this for github actions:

- name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        id: semantic
        with:
          semantic_version: 19
          extends: |
            @semantic-release/apm-config
            @semantic-release/commit-analyzer@9.0.2
            conventional-changelog-conventionalcommits@6.1.0
          extra_plugins: |
            @semantic-release/git
            @semantic-release/changelog
            @semantic-release/release-notes-generator@10.0.3
            conventional-changelog-eslint
        env:
          RUNNER_DEBUG: 1

it starts to analyze commits but not respecting cofiguration specified in .releaserc.json file for @semantic-release/commit-analyzer

it looks like you are confused about the necessary update needed to your config. adding the version to the extends block will not help and will likely result in other errors. the version needs to be specified in the extra_plugins block since that is what is doing the installation step. (note this is my understanding without being the maintainer of the action used here. if this is incorrect, you may get better information from the maintainers of that action. however, the problem you are experiencing is not because of semantic-release or the action you are using).

the odd thing about the config you are showing here is that you are mentioning conventional-changelog-conventionalcommits under extends block with a version, but you mention conventional-changelog-eslint under extra_plugins these are both commit-convention presets and you should only be using one, the one referenced in your .releaserc. did you possibly mistakenly add conventional-changelog-conventionalcommits with a version based on the feedback from this issue? if you are actually using conventional-changelog-eslint, that would be the one you need to specify a version for.

@travi
Copy link
Member

travi commented Aug 30, 2023

I've got the same problem as author of the issue while using official Github Action for Semantic Release – do we have any solution to fix it?

yes, the solution is to specify a version for the conventional-changelog preset that your project is installing rather than using the latest version, as is mentioned a few times in this thread and in semantic-release/semantic-release#2929. the version you specify needs to be for the previous major version since the latest major includes breaking changes that semantic-release is not prepared to work with yet

@travi
Copy link
Member

travi commented Aug 30, 2023

i've created semantic-release/semantic-release#2932 to track the problem of exiting with the wrong exit code. with that, i'm going to close this issue. please direct further feedback to either semantic-release/semantic-release#2929 or semantic-release/semantic-release#2932

@travi travi closed this as completed Aug 30, 2023
@vytautas-pranskunas-
Copy link

When i do this for github actions:

- name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        id: semantic
        with:
          semantic_version: 19
          extends: |
            @semantic-release/apm-config
            @semantic-release/commit-analyzer@9.0.2
            conventional-changelog-conventionalcommits@6.1.0
          extra_plugins: |
            @semantic-release/git
            @semantic-release/changelog
            @semantic-release/release-notes-generator@10.0.3
            conventional-changelog-eslint
        env:
          RUNNER_DEBUG: 1

it starts to analyze commits but not respecting cofiguration specified in .releaserc.json file for @semantic-release/commit-analyzer

it looks like you are confused about the necessary update needed to your config. adding the version to the extends block will not help and will likely result in other errors. the version needs to be specified in the extra_plugins block since that is what is doing the installation step. (note this is my understanding without being the maintainer of the action used here. if this is incorrect, you may get better information from the maintainers of that action. however, the problem you are experiencing is not because of semantic-release or the action you are using).

the odd thing about the config you are showing here is that you are mentioning conventional-changelog-conventionalcommits under extends block with a version, but you mention conventional-changelog-eslint under extra_plugins these are both commit-convention presets and you should only be using one, the one referenced in your .releaserc. did you possibly mistakenly add conventional-changelog-conventionalcommits with a version based on the feedback from this issue? if you are actually using conventional-changelog-eslint, that would be the one you need to specify a version for.

Thanks

it worked with this config

  • name: Semantic Release
    uses: cycjimmy/semantic-release-action@v3
    id: semantic
    with:
    semantic_version: 19
    extra_plugins: |
    @semantic-release/git
    @semantic-release/changelog
    @semantic-release/release-notes-generator@10.0.3
    @semantic-release/commit-analyzer@9.0.2
    conventional-changelog-eslint@4.0.0
    env:
    RUNNER_DEBUG: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants