github 自动化 git clone azure-devops

Staggerlee011

尝试将第二个 github(私有)存储库下载到 azure-devops 的构建管道中。但是有问题。MS“github下载发布”任务似乎有一个与下载标签相关的错误(它成功完成但下载了0个文件等)。一直试图通过 bash、ssh、pat 来完成它,但无法找到一种无需手动输入密码或需要某种干预即可下载任务的方法。

有没有人有关于如何从具有涉及 0 用户交互的特定标签的私人 github 下载的步骤/指南?

Levi Lu-MSFT

如果您的管道是经典 UI 管道。您可以通过运行 git 命令添加要从您的私有 github 下载的脚本任务。请参阅以下步骤:

经典流水线

1,变量选项卡中创建变量usernamepassword(将变量类型更改为密码的秘密)

如果您的密码或用户名包含@,请将其替换为 %40

在此处输入图片说明

2、添加一个powershell任务来运行内联git clone命令:

git config --global advice.detachedHead  false

git clone -b mytag --depth 1 https://$(username):$(password)@github.com/mygitaccount/myrepo.git -q

然后你的私有 github 仓库将被下载到文件夹中$(system.defaultworkingdirectory)/myrepo

Yaml 管道

如果您使用的是 Yaml 管道。除了上述在脚本任务中运行 git 命令的解决方法外,您还可以使用存储库资源检出步骤。

首先,您需要创建一个github 服务连接(例如MyPrivateRepoConnection在下面的示例中)以连接到您的 azure 组织的私有 github 存储库。

然后在 yaml 管道中定义存储库资源和检出步骤。见下面的例子:

resources:
  repositories:
  - repository: privaterepo
    type: github
    name: myorg/myrepo
    ref: refs/tags/mytag
    endpoint: MyPrivateRepoConnection

steps:
- checkout: self #checkout the self source code of this pipeline
- checkout: privaterepo #checkout private repo

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Azure Devops-构建自动化

用于自动化Azure DevOps管道的API?

在Azure DevOps中自动化多个生成/发布

自动化发布管道的创建Azure Devops

VSTS(Azure Devops)的ssh -T成功认证,但git clone失败

将Github Git存储库迁移到Azure DevOps TFVC

我们如何在Azure Devops中自动化服务连接创建过程

在Azure Devops管道上针对Flutter运行集成测试以进行UI自动化测试

如何从 Azure Devops 连接 Amazon RDS SQL 以实现数据库自动化

在Azure Devops中使用Powershell自动化Connect-AzureAD

如何使用 Azure DevOps 在 CI 管道中按特定顺序运行自动化脚本?

使用git,当从github进行pull / clone / fetching时如何自动格式化

使用git clone命令从azure devops中检出多个存储库时出错

当 Azure 测试计划中的自动化测试失败时,如何在 DevOps 中自动创建错误

Azure 管道构建公共 github 项目,管道 yaml 存储在 Azure Devops Git 中

自动化Azure部署

Azure自动化Powershell

Azure 自动化特权

Azure Pipelines (DevOps) Selenium 自动化浏览器在内存中无头运行导致错误

是否可以使用VS Code将自动化测试与Azure DevOps中的测试用例相关联?

Github Actions和git clone问题

Azure 自动化 - 无法删除-AzResourceLock

Azure自动化:调用URL

Azure自动化Get-AzureRmStorageAccountKey

Azure自动化计划未保存

Azure 灯塔 - 跨租户自动化

Azure自动化-无法获得AzRoleAssignement

Azure 自动化中的 PostgreSQL 规则

我正在尝试自动化git clone请求,压缩结果,并将旧副本覆盖到全部由一个操作运行的副本