Using ssh to push the new tags.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- git, javascript, node.js
Direzione di ricerca
Inizia da @semantic-release/gitlab/lib/verify.js e dal punto di ingresso verifyConditions in index.js, quindi confronta i relativi controlli del token con le indicazioni sull'autenticazione nel README. Riproduci lo scenario del remote SSH e stabilisci se il comportamento richiesto è supportato; il lavoro è completato quando il comportamento o la limitazione è verificato e coperto da un controllo documentato o automatizzato appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm a free user of gitlab.com therefore I don't have access to project/namespace tokens and since I intend on protecting my master branch from being pushed directly I have to resort into deployment tokens.
Steps:
- I created a ssh key
- encoded with base64
- create a file variable with the new encoded base64 string
- adjusted my pipeline to first decode the base64 string from the file and write the private key to ~/.ssh/id_rsa
- from the key above generated the pub key
- changed the remote origin from https:// to [email protected]
- ran git ls-remote to ensure that the key worked.
- in my local environment I used the same key above to push to my protected branch and it works like a charm. As well as to create tags
I have a token set for different pipelines and it still throws the error bellow. My assumption is that the code is checking the origin url and looking for that token? In this case, since I'm using ssh it shouldn't require a token should it for the release creation it would make sense to require that but not for creating the tag itself
If my approach is completely wrong how do I approach this problem without having to keep my master branch open
$ npx semantic-release
[1:29:35 PM] [semantic-release] › ℹ Running semantic-release version 23.1.1
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/gitlab"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/gitlab"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "success" from "./custom-discord-notifier.js"
[1:29:36 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/gitlab"
[1:29:46 PM] [semantic-release] › ✔ Run automated release from branch next on repository [email protected]:redactedDev/redacted-client-26.git
[1:29:47 PM] [semantic-release] › ✔ Allowed to push to the Git repository
[1:29:47 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/changelog"
[1:29:47 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[1:29:47 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[1:29:47 PM] [semantic-release] › ✘ Failed step "verifyConditions" of plugin "@semantic-release/gitlab"
[1:29:47 PM] [semantic-release] › ℹ Start step "fail" of plugin "@semantic-release/gitlab"
[1:29:47 PM] [semantic-release] › ✘ Failed step "fail" of plugin "@semantic-release/gitlab"
[1:29:47 PM] [semantic-release] › ✘ ENOGLTOKEN No GitLab token specified.
A GitLab personal access token (https://github.com/semantic-release/gitlab/blob/master/README.md#gitlab-authentication) must be created and set in the GL_TOKEN or GITLAB_TOKEN environment variable on your CI environment.
Please make sure to create a GitLab personal access token (https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) and to set it in the GL_TOKEN or GITLAB_TOKEN environment variable on your CI environment. The token must allow to push to the repository [email protected] (mailto:[email protected]):redacted/redacted.git.
[1:29:47 PM] [semantic-release] › ✘ ENOGLTOKEN No GitLab token specified.
A GitLab personal access token (https://github.com/semantic-release/gitlab/blob/master/README.md#gitlab-authentication) must be created and set in the GL_TOKEN or GITLAB_TOKEN environment variable on your CI environment.
Please make sure to create a GitLab personal access token (https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) and to set it in the GL_TOKEN or GITLAB_TOKEN environment variable on your CI environment. The token must allow to push to the repository [email protected] (mailto:[email protected]):redactedDev/redacted-client-26.git.
AggregateError:
SemanticReleaseError: No GitLab token specified.
at default (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/lib/get-error.js:6:10)
at default (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/lib/verify.js:54:17)
at verifyConditions (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/index.js:11:9)
at validator (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
at file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/pipeline.js:38:42
at next (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/node_modules/p-reduce/index.js:16:10)
at file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
at async pluginsConfigAccumulator.<computed> [as verifyConditions] (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/index.js:106:3)
at async Module.default (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/index.js:278:22)
at async default (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/cli.js:55:5) {
errors: [
SemanticReleaseError: No GitLab token specified.
at default (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/lib/get-error.js:6:10)
at default (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/lib/verify.js:54:17)
at verifyConditions (file:///builds/redactedDev/redacted-client-26/node_modules/@semantic-release/gitlab/index.js:11:9)
at validator (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
at file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/lib/plugins/pipeline.js:38:42
at next (file:///builds/redactedDev/redacted-client-26/node_modules/semantic-release/node_modules/p-reduce/index.js:16:10) {
code: 'ENOGLTOKEN',
details: 'A [GitLab personal access token](https://github.com/semantic-release/gitlab/blob/master/README.md#gitlab-authentication) must be created and set in the `GL_TOKEN` or `GITLAB_TOKEN` environment variable on your CI environment.\n' +
'\n' +
'Please make sure to create a [GitLab personal access token](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) and to set it in the `GL_TOKEN` or `GITLAB_TOKEN` environment variable on your CI environment. The token must allow to push to the repository [email protected]:redactedDev/redacted-client-26.git.',
semanticRelease: true,
pluginName: '@semantic-release/gitlab'
}
]
}
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit code 1
variables:
project_name: "${CI_PROJECT_TITLE}"
SEMANTIC_RELEASE_PACKAGE: "${project_name}"
GIT_SUBMODULE_STRATEGY: normal
GIT_DEPTH: 0 # Disable shallow cloning for full history
GIT_SUBMODULE_DEPTH: 0
stages:
- semantic_release
semantic_release:
stage: semantic_release
image: node:lts
variables:
# Define GIT_SSH_COMMAND to use the specified SSH key and settings
GIT_SSH_COMMAND: "ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=accept-new"
before_script:
# 1. Create the .ssh directory
- mkdir -p ~/.ssh
# 2. Decode the Base64-encoded SSH key and save it to ~/.ssh/id_rsa
- cat "$DEPLOY_SSH_KEY64" | base64 -d > ~/.ssh/id_rsa
# 3. Generate .pub from our new private key
- ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
# 4. Set the correct permissions for the SSH key
- chmod 600 ~/.ssh/id_rsa
# 5. Add GitLab to known_hosts to prevent host verification prompts
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
# 6. Update the Git remote URL to use SSH instead of HTTPS
- git remote set-url origin "[email protected]:${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git"
# 7. (Optional) Verify that the remote URL has been updated
- git remote -v
script:
- export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=accept-new"
- npm install semantic-release @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/gitlab @semantic-release/npm @semantic-release/release-notes-generator conventional-changelog-conventionalcommits axios
- npx semantic-release
#dependencies:
# - build
# - hash_job
# - collect_and_symstore_job
- Lingua principale
- JavaScript
- Stelle
- 343
- Fork
- 91
- Merge medio
- 1g 54m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di semantic-release/gitlab
-
`useJobToken` verifyConditions omits proxy, so `got` bypasses `HTTPS_PROXY`Forse già presa @ar7bd l’ha presa 9 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
semantic-release/gitlab#1032 ·
-
bug feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
semantic-release/gitlab#891 · 28 commenti · 15 reazioni ·
-
feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
semantic-release/gitlab#857 · 1 reazione ·
-
Autodetect components projectForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertafeature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
semantic-release/gitlab#851 ·
-
feature help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
semantic-release/gitlab#830 · 5 commenti ·
Tutte le issue di semantic-release/gitlab
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
IsmaelMartinez/repo-butler#481 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fabriziosalmi/certmate#1207 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
vllm-project/recipes#1081 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
CommunityToolkit/Aspire#2231 ·
I maintainer di solito rispondono entro 1 giorno
-
[内容纠错] p2-medium-243《The internal body clock》原文缺少段落标号 A–HForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
sallowayma-git/IELTS-practice#232 ·
I maintainer di solito rispondono entro 1 giorno