Skip to content

[docs] Explicitly document the expected behavior on on-path-changed when matching git submodules #2032

Open
@aThorp96

Description

@aThorp96

Call out in the on-path-changed documentation that git-submodules are treated as one file and a submodule's files are not in the list of changed files which on-path-changed references.

Since git represents submodules using a single file which points to the repository revision, providers like Github and Gitlab do not enumerate the files changed inside of a submodule in a Pull Request, only that the submodule changed and the revision change:

Image
Image

Similarly, the Git{hub,lab} API returns the sub directory as a file changed with no information about its contents:

Image

This means that when using an on-path-changed expression, we can only check if a submodule changed and now what changed inside of the submodule.

E.g. with the following repo structure

.
├── README.md
└── test-submodule
    └── README.md

if we update test-submodule to a branch which includes new-file like so:

.
├── README.md
└── test-submodule
    ├── README.md
    └── new-file

The following annotation will not match: pipelinesascode.tekton.dev/on-path-change: [test-submodule/new-file], and neither will pipelinesascode.tekton.dev/on-path-change: [test-submodule/**]. We instead have to use pipelinesascode.tekton.dev/on-path-change: [test-submodule] as if it is a file

This make sense when you are aware of how git handles the submodules, Without explicitly mentioning it in the docs it could be considered "undefined" behavior to a user, since the file tree differs on their machine vs in the git API. To add more confusion, using tkn-pac info globbing misleadingly shows that the test-submodule/new-file and test-submodule/** annotations should match:

Image

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions