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

     1  #!/bin/sh
     2  
     3  docker ps
     4  image="$(docker ps --filter ancestor=jrei/systemd-centos:8 --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      # Import the Grafana GPG key
    15      rpm --import https://packages.grafana.com/gpg.key
    16  
    17      # Install loki and check it's running
    18      rpm -i ${dir}/dist/loki-*.x86_64.rpm
    19      [ "\$(systemctl is-active loki)" = "active" ] || (echo "loki is inactive" && exit 1)
    20  
    21      # Install promtail and check it's running
    22      rpm -i ${dir}/dist/promtail-*.x86_64.rpm
    23      [ "\$(systemctl is-active promtail)" = "active" ] || (echo "promtail is inactive" && exit 1)
    24  
    25      # Write some logs
    26      mkdir -p /var/log/
    27      echo "blablabla" > /var/log/test.log
    28  
    29      # Install logcli
    30      rpm -i ${dir}/dist/logcli-*.x86_64.rpm
    31  
    32      # Check that there are labels
    33      sleep 5
    34      labels_found=\$(logcli labels)
    35      echo "Found labels: \$labels_found"
    36      [ "\$labels_found" != "" ] || (echo "no labels found with logcli" && exit 1)
    37  EOF