3.7. 在 Pipelines as Code 中使用私有存储库
Pipelines as Code 通过使用用户令牌在目标命名空间中创建或更新 secret 来支持私有存储库。Tekton Hub 中的 git-clone
任务使用用户令牌来克隆私有存储库。
每当作为代码在目标命名空间中运行时,它会使用 pac-gitauth-<REPOSITORY_OWNER>-<REPOSITORY_NAME>-<RANDOM_STRING>
格式创建或更新 secret。
您必须使用管道运行和管道定义中的 basic-auth
工作区来引用 secret,然后传递给 git-clone
任务。
在管道中,您可以引用 git-clone
任务的 basic-auth
工作区来重复使用:
- 1
git-clone
任务获取basic-auth
工作区,并使用它来克隆私有存储库。
您可以通过在 pipelinesAsCode.settings
spec 中将 TektonConfig
自定义资源的 secret-auto-create
参数设置为 false
或 true
来修改此配置。