Skip to content

Commit 869aedb

Browse files
author
Konstantin Semenov
committed
docs: Explain the reasoning behind and workaround for read/write resource separation
Signed-off-by: Konstantin Semenov <[email protected]>
1 parent 0a2b7d7 commit 869aedb

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Tracks the commits in a [git](http://git-scm.com/) repository.
77
* `uri`: *Required.* The location of the repository.
88

99
* `branch`: The branch to track. This is *optional* if the resource is
10-
only used in `get` steps; however, it is *required* when used in a `put` step. If unset for `get`, the repository's default branch is used; usually `master` but [could be different](https://help.github.com/articles/setting-the-default-branch/).
10+
only used in `get` steps; however, it is *required* either here, or in the `put` step, when used in a `put` step. If unset for `get`, the repository's default branch is used; usually `master` but [could be different](https://help.github.com/articles/setting-the-default-branch/).
1111

1212
* `private_key`: *Optional.* Private key to use when pulling/pushing.
1313
Example:
@@ -302,6 +302,19 @@ Push the checked-out reference to the source's URI and branch. All tags are
302302
also pushed to the source. If a fast-forward for the branch is not possible
303303
and the `rebase` parameter is not provided, the push will fail.
304304

305+
#### Important note
306+
307+
Due to the way [resources are cached in Concourse](https://medium.com/concourse-ci/concourse-resource-volume-caching-7f4eb73be1a6),
308+
any commits produced by the `put` step will appear in _ALL_ git resources with the
309+
_exact_ same `source` configuration across _ALL_ pipelines, across _ALL_ teams in the
310+
Concourse instance, even if the branch name in `put` step is different from the one
311+
specified `source.branch`.
312+
313+
Therefore, it is recommended to use a separate git resource to use in the `put`
314+
steps, such that its configuration is different from all the git resources used
315+
in `get` steps. E.g. set `source.commit_filter.exclude` to something like
316+
`[ "this resource is used for pushing new changes" ]`.
317+
305318
#### Parameters
306319

307320
* `repository`: *Required.* The path of the repository to push to the source.
@@ -342,7 +355,8 @@ pushed regardless of the upstream state.
342355

343356
Note that the version produced by the `put` step will be picked up by subsequent `get` steps
344357
even if the `branch` differs from the `branch` specified in the source.
345-
To avoid this, you should use two resources of read-only and write-only.
358+
To avoid this, you should use two resources of read-only and write-only with differing `source`
359+
configurations. See [this note](#important-note) for further details.
346360

347361
* `refs_prefix`: *Optional.* Allows pushing to refs other than heads. Defaults to `refs/heads`.
348362

0 commit comments

Comments
 (0)