summaryrefslogtreecommitdiffstats
path: root/.github/workflows/updater.yml
blob: 76cb2fdbef9963205dd4edc619bcf048563133a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
name: Updater
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  source-build:
    name: Install, Build & Update
    strategy:
      fail-fast: false
      matrix:
        distro:
          - 'alpine:3.12'
          - 'alpine:3.13'
          - 'archlinux:latest'
          - 'centos:7'
          - 'centos:8'
          - 'clearlinux:latest'
          - 'debian:9'
          - 'debian:10'
          - 'fedora:33'
          - 'fedora:34'
          - 'ubuntu:16.04'
          - 'ubuntu:18.04'
          - 'ubuntu:20.04'
          - 'ubuntu:20.10'
          - 'ubuntu:21.04'
        include:
          - distro: 'alpine:3.12'
            pre: 'apk add -U bash'
          - distro: 'alpine:3.13'
            pre: 'apk add -U bash'
          - distro: 'debian:9'
            pre: 'apt-get update'
          - distro: 'debian:10'
            pre: 'apt-get update'
          - distro: 'ubuntu:16.04'
            pre: 'apt-get update'
          - distro: 'ubuntu:18.04'
            pre: 'apt-get update'
          - distro: 'ubuntu:20.04'
            pre: 'apt-get update'
          - distro: 'ubuntu:20.10'
            pre: 'apt-get update'
          - distro: 'ubuntu:21.04'
            pre: 'apt-get update'
    runs-on: ubuntu-latest
    steps:
      - name: Git clone repository
        uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Install required packages & build tarball
        run: |
          ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
          .github/scripts/build-dist.sh
      - name: Run a dockerised web server to serve files used by the custom update script
        run: |
          docker run -dit --name my-apache-app -p 8080:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
      - name: Replace URLs in updater script to point at the local web server
        run: |
          ORIG_TARBALL="export NETDATA_TARBALL_URL=.*"
          ORIG_CHECKSUM="export NETDATA_TARBALL_CHECKSUM_URL=.*"
          CURRENT_VERSION="current_version=.*"
          NEW_TARBALL="export NETDATA_TARBALL_URL=http://localhost:8080/artifacts/netdata-latest.tar.gz"
          NEW_CHECKSUM="export NETDATA_TARBALL_CHECKSUM_URL=http://localhost:8080/artifacts/sha256sums.txt"
          sed -i "s|${ORIG_TARBALL}|${NEW_TARBALL}|g" packaging/installer/netdata-updater.sh
          sed -i "s|${ORIG_CHECKSUM}|${NEW_CHECKSUM}|g" packaging/installer/netdata-updater.sh
          sed -i "s|"current_version=.*"|"current_version=1"|g" packaging/installer/netdata-updater.sh
      - name: Install netdata and run the updater on ${{ matrix.distro }}
        env:
          PRE: ${{ matrix.pre }}
        run: |
          echo $PRE > ./prep-cmd.sh
          docker build . -f .github/dockerfiles/Dockerfile.build_test -t test --build-arg BASE=${{ matrix.distro }}
          docker run --network host -w /netdata test \
              /bin/sh -c '/netdata/packaging/installer/kickstart.sh --dont-wait \
              && /netdata/packaging/installer/netdata-updater.sh --not-running-from-cron --no-updater-self-update \
              && bash /netdata/.github/scripts/check-updater.sh'