关于 Dependabot 更新
可使用 Dependabot updates 来修复漏洞并将依赖项更新到 GitHub Enterprise Server 中的最新版本。 Dependabot updates 要求 GitHub Actions 设置了自���管运行器供 Dependabot 使用。 Dependabot 警报和安全更新使用通过 GitHub Connect 访问的 GitHub Advisory Database 中的信息。 有关详细信息,请参阅 管理企业中 Dependabot 更新的自托管运行器 和 为企业启用 Dependabot。
默认情况下,Dependabot 可访问公共注册表,你可将 Dependabot 配置为还访问专用注册表。或者,如果实例的 Internet 访问受限或无 Internet 访问,则可以将 Dependabot 配置为仅将专用注册表用作安全更新和版本更新的源。 若要了解哪些生态系统可用作专用注册表,请参阅“删除对公共注册表的 Dependabot 访问权限”。
下面的说明假定你需要在有下列限制的情况下设置 Dependabot 运行器。
- 无 Internet 访问。
- 访问有限的 Internet 资源,例如 Dependabot 的专用注册表。
对于 Dependabot 运行器,Internet 访问受限
在配置 Dependabot 之前,请在自托管运行器上安装 Docker。 有关详细信息,请参阅“管理企业中 Dependabot 更新的自托管运行器”。
-
在 GitHub Enterprise Server 上,导航到
github/dependabot-action
存储库,并从containers.json
文件中检索有关dependabot-updater
和dependabot-proxy
容器映像的信息。在
https://HOSTNAME/github/dependabot-action/blob/ghes-VERSION/docker/containers.json
,GitHub Enterprise Server 的各版本都包含已更新的containers.json
文件。 可在 containers.json 查看文件的 GitHub.com 版本。 -
使用
docker pull
命令将 GitHub Container registry 中的所有容器映像预加载到 Dependabot 运行器上。 或者,预加载dependabot-proxy
映像,然后仅预加载所需生态系统的容器映像。例如,为了支持 npm 和 GitHub Actions,可使用以下命令,复制
containers.json
文件中要加载的映像的详细信息来确保每个映像都有正确版本和 SHA。docker pull ghcr.io/github/dependabot-update-job-proxy/dependabot-update-job-proxy:VERSION@SHA docker pull ghcr.io/dependabot/dependabot-updater-github-actions:VERSION@SHA docker pull ghcr.io/dependabot/dependabot-updater-npm:VERSION@SHA
注意
如果升级到 GitHub Enterprise Server 的新次要版本,或者通过 GitHub.com 手动更新 Dependabot 操作,需要重复此步骤。 有关详细信息,请参阅“手动从 GitHub.com 同步操作”。
-
将这些映像添加到运行器后,就可限制对 Dependabot 运行器的 Internet 访问,确保它仍可访问所需生态系统和 GitHub Enterprise Server 的专用注册表。
必须先添加映像,因为在 Dependabot 作业���始运行时,Dependabot 运行器会从 GitHub Container registry 拉取
dependabot-updater
和dependabot-proxy
。
验证 Dependabot 运行器的配置
-
对于测试存储库,请将 Dependabot 配置为访问专用注册表并移除对公共注册表的访问权限。 有关详细信息,请参阅 为 Dependabot 配置对专用注册表的访问权限 和 删除对公共注册表的 Dependabot 访问权限。
-
在存储库的“见解”选项卡中,单击“依赖项关系图”以显示依赖项的详细信息��
-
单击 Dependabot 来显示为版本更新配置的生态系统。
-
对于要测试的生态系统,请单击“上次检查时间”来显示“更新日志”视图。
-
单击“检查更新”来检查该生态系统依赖项的新更新。
更新检查完成后,应检查“更新日志”视图,验证 Dependabot 是否访问了实例上配置的专用注册表来检查版本更新。
确认配置正确后,要求存储库管理员将其 Dependabot 配置更新为仅使用专用注册表。 有关详细信息,请参阅“删除对公共注册表的 Dependabot 访问权限”。