depentabot.yml中的环境变量?

发布于 2025-01-28 18:48:14 字数 1316 浏览 4 评论 0 原文

我正在尝试设置 dependabot-standalone 在私人实例中。

这是一个NPM软件包,我正在使用私人NPM注册表来获取我的依赖关系。根据 docs ,我应该在<<<<中设置我的注册表访问数据代码> .gitlab/disterabot.yml 文件。

docs 用于 distrabot.yml 中的设置清楚地说明如何设置凭证以访问给定注册表:

registries:
  npm-npmjs:
    type: npm-registry
    url: https://registry.npmjs.org
    username: octocat
    password: ${{secrets.MY_NPM_PASSWORD}}  # Must be an unencoded password
registries:
  npm-github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{secrets.MY_GITHUB_PERSONAL_TOKEN}}

但仅用于与project 秘密在Github中使用是否有一种方法可以使用GitLab的自定义定义的CI/CD变量?

到目前为止,我已经尝试使用 $ {{CI_PRIVATE_NPM_ACCESS_TOKEN}}} }

I'm trying to set up dependabot-standalone to run in a GitLab-CI pipeline in a private instance.

It's an npm package and I'm using a private npm registry to fetch my dependencies from. According to the docs, I should set up my registry access data within the .gitlab/dependabot.yml file.

The docs for settings in dependabot.yml clearly say how to set up the credentials to access a given registry:

registries:
  npm-npmjs:
    type: npm-registry
    url: https://registry.npmjs.org
    username: octocat
    password: ${{secrets.MY_NPM_PASSWORD}}  # Must be an unencoded password
registries:
  npm-github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{secrets.MY_GITHUB_PERSONAL_TOKEN}}

But only for its use in GitHub with project secrets. Is there a way to use GitLab's custom defined CI/CD variables instead?

So far I have unsuccessfully tried to use ${{CI_PRIVATE_NPM_ACCESS_TOKEN}} and ${CI_PRIVATE_NPM_ACCESS_TOKEN}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七婞 2025-02-04 18:48:14

我认为 npm-login-nononintractive 在这种情况下可能会有所帮助。

job-name:
  script:
    - npm install -g npm-login-noninteractive
    - NPM_USER=testUser NPM_PASS=testPass [email protected] NPM_REGISTRY=your.npm.com npm-login-noninteractive

其他可能有用的答案,在这里:如何使用“ NPM登录”设置NPM凭据,而无需从stdin中阅读?


根据此,您需要在gitlab中设置以下环境变量:

  • settings_github_access_token
  • settings__gitlab_access_token

以在Gitlab中设置这些变量,以:gitlab to:project -&gt;&gt;设置 - &GT; CI/CD-&GT;变量。

I think npm-login-noninteractive could be helpful in this case.

job-name:
  script:
    - npm install -g npm-login-noninteractive
    - NPM_USER=testUser NPM_PASS=testPass [email protected] NPM_REGISTRY=your.npm.com npm-login-noninteractive

Other possible useful answers, here: How to set npm credentials using `npm login` without reading from stdin?


According to this example, you need to set the following environment variables within GitLab:

  • SETTINGS__GITHUB_ACCESS_TOKEN
  • SETTINGS__GITLAB_ACCESS_TOKEN

To set these variables at the project level, within GitLab go to: Project -> Settings -> CI/CD -> Variables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文