diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index 58952a32e311f461a699c81e67827cfdb8c9bb49..71df1cb80cdfa6674774eadf2e55ffeeb5b5e362 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -202,6 +202,23 @@ apt_repo_ubuntu_current: ARCHITECTURES: amd64 GNUPGHOME: $CI_PROJECT_DIR/.gnupg +oc.lintian_debian: + image: debian:bookworm + stage: publishing_tests + tags: + - gcp + needs: + - oc.build-debian + dependencies: + - oc.build-debian + before_script: + - . ./scripts/version.sh + - export DEBIAN_FRONTEND=noninteractive + - apt-get update + - apt-get install lintian -y + script: + - ./scripts/ci/lintian_debian_packages.sh debian bookworm + oc.install_bin_debian_bookworm: image: debian:bookworm stage: publishing_tests @@ -213,6 +230,23 @@ oc.install_bin_debian_bookworm: script: - ./docs/introduction/install-bin-deb.sh debian bookworm +oc.lintian_ubuntu: + image: public.ecr.aws/lts/ubuntu:20.04_stable + stage: publishing_tests + tags: + - gcp + needs: + - oc.build-ubuntu + dependencies: + - oc.build-ubuntu + before_script: + - . ./scripts/version.sh + - export DEBIAN_FRONTEND=noninteractive + - apt-get update + - apt-get install lintian -y + script: + - ./scripts/ci/lintian_debian_packages.sh ubuntu jammy focal + oc.install_bin_ubuntu_focal: image: public.ecr.aws/lts/ubuntu:20.04_stable stage: publishing_tests diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index 700c93e7d3c030f320551c1d875f76bf09c6990c..44725c3855584594c2262659bf725686bedb7f83 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -101,6 +101,23 @@ apt_repo_debian_current: ARCHITECTURES: amd64 GNUPGHOME: $CI_PROJECT_DIR/.gnupg +oc.lintian_debian: + image: debian:bookworm + stage: publishing_tests + tags: + - gcp + needs: + - oc.build-debian + dependencies: + - oc.build-debian + before_script: + - . ./scripts/version.sh + - export DEBIAN_FRONTEND=noninteractive + - apt-get update + - apt-get install lintian -y + script: + - ./scripts/ci/lintian_debian_packages.sh debian bookworm + oc.install_bin_debian_bookworm: image: debian:bookworm stage: publishing_tests diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index 1cac7847ff00a8d08afc25003b5494c217fd8d53..54ca636a59919964854847730120ddb3ee0cf184 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -204,10 +204,34 @@ let jobs pipeline_type = ~stage:Stages.publishing_tests script in + let job_lintian ~__POS__ ~name ~dependencies ~image ?allow_failure script = + job + ?allow_failure + ~__POS__ + ~name + ~image + ~dependencies + ~stage:Stages.publishing_tests + ~before_script: + (before_script + ~source_version:true + [ + "export DEBIAN_FRONTEND=noninteractive"; + "apt-get update"; + "apt-get install lintian -y"; + ]) + script + in let test_current_ubuntu_packages_jobs = (* in merge pipelines we tests only debian. release pipelines test the entire matrix *) [ + job_lintian + ~__POS__ + ~name:"oc.lintian_ubuntu" + ~dependencies:(Dependent [Artifacts job_build_ubuntu_package]) + ~image:Images.ubuntu_focal + ["./scripts/ci/lintian_debian_packages.sh ubuntu jammy focal"]; job_install_bin ~__POS__ ~name:"oc.install_bin_ubuntu_focal" @@ -224,6 +248,12 @@ let jobs pipeline_type = in let test_current_debian_packages_jobs = [ + job_lintian + ~__POS__ + ~name:"oc.lintian_debian" + ~dependencies:(Dependent [Artifacts job_build_debian_package]) + ~image:Images.debian_bookworm + ["./scripts/ci/lintian_debian_packages.sh debian bookworm"]; job_install_bin ~__POS__ ~name:"oc.install_bin_debian_bookworm" diff --git a/scripts/ci/lintian_debian_packages.sh b/scripts/ci/lintian_debian_packages.sh new file mode 100755 index 0000000000000000000000000000000000000000..b90a6f1e68ff80a15004a48c1e43f9a4ff06449d --- /dev/null +++ b/scripts/ci/lintian_debian_packages.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -u + +if [ $# -lt 2 ]; then + cat << EOF +Usage: $0 + + +: The linux distribution, eg. debian or ubuntu + +: The release of the Linux distribution, e.g. 'jammy', 'focal', 'bookworm'. +This argument can be repeated to build for multiple releases. + +This script will fail with exitcode 1 if lintian finds any errors. + +EOF + exit 1 +fi + +# Array to store failed files +FAILED_FILES=() + +# Set trap to catch errors and store the failing file +trap 'FAILED_FILES+=("$file")' ERR + +# The linux distribution for which we are creating the apt repository +# E.g. 'ubuntu' or 'debian' +DISTRIBUTION=${1} +shift +# The release of the linux distribution for which +# we are creating the apt repository +# E.g. 'jammy focal', 'bookworm' +RELEASES=$* + +for release in $RELEASES; do # unstable, jammy, focal ... + for file in packages/"${DISTRIBUTION}/${release}"/*.deb; do + echo "Lintian package $file" + lintian "$file" --tag-display-limit 0 --verbose --allow-root + done +done + +if [ ${#FAILED_FILES[@]} -ne 0 ]; then + echo "Lintian check failed for the following files:" + for file in "${FAILED_FILES[@]}"; do + echo "- $file" + done + exit 1 +else + echo "All clean" + exit 0 +fi diff --git a/scripts/packaging/build-deb-local.sh b/scripts/packaging/build-deb-local.sh index 60174954b852a34b60652b44d778debba008fc93..7d110db930fc01c1037b11065c06e4d8ce98de40 100755 --- a/scripts/packaging/build-deb-local.sh +++ b/scripts/packaging/build-deb-local.sh @@ -29,4 +29,8 @@ cd - echo "All packages are available in ./scripts/packaging" -lintian scripts/packaging/octez-*.deb --tag-display-limit 0 --verbose +# Run lintian only if building packages locally. +# On the CI we have a specific job for it +if [ -z "${CI:-}" ]; then + lintian scripts/packaging/octez-*.deb --tag-display-limit 0 --verbose +fi