@cryptotaxi247 / netdata-1 / commits / f054c41cb

Update packaging CI to only run a limited set of jobs on PRs. (#12156)

* Update packaging CI to only run a limited set of jobs on PRs. The jobs for architectures other than 64-bit x86 consistently show no issues unless something is broken for that architecture (which also consistently breaks the static build for the same architecture) or that distribution 9which also consistently breaks the 64-bit x86 build for that distribution), so they functionally serve no real purpose when being run on PRs. This commit skips running those jobs on PRs only so that we do not waste resources on them. They can be explicitly run by placing the exact words `actions run all ci` in the PR description directly preceeded by a `/`. This also enables running them on merges to master, which we previously did not do, so that we can still confirm for certain that everything is working. * Fix handling of PR body text.

Austin S. Hemmelgarn committed Feb 21, 2022 at 11:09 UTC f054c41cb21451be21949629b0ee11cdf2f57964
1 file changed +23 -9
.github/workflows/packaging.yml
+23 -9
@@ -6,6 +6,9 @@ on:
6 branches:
7 - master
8 - develop
9 + push:
10 + branches:
11 + - master
12 workflow_dispatch:
13 inputs:
14 type:
@@ -35,27 +38,38 @@ jobs:
38 - name: Read build matrix
39 id: set-matrix
40 shell: python3 {0}
41 + env:
42 + PR_BODY: ${{ github.event.pull_request.body }}
43 run: |
44 from ruamel.yaml import YAML
45 import json
46 + import os
47 + import re
48 + FULL_CI_REGEX = '/actions run full ci'
49 + ALWAYS_RUN_ARCHES = ["amd64"]
50 yaml = YAML(typ='safe')
51 entries = list()
52 + run_limited = False
53
54 with open('.github/data/distros.yml') as f:
55 data = yaml.load(f)
56
57 + if "${{ github.event_name }}" == "pull_request" and re.search(FULL_CI_REGEX, os.environ["PR_BODY"], re.I) is None:
58 + run_limited = True
59 +
60 for i, v in enumerate(data['include']):
61 if 'packages' in data['include'][i]:
62 for arch in data['include'][i]['packages']['arches']:
50 - entries.append({
51 - 'distro': data['include'][i]['distro'],
52 - 'version': data['include'][i]['version'],
53 - 'pkgclouddistro': data['include'][i]['packages']['repo_distro'],
54 - 'format': data['include'][i]['packages']['type'],
55 - 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'],
56 - 'platform': data['platform_map'][arch],
57 - 'arch': arch
58 - })
63 + if arch in ALWAYS_RUN_ARCHES or not run_limited:
64 + entries.append({
65 + 'distro': data['include'][i]['distro'],
66 + 'version': data['include'][i]['version'],
67 + 'pkgclouddistro': data['include'][i]['packages']['repo_distro'],
68 + 'format': data['include'][i]['packages']['type'],
69 + 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'],
70 + 'platform': data['platform_map'][arch],
71 + 'arch': arch
72 + })
73
74 entries.sort(key=lambda k: (k['arch'], k['distro'], k['version']))
75 matrix = json.dumps({'include': entries}, sort_keys=True)