From 215a93d14bba44ecbff17207cf29d3cea096262d Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 20 Feb 2025 15:24:13 +0100 Subject: [PATCH 1/2] packages: add systemd baker tests --- .../ci/pipelines/debian_repository_full.yml | 3 +- .../pipelines/debian_repository_partial.yml | 3 +- .../debian_repository_partial_auto.yml | 3 +- ci/bin/debian_repository.ml | 2 +- docs/introduction/install-bin-deb.sh | 17 ----- .../packaging/tests/deb/install-bin-deb.sh | 74 +++++++++++++++++++ 6 files changed, 81 insertions(+), 21 deletions(-) create mode 100755 scripts/packaging/tests/deb/install-bin-deb.sh diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index 450ced3e09cc..1561400e41aa 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -617,7 +617,8 @@ oc.install_bin_debian_bookworm-systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-deb.sh images/packages/debian-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/deb/install-bin-deb.sh + images/packages/debian-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index 26d2d77b078e..48d74e36ec6c 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -374,7 +374,8 @@ oc.install_bin_debian_bookworm-systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-deb.sh images/packages/debian-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/deb/install-bin-deb.sh + images/packages/debian-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml index 0a4ded6597ea..bcbf46a3904c 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml @@ -374,7 +374,8 @@ oc.install_bin_debian_bookworm-systemd: before_script: - ./scripts/ci/docker_initialize.sh script: - - ./scripts/ci/systemd-packages-test.sh docs/introduction/install-bin-deb.sh images/packages/debian-systemd-tests.Dockerfile + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/deb/install-bin-deb.sh + images/packages/debian-systemd-tests.Dockerfile services: - docker:${DOCKER_VERSION}-dind variables: diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index d85b7fbcf23b..9d61265fed7c 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -475,7 +475,7 @@ let jobs pipeline_type = ]) [ "./scripts/ci/systemd-packages-test.sh \ - docs/introduction/install-bin-deb.sh \ + scripts/packaging/tests/deb/install-bin-deb.sh \ images/packages/debian-systemd-tests.Dockerfile"; ]; ] diff --git a/docs/introduction/install-bin-deb.sh b/docs/introduction/install-bin-deb.sh index 04a0f532fdb8..b361c0fdea03 100755 --- a/docs/introduction/install-bin-deb.sh +++ b/docs/introduction/install-bin-deb.sh @@ -162,18 +162,6 @@ fi apt-get install -y octez-client apt-get install -y octez-node -# If systemd is available we test the service scripts -if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then - systemctl enable octez-node - systemctl start octez-node - - sleep 5 - systemctl status octez-node - - journalctl -xeu octez-node.service - -fi - apt-get install -y octez-baker apt-get install -y octez-dal-node @@ -192,11 +180,6 @@ octez-node --version "octez-baker-$protocol" --version "octez-accuser-$protocol" --version -# If systemd is available we test the service scripts -if [ "$(ps --no-headers -o comm 1)" = "systemd" ]; then - systemctl stop octez-node -fi - # [test autopurge] apt-get autopurge -y octez-node octez-client octez-baker octez-dal-node diff --git a/scripts/packaging/tests/deb/install-bin-deb.sh b/scripts/packaging/tests/deb/install-bin-deb.sh new file mode 100755 index 000000000000..f30a024dde7a --- /dev/null +++ b/scripts/packaging/tests/deb/install-bin-deb.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +set -eu +set -x + +REPO="https://storage.googleapis.com/$GCP_LINUX_PACKAGES_BUCKET/$CI_COMMIT_REF_NAME" +DISTRO=$1 +RELEASE=$2 + +# For the upgrade script in the CI, we do not want debconf to ask questions +export DEBIAN_FRONTEND=noninteractive + +apt-get update +apt-get install -y sudo gpg curl apt-utils debconf-utils procps jq + +sudo curl "$REPO/$DISTRO/octez.asc" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/octez.gpg + +# [add next repository] +repository="deb $REPO/$DISTRO $RELEASE main" +echo "$repository" | sudo tee /etc/apt/sources.list.d/octez-next.list +sudo apt-get update + +# [ preeseed octez ] +if [ -z "$PREFIX" ]; then + # preseed octez-node for debconf. Notice we set purge_warning to yes, + # to make the `autopurge` pass and remove all the node data at the end of this + # script. + cat << EOF > preseed.cfg +octez-node octez-node/configure boolean true +octez-node octez-node/history-mode string rolling +octez-node octez-node/network string ghostnet +octez-node octez-node/purge_warning boolean true +octez-node octez-node/snapshot-import boolean true +octez-node octez-node/snapshot-no-check boolean true +debconf debconf/frontend select Noninteractive +EOF + # preseed the package + sudo debconf-set-selections preseed.cfg + + # check the package configuration + sudo debconf-get-selections | grep octez +fi + +sudo apt-get install -y octez-baker + +sudo systemctl enable octez-node +sudo systemctl start octez-node.service +sudo systemctl status octez-node.service + +# give some time to the node to create the identity +# otherwise the octez-client call below will give an error +sleep 20 + +sudo su tezos -c "octez-client gen keys alice" +key=$(sudo su tezos -c "octez-client show address alice" | grep Hash: | awk '{ print $2 }') +echo "BAKER_KEY=$key" >> /etc/default/octez-baker-active + +sudo systemctl enable octez-baker-active +sudo systemctl start octez-baker-active.service +sudo systemctl status octez-baker-active.service + +sudo su tezos -c "octez-node config show" + +echo "-----------------------" +cat /etc/default/octez-node + +echo "-----------------------" +cat /etc/default/octez-baker-active + +echo "-----------------------" +tail /var/log/tezos/node.log + +echo "-----------------------" +tail /var/log/tezos/baker-active.log -- GitLab From 3db9b30f068359aa6e7564289fe8317f1d66ec9c Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Fri, 21 Feb 2025 10:52:03 +0100 Subject: [PATCH 2/2] packages: add ubuntu systemd tests --- .../ci/pipelines/debian_repository_full.yml | 26 +++++++++++++++++++ ci/bin/debian_repository.ml | 18 +++++++++++++ 2 files changed, 44 insertions(+) diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index 1561400e41aa..314749d30811 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -699,3 +699,29 @@ oc.upgrade_bin_ubuntu_jammy: timeout: 60 minutes script: - ./docs/introduction/upgrade-bin-deb.sh ubuntu jammy + +oc.install_bin_ubuntu_noble_systemd: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 + stage: publishing_tests + tags: + - gcp + needs: + - oc.docker-systemd_tests-debian + - apt_repo_ubuntu + dependencies: [] + timeout: 60 minutes + before_script: + - ./scripts/ci/docker_initialize.sh + script: + - ./scripts/ci/systemd-packages-test.sh scripts/packaging/tests/deb/install-bin-deb.sh + images/packages/debian-systemd-tests.Dockerfile + services: + - docker:${DOCKER_VERSION}-dind + variables: + DOCKER_VERSION: 24.0.7 + FLAVOUR: systemd-tests + DEP_IMAGE: ${GCP_REGISTRY}/$CI_PROJECT_NAMESPACE/tezos/$FLAVOUR-$DISTRIBUTION-$RELEASE + DEP_IMAGE_PROTECTED: ${GCP_PROTECTED_REGISTRY}/tezos/tezos/$FLAVOUR-$DISTRIBUTION-$RELEASE + PREFIX: "" + DISTRIBUTION: ubuntu + RELEASE: noble diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index 9d61265fed7c..f8dc4b44c395 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -432,6 +432,24 @@ let jobs pipeline_type = (Dependent [Job job_apt_repo_ubuntu_old; Job job_apt_repo_ubuntu]) ~image:Images.ubuntu_jammy ["./docs/introduction/upgrade-bin-deb.sh ubuntu jammy"]; + job_install_systemd_bin + ~__POS__ + ~name:"oc.install_bin_ubuntu_noble_systemd" + ~dependencies: + (Dependent + [ + Job job_docker_systemd_test_debian_dependencies; + Job job_apt_repo_ubuntu; + ]) + ~variables: + (variables + ~kind:"systemd-tests" + [("PREFIX", ""); ("DISTRIBUTION", "ubuntu"); ("RELEASE", "noble")]) + [ + "./scripts/ci/systemd-packages-test.sh \ + scripts/packaging/tests/deb/install-bin-deb.sh \ + images/packages/debian-systemd-tests.Dockerfile"; + ]; ] in let test_debian_packages_jobs = -- GitLab