semantic-release / semantic-release/gitlab
Failing (?) feature "allow adding URLs to release assets"
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 344
- Forks
- 89
- Avg merge
- 16h 11m
- Merged PRs (30d)
- 4
Description
Current behavior
As of version 9.3.0 its possible to add urls to assets for linking to docker registry or other artifact storages.
Unfortunately I cant get this feature to work for me.
The URL to be used is given in my .releaserc.yml., but the pipeline fails (see at the bottom of this issue).
If I run the command manually (curl) (copied from the logs):
curl --request POST \
--url https://gitlab.com/api/v4/projects/36721546/releases \
--header 'Content-Type: application/json' \
--header 'PRIVATE-TOKEN: <token>' \
--data '{
"tag_name": "v1.0.0",
"description": "# 1.0.0 (2022-06-03)\n\n\n### Features\n\n* add url to release ([da40fc9](https://zzz/commit/da40c9e1606dc3e27f090ef13f51985bb))\n\n\n\n",
"assets": {
"links": [
{
"url": "https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md"
}
]
}
}'
I get an error: "error": "assets[links][0][name] is missing" wich is understandable due to the fact that assets:links:name is required if a assets:links:url is given (see here(docs))
Expected behavior
Is there anything in my configuration not correct or is there a bug in this feature?
I tried adding the name variable in my .releaserc.yml but it would not go into the request:
- - "@semantic-release/gitlab"
- assets:
- url: https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md
name: "some name"
Environment
- semantic-release version: 19.0.2
- CI environment: gitlab ci with
node:lts-alpinebase image - Plugins used:
- npm install -g semantic-release@19 @semantic-release/changelog@6 @semantic-release/exec@6 @semantic-release/git@10 @semantic-release/gitlab@9 @semantic-release/npm@9 @saithodev/semantic-release-backmerge@2
- semantic-release configuration:
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
#- - "@semantic-release/exec"
# - prepareCmd: $CI_PROJECT_DIR/.m2/prepare.sh ${nextRelease.version}
# publishCmd: $CI_PROJECT_DIR/.m2/publish.sh
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- "**/*pom.xml"
- - "@semantic-release/gitlab"
- assets:
- url: https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md
# As discussed in this issue: https://github.com/semantic-release/semantic-release/issues/1603 there is no support for GitFlow.
# If we would like to stick to kinda GitFlow (with prerelease/develop), we will have to use this community plugin or merge back by ourselves.
- - "@saithodev/semantic-release-backmerge"
- branches:
- from: main
to: prerelease
branches:
- main
- +([0-9])?(.{+([0-9]),x}).x
- name: prerelease
prerelease: rc
- CI logs:
[7:53:34 AM] [semantic-release] › ℹ Start step "publish" of plugin "@semantic-release/gitlab"
2022-06-03T07:53:34.910Z semantic-release:gitlab repoId: 'kaerbr/semantic-release-test'
2022-06-03T07:53:34.910Z semantic-release:gitlab release name: 'v1.0.0'
2022-06-03T07:53:34.910Z semantic-release:gitlab release ref: '38320e22e6ea7ac172d1b85a37bc765b2948075d'
2022-06-03T07:53:34.910Z semantic-release:gitlab milestones: undefined
2022-06-03T07:53:34.911Z semantic-release:gitlab url assets: [ { url: 'https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md' } ]
2022-06-03T07:53:34.911Z semantic-release:gitlab globbed assets: []
2022-06-03T07:53:34.912Z semantic-release:gitlab all assets: [ { url: 'https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md' } ]
2022-06-03T07:53:34.913Z semantic-release:gitlab use link from release setting: https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md
2022-06-03T07:53:34.913Z semantic-release:gitlab Create a release for git tag 'v1.0.0' with commit '38320e22e6ea7ac172d1b85a37bc765b2948075d'
2022-06-03T07:53:34.914Z semantic-release:gitlab POST-ing the following JSON to https://gitlab.com/api/v4/projects/kaerbr%2Fsemantic-release-test/releases:
{
"tag_name": "v1.0.0",
"description": "# 1.0.0 (2022-06-03)\n\n\n### Features\n\n* add url to release ([da40fc9](https://gitlab.com/kaerbr/semantic-release-test/commit/da40fc9e16a06dbbc3e27f0b90be9f13f51985bb))\n\n\n\n",
"assets": {
"links": [
{
"url": "https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md"
}
]
}
}
[7:53:35 AM] [semantic-release] [@semantic-release/gitlab] › ✖ An error occurred while making a request to the GitLab release API:
HTTPError: Response code 400 (Bad Request)
at Request.<anonymous> (/usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:118:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1654242814917,
socket: 1654242814918,
lookup: 1654242814918,
connect: 1654242814928,
secureConnect: 1654242814940,
upload: 1654242814940,
response: 1654242815095,
end: 1654242815096,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: 0,
tcp: 10,
tls: 12,
request: 0,
firstByte: 155,
download: 1,
total: 179
}
}
}
[7:53:35 AM] [semantic-release] › ✖ Failed step "publish" of plugin "@semantic-release/gitlab"
[7:53:35 AM] [semantic-release] › ✖ An error occurred while running semantic-release: HTTPError: Response code 400 (Bad Request)
at Request.<anonymous> (/usr/local/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise/index.js:118:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1654242814917,
socket: 1654242814918,
lookup: 1654242814918,
connect: 1654242814928,
secureConnect: 1654242814940,
upload: 1654242814940,
response: 1654242815095,
end: 1654242815096,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: 0,
tcp: 10,
tls: 12,
request: 0,
firstByte: 155,
download: 1,
total: 179
}
},
pluginName: '@semantic-release/gitlab'
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the @semantic-release/gitlab asset-handling entry point and trace how the configured URL asset becomes the GitLab release API payload. Reproduce the configuration from the issue, then add regression coverage showing whether the link name is preserved and the request satisfies GitLab's required fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gitlab, javascript
- Domain
- release
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100