Allow checking out any ref in gitutils
Also changes so that shallow fetch is performed even when a specific ref is specified. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
c6e78b9c5f
commit
48ba755c3b
@ -74,12 +74,12 @@ pre-packaged tarball contexts and plain text files.
|
|||||||
### Git repositories
|
### Git repositories
|
||||||
|
|
||||||
When the `URL` parameter points to the location of a Git repository, the
|
When the `URL` parameter points to the location of a Git repository, the
|
||||||
repository acts as the build context. The system recursively clones the
|
repository acts as the build context. The system recursively fetches the
|
||||||
repository and its submodules using a `git clone --depth 1 --recursive`
|
repository and its submodules. The commit history is not preserved. A
|
||||||
command. This command runs in a temporary directory on your local host. After
|
repository is first pulled into a temporary directory on your local host. After
|
||||||
the command succeeds, the directory is sent to the Docker daemon as the
|
the that succeeds, the directory is sent to the Docker daemon as the context.
|
||||||
context. Local clones give you the ability to access private repositories using
|
Local copy gives you the ability to access private repositories using local
|
||||||
local user credentials, VPN's, and so forth.
|
user credentials, VPN's, and so forth.
|
||||||
|
|
||||||
> **Note:**
|
> **Note:**
|
||||||
> If the `URL` parameter contains a fragment the system will recursively clone
|
> If the `URL` parameter contains a fragment the system will recursively clone
|
||||||
@ -87,8 +87,9 @@ local user credentials, VPN's, and so forth.
|
|||||||
|
|
||||||
Git URLs accept context configuration in their fragment section, separated by a
|
Git URLs accept context configuration in their fragment section, separated by a
|
||||||
colon `:`. The first part represents the reference that Git will check out,
|
colon `:`. The first part represents the reference that Git will check out,
|
||||||
this can be either a branch, a tag, or a commit SHA. The second part represents
|
this can be either a branch, a tag, or a remote reference. The second part
|
||||||
a subdirectory inside the repository that will be used as a build context.
|
represents a subdirectory inside the repository that will be used as a build
|
||||||
|
context.
|
||||||
|
|
||||||
For example, run this command to use a directory called `docker` in the branch
|
For example, run this command to use a directory called `docker` in the branch
|
||||||
`container`:
|
`container`:
|
||||||
@ -105,12 +106,11 @@ Build Syntax Suffix | Commit Used | Build Context Used
|
|||||||
`myrepo.git` | `refs/heads/master` | `/`
|
`myrepo.git` | `refs/heads/master` | `/`
|
||||||
`myrepo.git#mytag` | `refs/tags/mytag` | `/`
|
`myrepo.git#mytag` | `refs/tags/mytag` | `/`
|
||||||
`myrepo.git#mybranch` | `refs/heads/mybranch` | `/`
|
`myrepo.git#mybranch` | `refs/heads/mybranch` | `/`
|
||||||
`myrepo.git#abcdef` | `sha1 = abcdef` | `/`
|
`myrepo.git#pull/42/head` | `refs/pull/42/head` | `/`
|
||||||
`myrepo.git#:myfolder` | `refs/heads/master` | `/myfolder`
|
`myrepo.git#:myfolder` | `refs/heads/master` | `/myfolder`
|
||||||
`myrepo.git#master:myfolder` | `refs/heads/master` | `/myfolder`
|
`myrepo.git#master:myfolder` | `refs/heads/master` | `/myfolder`
|
||||||
`myrepo.git#mytag:myfolder` | `refs/tags/mytag` | `/myfolder`
|
`myrepo.git#mytag:myfolder` | `refs/tags/mytag` | `/myfolder`
|
||||||
`myrepo.git#mybranch:myfolder` | `refs/heads/mybranch` | `/myfolder`
|
`myrepo.git#mybranch:myfolder` | `refs/heads/mybranch` | `/myfolder`
|
||||||
`myrepo.git#abcdef:myfolder` | `sha1 = abcdef` | `/myfolder`
|
|
||||||
|
|
||||||
|
|
||||||
### Tarball contexts
|
### Tarball contexts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user