diff --git a/content/build/building/context.md b/content/build/building/context.md index 3cabf3b7bd03..c89aaef96dba 100644 --- a/content/build/building/context.md +++ b/content/build/building/context.md @@ -207,7 +207,7 @@ clone a specific branch, tag, and subdirectory of a repository. The format of the URL fragment is `#ref:dir`, where: -- `ref` is the name of the branch, tag, or remote reference +- `ref` is the name of the branch, tag, or commit hash - `dir` is a subdirectory inside the repository For example, the following command uses the `container` branch, @@ -231,6 +231,15 @@ contexts: | `myrepo.git#mytag:myfolder` | `refs/tags/mytag` | `/myfolder` | | `myrepo.git#mybranch:myfolder` | `refs/heads/mybranch` | `/myfolder` | +When you use a commit hash as the `ref` in the URL fragment, use the full, +40-character string SHA-1 hash of the commit. A short hash, for example a hash +truncated to 7 characters, is not supported. + +```text +✅ 05d2d74403d23d99daf70f4eb4fc0ff16cae7f1a +❌ 05d2d74 +``` + #### Keep `.git` directory By default, BuildKit doesn't keep the `.git` directory when using Git contexts.