github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/tools/packaging/verify-deb-install.sh (about)

     1  #!/bin/sh
     2  
     3  docker ps
     4  image="$(docker ps --filter ancestor=jrei/systemd-debian:12 --latest --format "{{.ID}}")"
     5  echo "Running on container: ${image}"
     6  
     7  dir="."
     8  if [ -n "${CI}" ]; then
     9      dir="/drone/src"
    10  fi
    11  echo "Running on directory: ${dir}"
    12  
    13  cat <<EOF | docker exec --interactive "${image}" sh
    14      # Install loki and check it's running
    15      dpkg -i ${dir}/dist/loki_*_amd64.deb
    16      [ "\$(systemctl is-active loki)" = "active" ] || (echo "loki is inactive" && exit 1)
    17  
    18      # Install promtail and check it's running
    19      dpkg -i ${dir}/dist/promtail_*_amd64.deb
    20      [ "\$(systemctl is-active promtail)" = "active" ] || (echo "promtail is inactive" && exit 1)
    21  
    22      # Write some logs
    23      mkdir -p /var/log/
    24      echo "blablabla" > /var/log/test.log
    25  
    26      # Install logcli
    27      dpkg -i ${dir}/dist/logcli_*_amd64.deb
    28  
    29      # Check that there are labels
    30      sleep 5
    31      labels_found=\$(logcli labels)
    32      echo "Found labels: \$labels_found"
    33      [ "\$labels_found" != "" ] || (echo "no logs found with logcli" && exit 1)
    34  EOF