首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“使用”语句访问多个存储库

“使用”语句访问多个存储库
EN

Stack Overflow用户
提问于 2022-09-21 10:55:50
回答 1查看 88关注 0票数 0

我正在尝试为依赖关系管理工具修缮创建一个管道

代码语言:javascript
复制
# Runs the renovate bot on a schedule.
# Adapted from: https://blog.objektkultur.de/how-to-setup-renovate-in-azure-devops/

schedules:
  - cron: "0 5 * * *"
    displayName: "Every day at 7am"
    branches:
      include:
        - main
        - master
    always: true

trigger: none

pool:
  vmImage: ubuntu-latest

variables:
  - group: "renovatebot"

steps:
  - checkout: self
    persistCredentials: true
    fetchDepth: 1
    
  - bash: |
      git config --global user.email 'bot@renovateapp.com'
      git config --global user.name 'Renovate Bot'
      echo "TOKEN = $TOKEN"
      echo "GITHUB_COM_TOKEN = $GITHUB_COM_TOKEN"
      npx renovate
    env:
      TOKEN: $(System.AccessToken)
      GITHUB_COM_TOKEN: $(githubtoken) # get a token from https://github.com/settings/tokens and save it in the 'renovatebot' variables group
      #RENOVATE_CONFIG_FILE: "./pipelines/renovate/config.js" # use this environment variable if you prefer to have the renovate pipeline definition and the config file in it's own dictionary instead of the repository root.

它使用System.AccessToken运行GIT命令。这适用于单个回购,但我试图将另一个存储库合并到同一个管道中--但是,我得到了以下错误:

ERROR: Repository is not found (repository=[REDACTED]/[REDACTED])

这使我相信访问第二个存储库存在一些问题。

然后,通过https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#protect-access-to-repositories-in-yaml-pipelines阅读“使用”语句:

代码语言:javascript
复制
steps:
- checkout: git://FabrikamFiber/FabrikamTools # Azure Repos Git repository in the same organization
- script: # Do something with that repo
# Or you can reference it with a uses statement in the job
uses:
  repositories: # List of referenced repositories
  - FabrikamTools # Repository reference to FabrikamTools
steps:
- script: # Do something with that repo like clone it

然而,如果我在蔚蓝中尝试,我会得到一个错误:

我遗漏了什么?“使用”语句的正确用法是什么?

EN

回答 1

Stack Overflow用户

发布于 2022-09-22 09:23:08

“使用”语句的正确用法是什么?

要使用 use:语句,需要在作业级别定义它。

例如:

代码语言:javascript
复制
jobs:
  - job: test
    uses:
     repositories:
       - test
    steps:
      - script:xxx

有关更详细的信息,请参阅下面的doc:jobs.job定义

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73799584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档