diff options
author | Dong Zhang <dong.zhang@bmw.de> | 2022-03-23 10:47:45 +0100 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2022-04-25 15:05:48 -0700 |
commit | 79b6252370568926e69610f752f2c2618a557341 (patch) | |
tree | 50e6e9df95d28bdc3daab0fe6c4bc4c981ba5faa /tests/fixtures/layouts | |
parent | 58b195b583f5eadba7924fa6becce313ef05b1dd (diff) | |
download | zuul-79b6252370568926e69610f752f2c2618a557341.tar.gz |
Fix bug in getting changed files
The fix including 2 parts:
1. For Gtihub, we use the base_sha instead of target branch to
be passed as "tosha" parameter to get precise changed files
2. In method getFilesChanges(), use diff() result to filter out
those files that changed and reverted between commits.
The reason we do not direcly use diff() is that for those
drivers other than github, the "base_sha" is not available yet,
using diff() may include unexpected files when target branch
has diverged from the feature branch.
This solution works for 99.9% of the caseses, it may still get
incorrect list of changed files in following corner case:
1. In non-github connection, whose base_sha is not implented, and
2. Files changed and reverted between commits in the change, and
3. The same file has also diverged in target branch.
The above corner case can be fixed by making base_sha available in
other drivers.
Change-Id: Ifae7018a8078c16f2caf759ae675648d8b33c538
Diffstat (limited to 'tests/fixtures/layouts')
-rw-r--r-- | tests/fixtures/layouts/files-github.yaml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/fixtures/layouts/files-github.yaml b/tests/fixtures/layouts/files-github.yaml index ed053f989..88d979ca4 100644 --- a/tests/fixtures/layouts/files-github.yaml +++ b/tests/fixtures/layouts/files-github.yaml @@ -17,8 +17,15 @@ - .*-requires run: playbooks/project-test1.yaml +- job: + name: project-test2 + files: + - .*-removed + run: playbooks/project-test1.yaml + - project: name: org/project check: jobs: - project-test1 + - project-test2 |