diff options
author | Thomas Haller <thaller@redhat.com> | 2019-10-02 18:34:54 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-10-02 18:46:36 +0200 |
commit | 3019648b4bc1856b84b904bb4cf02500fe35cb76 (patch) | |
tree | 6c3d361855284a6f0b9aadea6b86723a25b4a333 | |
parent | 10e8f7fdb442db8f0fecf43fef8545e24367ebd5 (diff) | |
download | NetworkManager-3019648b4bc1856b84b904bb4cf02500fe35cb76.tar.gz |
checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master
When opening a merge request from a fork of NetworkManager, then the
pipeline runs with the a checkout of the fork. That means, checkpatch
would compare the branch against "master" (or "nm-x-y" stable branches)
of the fork, instead of upstream.
That doesn't seem too useful. Instead, also add upstream NetworkManager
as git remote, fetch the branches, and use the branches from there as
base for checkpatch.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rwxr-xr-x | contrib/scripts/checkpatch-feature-branch.sh | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 44aa2ed00c..bb38d67548 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,7 +73,7 @@ checkpatch: stage: test script: - date '+%Y%m%d-%H%M%S'; dnf install -y git - - date '+%Y%m%d-%H%M%S'; contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt + - date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt allow_failure: true artifacts: when: on_failure diff --git a/contrib/scripts/checkpatch-feature-branch.sh b/contrib/scripts/checkpatch-feature-branch.sh index 0f37728d9f..72e5903dae 100755 --- a/contrib/scripts/checkpatch-feature-branch.sh +++ b/contrib/scripts/checkpatch-feature-branch.sh @@ -15,6 +15,12 @@ if printf '%s' "$HEAD" | grep -q '\.\.'; then else BASE_REF="refs/remotes/origin/" + if [ "$NM_CHECKPATCH_FETCH_UPSTREAM" == 1 ]; then + git remote add nm-upstream https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git + git fetch nm-upstream || die "failure to fetch from https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git" + BASE_REF="refs/remotes/nm-upstream/" + fi + # the argument is only a single ref (or the default "HEAD"). # Find all commits that branch off one of the stable branches or master # and lead to $HEAD. These are the commits of the feature branch. |