Dependabot 集成正式发布

2024 年 1 月 23 日 - @joshspicer

我们很高兴地宣布,即日起,通过与 Dependabot 团队的合作,devcontainers 软件包生态系统现已正式发布!Dependabot 现在能够更新您公开的 Dev Container 功能 (Features),使其保持在最新发布版本。

要启用此功能,请在包含一个或多个 devcontainer.json 配置文件及对应的存储库中添加一个 .github/dependabot.yml 文件。

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://githubdocs.cn/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
  - package-ecosystem: "devcontainers" # See documentation for possible values
    directory: "/"
    schedule:
      interval: weekly

配置完成后,Dependabot 将开始创建拉取请求 (pull requests) 以更新您的 Dev Container 功能。

Dependabot PR

下面展示了由 Dependabot 生成的一个示例差异 (diff):

---
 .devcontainer-lock.json              | 8 ++++----
 .devcontainer.json                   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.devcontainer-lock.json b/.devcontainer-lock.json
index 324582b..a3868d9 100644
--- a/.devcontainer-lock.json
+++ b/.devcontainer-lock.json
@@ -1,9 +1,9 @@
 {
   "features": {
-    "ghcr.io/devcontainers/features/docker-in-docker:1": {
-      "version": "1.0.9",
-      "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:b4c04ba88371a8ec01486356cce10eb9fe8274627d8d170aaec87ed0d333080d",
-      "integrity": "sha256:b4c04ba88371a8ec01486356cce10eb9fe8274627d8d170aaec87ed0d333080d"
+    "ghcr.io/devcontainers/features/docker-in-docker:2": {
+      "version": "2.7.1",
+      "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:f6a73ee06601d703db7d95d03e415cab229e78df92bb5002e8559bcfc047fec6",
+      "integrity": "sha256:f6a73ee06601d703db7d95d03e415cab229e78df92bb5002e8559bcfc047fec6"
     }
   }
 }
\ No newline at end of file
diff --git a/.devcontainer.json b/.devcontainer.json
index e9d9af5..9eb9165 100644
--- a/.devcontainer.json
+++ b/.devcontainer.json
@@ -1,6 +1,6 @@
 {
     "image": "mcr.microsoft.com/devcontainers/base:jammy",
     "features": {
-        "ghcr.io/devcontainers/features/docker-in-docker:1": {}
+        "ghcr.io/devcontainers/features/docker-in-docker:2": {}
     }
 }

此更新程序可确保公开访问的功能在关联的 devcontainer.json 文件中锁定为最新版本。如果开发容器有关联的锁文件 (lockfile),该文件也会被更新。有关锁文件的更多信息,请参阅此规范

任何有效开发容器位置中的功能都将在同一个拉取请求中进行更新。

GitHub.com 上的所有存储库均可免费使用 Dependabot 版本更新。欲了解更多信息,请参阅 Dependabot 版本更新文档