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

Changelog links are incorrect for selfhosted gitlab (default setup) since 6.0.0 #384

Open
escapedcat opened this issue Jun 18, 2019 · 15 comments
Labels

Comments

@escapedcat
Copy link
Member

escapedcat commented Jun 18, 2019

This is not a duplicate of #204. We have standard self-hosted Gitlab server running.

With 5.0.2 we get this output on an fresh repo with npm init and adding standard-version@5.0.2 only:

./node_modules/.bin/standard-version --dry-run
✔ bumping version in package.json from 1.0.0 to 1.1.0
✔ bumping version in package-lock.json from 1.0.0 to 1.1.0
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
# 1.1.0 (2019-06-17)


### Bug Fixes

* remove node_modules ([613feb1](https://gitlab.company.net/myusername/changelogtest/commit/613feb1))


### Features

* add inital npm setup ([9d33dfb](https://gitlab.company.net/myusername/changelogtest/commit/9d33dfb))
* add standard-version v5.0.2 ([a09dc1c](https://gitlab.company.net/myusername/changelogtest/commit/a09dc1c))
---

After installing 6.0.0 (or 6.0.1) like this:

npm i standard-version@6.0.0

We now get broken links:

./node_modules/.bin/standard-version --dry-run
✔ bumping version in package.json from 1.0.0 to 1.1.0
✔ bumping version in package-lock.json from 1.0.0 to 1.1.0
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## 1.1.0 (2019-06-17)


### Bug Fixes

* remove node_modules ([613feb1](https://gitlab.company.net///commit/613feb1))


### Features

* add inital npm setup ([9d33dfb](https://gitlab.company.net///commit/9d33dfb))
* add standard-version v5.0.2 ([a09dc1c](https://gitlab.company.net///commit/a09dc1c))
---

I know 6.0.0 introduced breaking changes but I couldn't find something related to this after skimming over the commits and changes since 5.0.2.

Do you have any idea or tipps in what direction I could research?
This issue only appears with a self-hosted Gitlab instance. I tried the same with a repo from the public Github and Gitlab services and both work. I'm confused.

Update:
Another thing I noticed. Using conventional-changelog-cli the changelog is being generated correctly.

./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0
cat CHANGELOG.md

CHANGELOG.md:

# 1.0.0 (2019-06-18)


### Bug Fixes

* remove node_modules ([613feb1](https://gitlab.company.net/myusername/changelogtest/commit/613feb1))


### Features

* add inital npm setup ([9d33dfb](https://gitlab.company.net/myusername/changelogtest/commit/9d33dfb))
* add standard-version v5.0.2 ([a09dc1c](https://gitlab.company.net/myusername/changelogtest/commit/a09dc1c))
@jbottigliero
Copy link
Member

@escapedcat I believe what you are hitting is how the new conventionalcommits preset handles formatting messages... which could mean an issue with the actual preset itself.

You can swap the preset back to angular and you should get the same behavior you've posted in your update (switching to conventionalcommits as the default was part of the breaking change). You can do this by package.json, .versionrc, or command-line argument.

@bcoe
Copy link
Member

bcoe commented Jun 24, 2019

@escapedcat @jbottigliero to me this suggests that {{user}} isn't being passed to the template, I don't think this is a problem with the new preset, as much with a bug with how these variables are propagating.

@bcoe bcoe added the bug label Jun 24, 2019
@escapedcat
Copy link
Member Author

Sorry for not getting back yet. I'm still up for trying what @jbottigliero suggested and give feedback on this. Will do as soon as I find some time.

@chapati23
Copy link

We're seeing the exact same issue. Is there a way to fix this without downgrading to v5.x?

@chapati23
Copy link

chapati23 commented Aug 14, 2019

Upon further inspection, it seems that ssh git URLs are broken.

This used to work (in package.json):

{
  "repository": {
    "url": "git@git.mygitlab.sh:groupname/reponame.git"
  }
}

in the latest standard-version i have to change this to:

{
  "repository": {
    "url": "https://git.mygitlab.sh/groupname/reponame"
  }
}

Which isn't nice because we're in fact not allowing http urls for our git origins.

@gabemeola
Copy link

gabemeola commented Oct 1, 2019

I notice this happens depending on the git origin url (also self hosted).

With git remote set-url https://gitlab.mycompany.com/tools/project.git

# standard-version --no-verify --dry-run
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## 1.1.0 (2019-10-01)


### Bug Fixes

* disable gitlab release while having issues publishing ([339926a](https://gitlab.mycompany.com/tools/project/commit/339926a))
* remove entrypoint ([628b24a](https://gitlab.mycompany.com/tools/project/commit/628b24a))
* remove image after push ([e73644b](https://gitlab.mycompany.com/tools/project/commit/e73644b))
---

✔ committing CHANGELOG.md
✔ tagging release v1.1.0
ℹ Run `git push --follow-tags origin master` to publish

With git remote set-url git@gitlab.mycompany.com:tools/project.git

# standard-version --no-verify --dry-run
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## 1.1.0 (2019-10-01)


### Bug Fixes

* disable gitlab release while having issues publishing ([339926a](https://gitlab.mycompany.com///commit/339926a))
* remove entrypoint ([628b24a](https://gitlab.mycompany.com///commit/628b24a))
* remove image after push ([e73644b](https://gitlab.mycompany.com///commit/e73644b))
---

✔ committing CHANGELOG.md
✔ tagging release v1.1.0
ℹ Run `git push --follow-tags origin master` to publish

@smutel
Copy link

smutel commented Oct 11, 2019

Same behavior on my side ...

@smzelek
Copy link

smzelek commented Oct 16, 2019

I have identified the issue. It occurs in this deeply nested NPM dependency: hosted-git-info. I encountered the same issue. I opened an Issue in their repo. Maybe a maintainer of Standard Version could help by opening an MR to them, or using a different dependency?

npm/hosted-git-info#54

Dependency chain of the issue is:

standard-version changelog.js -> conventional-changelog index.js -> conventional-changelog-core merge-config.js -> get-pkg-repo index.js -> hosted-git-info index.js

I actually have no idea where to report this issue since it goes so deep. Essentially, all along the way, a GitHub URL is being assumed. Gitlab allows subgroups and this totally breaks the repository url parsing code. This is not a user issue at all -- the code doesn't even handle the case gracefully. Instead you end up with that triple /// in your CHANGELOG url because the tooling returns a null string in the config needed by conventional-changelog-conventionalcommits package.

conventional-changelog-angular\templates\header.hbs references properties like,

  • @root.owner
  • @root.repository
  • @root.repoUrl

which all are null because of the failure to parse.

@smzelek
Copy link

smzelek commented Oct 16, 2019

I know the OP says it's not the case, but I do believe this is a duplicate of #204 and I am not sure that #204 was ever actually resolved...

@svewag
Copy link

svewag commented Nov 11, 2019

@gabemeola I can confirm that switching from git@gitlab.mycompany.com to https://gitlab.mycompany.com fixed the links in the README.

@t-heuser
Copy link

t-heuser commented Jul 1, 2020

I'm also getting this error on a self hosted gitlab instance. Switching the url like @svewag propesed doesn't work. Would be great if someone could take care of it.
Edit: i tried version 7.1 and 8.0 of standard-version and the bug appears in both versions.

@eraytufan
Copy link

eraytufan commented Aug 31, 2020

I have the same problem, and updating the URL in package.json didn't solve the problem for me. Is there any new information about the issue?

@kvernon
Copy link

kvernon commented Sep 10, 2020

We might be running into the same thing. Our DevOps team is needing ssh and it fails for our self hosted. Are there ways around this?

@eraytufan
Copy link

Hi @kvernon, if you want to fix the links before tagging, you can give arguments to standard-version so that it won't commit and tag new version automatically. After the versioning finishes, you can fix your links, commit and tag yourself. I know it's not a solution but might work as a workaround.

@smutel
Copy link

smutel commented Sep 11, 2020

As a workaround, you can create a file called .versionrc at the root of your project with:

{
  "types":[
    {
      "type":"enh",
      "section":"Enhancements"
    },
    {
      "type":"feat",
      "section":"Features"
    },
    {
      "type":"fix",
      "section":"Bug Fixes"
    },
    {
      "type":"test",
      "section":"Tests"
    },
    {
      "type":"build",
      "section":"Build System"
    },
    {
      "type":"ci",
      "hidden":true
    },
    {
      "type":"git",
      "hidden":true
    }
  ],
  "commitUrlFormat": "https://xxx/yyy/commit/{{hash}}",
  "compareUrlFormat": "https://xxx/yyy/compare/{{previousTag}}...{{currentTag}}",
  "issueUrlFormat": "https://xxx/yyy/issues/{{id}}",
  "userUrlFormat": "https://xxx/gitlab/{{user}}"
}

Where xxx is the URL to your gitlab and yyy the path to the project.

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

No branches or pull requests