diff options
author | Philippe Schenker <philippe.schenker@toradex.com> | 2021-02-18 18:10:11 +0000 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2021-02-19 09:55:51 +0100 |
commit | f13d95a869789c0a5e36c152b7d0f4afe770168b (patch) | |
tree | 5a7d8dba0f10393a7c723b367744619d70bad24c | |
parent | 7ddc2d0b3895ea1cf560e823ec2b302c6425e696 (diff) |
Add license checking in CI
-rw-r--r-- | .gitlab-ci.yml | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e70af0..221b671 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,21 @@ -variables: -# uncomment for the pipeline debug purpose - CI_DEBUG_TRACE: "true" - CI_IMAGE: gitlab.int.toradex.com:4567/philippe.schenker/linux-toradex/ci-kernel-builder:gcc9 - DOCKER_HOST: tcp://docker:2375 - DOCKER_DRIVER: overlay2 - DOCKER_TLS_CERTDIR: "" - stages: - - empty-stub + - check-license -prepare_kernel: - stage: empty-stub - image: $CI_IMAGE +check-license_job: + stage: check-license variables: - GIT_STRATEGY: fetch - GIT_DEPTH: "1" - script: | - echo "Just return true. For now it is too tough to implement a real overlay checking." - echo "It depends on possibly unmerged changes in the corresponding branch of linux kernel." - true - + EXPECTED_LIC_STR: "SPDX-License-Identifier: GPL-2.0-or-later OR MIT" + script: + - cd $CI_PROJECT_DIR/overlays + - | + for DTO in $(ls *dts) + do + head -n 1 $DTO | \ + grep -q "${EXPECTED_LIC_STR}" || \ + ERRMSG="${ERRMSG}License mssing, wrong or not on 1st line: ${DTO} \n" + done + if [ "${ERRMSG}" ] + then + echo -ne $ERRMSG + exit 1 + fi |