Skip to content

Commit

Permalink
gitlab: Use $CI_DEFAULT_BRANCH instead of hardcoded 'master'
Browse files Browse the repository at this point in the history
We want to skip the checkpatch and DCO signoff jobs when
pushing to the default branch. Currently this branch is
called 'master', but we don't need to hardcode this in
the CI configuration, because the $CI_DEFAULT_BRANCH
env variable exposes it.

References:

- https://sfconservancy.org/news/2020/jun/23/gitbranchname/
- https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/

Suggested-by: Savitoj Singh <savsingh@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210525153826.4174157-1-philmd@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
  • Loading branch information
philmd committed May 27, 2021
1 parent f56bf4c commit 1f88fad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.d/static_checks.yml
Expand Up @@ -6,7 +6,7 @@ check-patch:
script: .gitlab-ci.d/check-patch.py
except:
variables:
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
GIT_DEPTH: 1000
allow_failure: true
Expand All @@ -19,6 +19,6 @@ check-dco:
script: .gitlab-ci.d/check-dco.py
except:
variables:
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
GIT_DEPTH: 1000

0 comments on commit 1f88fad

Please sign in to comment.