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

The commit should not trigger a release after recent updates #642

Closed
ashvardanian opened this issue May 8, 2024 · 13 comments
Closed

The commit should not trigger a release after recent updates #642

ashvardanian opened this issue May 8, 2024 · 13 comments

Comments

@ashvardanian
Copy link

My commit messages look like these:

commit d2b67fb4df02293e0a6478ffa6b61a1d6c502cff (origin/main-dev)
Author: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
Date:   Mon May 6 00:55:26 2024 +0000

    Fix: Build graph dependency

commit 4168fcda53a75eb50bde9cd342aa42eebf253422 (main-dev)
Author: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
Date:   Sun May 5 06:15:13 2024 +0000

    Make: Refresh `Cargo.lock`

... and the .releaserc is configured to detect those:

    "plugins": [
        [
            "@semantic-release/commit-analyzer",
            {
                "preset": "eslint",
                "releaseRules": [
                    {
                        "tag": "Break",
                        "release": "major"
                    },
                    {
                        "tag": "Add",
                        "release": "minor"
                    },
                    {
                        "tag": "Improve",
                        "release": "patch"
                    },
                    {
                        "tag": "Make",
                        "release": "patch"
                    },
                    {
                        "tag": "Refactor",
                        "release": false
                    }
                ]
            }
        ],

But recently, all of the semantic-release pipelines simply ignore all the releases:

[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Make: Publish Python sources
Closes #113
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge pull request #117 from ashvardanian/main-dev
Linking OpenMP
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[6:17:19 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Make: Disable JS prebuild for Windows

I'm currently using semantic-release in several projects and can't run the CI without it. I've tried locating the issue, but couldn't find where its coming from. Any pointers you could share?

@travi
Copy link
Member

travi commented May 8, 2024

Possibly related to semantic-release/release-notes-generator#633

@HenrikPoulsen
Copy link

Why doesn't the commit-analyzer throw an error in this situation?
I also had issues with it, in my case I was trying to get the breaking change feat! syntax working. The commit analyzer just ignored them, so I assume it just silently falls back to the angular preset or something?
Would have saved me many hours if it actually hard failed

@HenrikPoulsen
Copy link

I raised it over in semantic-release/release-notes-generator#633 as well, but I think it makes sense here as well.
Updating the plugins seems like an inherently dangerous proposition when it comes to semantic-release.
How am I supposed to know when an update is breaking the entire release flow like in the case outlined here?
As you can see from the output there's no errors at all. So you could go week after updating something without noticing anything is wrong.
We at least saw that the release-notes-generator broke from this change, but the commit-analyzer doesn't even get that far if you do what was outlined in this issue here.

Are there any suggestions for how one could automate verifying that an update doesn't break something? (even a non-major version update could still break you)
How would you, in your update branch, verify automatically that things like a feat!, fix or whatever else would still want to bump?
Are there things that could be done in semantic release itself to help reduce this?

If you are just doing this in a single repo it's not so much of a problem. But in my case I am considering rolling it out across hundreds of repos, specifically with the conventionalcommits plugin.
I don't know how to do this successfully given issues like this being able to arise.

@Yelinz

This comment was marked as resolved.

@travi
Copy link
Member

travi commented Jun 7, 2024

are you using commitlint as well? if so, see semantic-release/release-notes-generator#660 (comment)

what does npm ls conventional-changelog-conventionalcommits give you?

@Yelinz

This comment was marked as resolved.

@cgmEdi
Copy link

cgmEdi commented Jul 11, 2024

Hi,

we have a similar issue but for us the releases are skipped if we use a release config that analyzes the "message"field:

  releaseRules: [
    { breaking: true, release: 'major' },
    { type: 'feat', release: 'minor' },
    { type: 'fix', release: 'patch' },
    { message: '*', release: 'patch' }
  ]
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge branch 'renovate/cgm-life.docker.artifactory.cgm.ag-automation-maven-1.x' into 'main'
chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.4
See merge request cgm-de-life-infrastructure/kubernetes/automation-tools/pipeline-container-images/maven-jdk17!3
2024-07-02T07:09:11.404Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.406Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.4
2024-07-02T07:09:11.406Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.408Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Merge branch 'renovate/cgm-life.docker.artifactory.cgm.ag-automation-maven-1.x' into 'main'
chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.3
See merge request cgm-de-life-infrastructure/kubernetes/automation-tools/pipeline-container-images/maven-jdk17!2
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(renovate): Update cgm-life.docker.artifactory.cgm.ag/automation/maven Docker tag to v1.8.3
2024-07-02T07:09:11.409Z semantic-release:commit-analyzer Analyzing with custom rules
2024-07-02T07:09:11.410Z semantic-release:commit-analyzer Analyzing with default rules
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[7:09:11 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 4 commits complete: no release
[7:09:11 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[7:09:11 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[7:09:11 AM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[7:09:11 AM] [semantic-release] › ℹ  There are no relevant changes, so no new version is released.

Commits with type fix or feat work as expected.

@rj-wowza
Copy link

Branches where there the branch name is capitalized are skipped:

[@semantic-release/commit-analyzer] › ℹ  Analyzing commit: Fix: [LIVE-735] Remove feature flag for facebook live 
[@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release

it works if the branch name is lowercase like: fix: [LIVE-735] Remove feature flag for facebook live

this is problematic since Github capitalizes the branch names automatically

@travi
Copy link
Member

travi commented Jul 12, 2024

Branches where there the branch name is capitalized are skipped

Branches commits with initial capitalization do not follow the commit convention you have chosen (even if you are using the default configured for semantic-release). semantic-release does not define the conventions and you have the option to define your own.

also, semantic-release evaluates commit messages, not branch names. this has not changed in recent updates

this is problematic since Github capitalizes the branch names automatically

if you are making commits through your browser, capitalizing the first letter of the branch name commit message field is browser behavior that you simply need to be careful about

@jebeaudet
Copy link

FWIW I have this project which works on 23.x but does not on 24.x :
package.json

{
    "name": "semantic-release-dependencies",
    "devDependencies": {
        "@semantic-release/commit-analyzer": "^13.0.0",
        "@semantic-release/github": "^10.0.3",
        "@semantic-release/release-notes-generator": "^14.0.1",
        "@terrestris/maven-semantic-release": "^3.0.1",
        "conventional-changelog-conventionalcommits": "^7.0.2",
        "semantic-release": "^24.0.0"
    }
}

.release.rc

{
    "branches": ["main"],
    "plugins": [
      [
        "@semantic-release/commit-analyzer",
        {
          "preset": "conventionalcommits"
        }
      ],
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/github",
        {
          "preset": "conventionalcommits"
        }
      ],
      [
        "@terrestris/maven-semantic-release",
        {
          "settingsPath": "maven_settings.xml"
        }
      ]
    ]
  }

Here is the build run :

$ GH_TOKEN=OMITTED npx semantic-release --no-ci --dry-run=false
[12:29:04 p.m.] [semantic-release] › ℹ  Running semantic-release version 24.0.0
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@terrestris/maven-semantic-release"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "prepare" from "@terrestris/maven-semantic-release"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "publish" from "@terrestris/maven-semantic-release"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "success" from "@terrestris/maven-semantic-release"
[12:29:05 p.m.] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[12:29:08 p.m.] [semantic-release] › ✔  Run automated release from branch main on repository git@github.com:coveo/jacktest.git
[12:29:09 p.m.] [semantic-release] › ✔  Allowed to push to the Git repository
[12:29:09 p.m.] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/github"
[12:29:09 p.m.] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication
[12:29:09 p.m.] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/github"
[12:29:09 p.m.] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@terrestris/maven-semantic-release"
[12:29:09 p.m.] [semantic-release] [@terrestris/maven-semantic-release] › ℹ  Testing if mvn exists
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /opt/homebrew/Cellar/maven/3.9.8/libexec
Java version: 21.0.3, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "14.5", arch: "aarch64", family: "mac"
[12:29:09 p.m.] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@terrestris/maven-semantic-release"
[12:29:09 p.m.] [semantic-release] › ℹ  Found git tag v5.0.0 associated with version 5.0.0 on branch main
[12:29:09 p.m.] [semantic-release] › ℹ  Found 1 commits since last release
[12:29:09 p.m.] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[12:29:09 p.m.] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: feat!: this is breaking
[12:29:09 p.m.] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[12:29:09 p.m.] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 1 commits complete: no release
[12:29:09 p.m.] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[12:29:09 p.m.] [semantic-release] › ℹ  There are no relevant changes, so no new version is released.

@travi
Copy link
Member

travi commented Jul 30, 2024

You need to also upgrade to the latest major version of your preset at the same time

@jebeaudet
Copy link

Argh, so sorry for this useless noise, indeed bumping to "conventional-changelog-conventionalcommits": "^8.0.0" fixes it. Thanks @travi

@travi
Copy link
Member

travi commented Aug 2, 2024

i'm closing this thread as i believe all mentioned situations have solutions. to summarize:

  • make sure that the versions of semantic-release and any extra conventional-changelog packages (likely preset) you install are compatible as there have been recent breaking changes related to these. if you are upgrading to the latest semantic-release, also upgrade to the latest preset version
  • make sure you are following the details of the commit convention you have chosen, whether that is the default angular preset included by default with semantic-release or an alternative you have opted into

@travi travi closed this as completed Aug 2, 2024
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

7 participants