From 21852b3cc695a7328cf5dc8ef68cd464f37e55ad Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 19 May 2019 22:13:06 +0200 Subject: [PATCH] CI: verify sources when ci:skip-build (!371) Instead of simply skipping the build check, when ci:skip-build is in the last commit message (in brackets), download the sources and verify their checksums. Depends: pmbootstrap!1788 --- .gitlab-ci/build_changed_aports.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci/build_changed_aports.py b/.gitlab-ci/build_changed_aports.py index 1997f7685..edd9f701e 100755 --- a/.gitlab-ci/build_changed_aports.py +++ b/.gitlab-ci/build_changed_aports.py @@ -32,7 +32,7 @@ def run_pmbootstrap(parameters): process = subprocess.Popen(cmd) process.communicate() if process.returncode != 0: - print("** Building failed") + print("** Test failed") exit(1) @@ -114,11 +114,16 @@ def get_changed_packages(): return ret -def check_build(packages): +def check_build(packages, verify_only=False): # Initialize build environment with less logging run_pmbootstrap(["build_init"]) - run_pmbootstrap(["--details-to-stdout", "build", "--strict", "--force"] + - list(packages)) + + if verify_only: + run_pmbootstrap(["--details-to-stdout", "checksum", "--verify"] + + list(packages)) + else: + run_pmbootstrap(["--details-to-stdout", "build", "--strict", + "--force"] + list(packages)) if __name__ == "__main__": @@ -130,15 +135,15 @@ if __name__ == "__main__": # Get and print modified packages packages = get_changed_packages() - # Stop here if desired - if commit_message_has_string("[ci:skip-build]"): - print("WARNING: not building changed packages ([ci:skip-build])!") - exit(0) - # Build changed packages get_changed_packages_sanity_check(len(packages)) if len(packages) == 0: print("no aports changed in this branch") else: - print("building in strict mode: " + ", ".join(packages)) - check_build(packages) + verify_only = commit_message_has_string("[ci:skip-build]") + if verify_only: + print("WARNING: not building changed packages ([ci:skip-build])!") + print("verifying checksums: " + ", ".join(packages)) + else: + print("building in strict mode: " + ", ".join(packages)) + check_build(packages, verify_only)