summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml59
1 files changed, 47 insertions, 12 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 16196342b..2b31cc261 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -32,6 +32,11 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
+ - name: Fix tags
+ id: fix-tags
+ if: github.event_name != 'push'
+ run: |
+ git fetch -f origin ${{ github.ref }}:${{ github.ref }}
- name: Mark Stable
id: channel
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
@@ -40,6 +45,7 @@ jobs:
- name: Build
id: build
run: |
+ git describe
mkdir -p artifacts
./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
autoreconf -ivf
@@ -71,6 +77,7 @@ jobs:
SLACK_MESSAGE: |-
${{ github.repository }}: Failed to create source tarball for distribution.
Checkout: ${{ steps.checkout.outcome }}
+ Fix Tags: ${{ steps.fix-tags.outcome }}
Mark stable: ${{ steps.channel.outcome }}
Build: ${{ steps.build.outcome }}
Store: ${{ steps.store.outcome }}
@@ -80,6 +87,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
build-static: # Build the static binary archives, and store them as artifacts.
@@ -99,6 +107,11 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
+ - name: Fix tags
+ id: fix-tags
+ if: github.event_name != 'push'
+ run: |
+ git fetch -f origin ${{ github.ref }}:${{ github.ref }}
- name: Mark Stable
id: channel
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
@@ -142,6 +155,7 @@ jobs:
SLACK_MESSAGE: |-
${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}.
Checkout: ${{ steps.checkout.outcome }}
+ Fix Tags: ${{ steps.fix-tags.outcome }}
Mark stable: ${{ steps.channel.outcome }}
Build: ${{ steps.build.outcome }}
Store: ${{ steps.store.outcome }}
@@ -151,6 +165,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
matrix: # Generate the shared build matrix for our build tests.
@@ -173,19 +188,32 @@ jobs:
from ruamel.yaml import YAML
import json
yaml = YAML(typ='safe')
+ entries = list()
+
with open('.github/data/distros.yml') as f:
data = yaml.load(f)
- del data['platform_map']
+
for i, v in enumerate(data['include']):
- data['include'][i]['artifact_key'] = data['include'][i]['distro'] + str(data['include'][i]['version']).replace('.', '')
- if 'packages' in data['include'][i]:
- del data['include'][i]['packages']
- if 'base_image' in data['include'][i]:
- data['include'][i]['distro'] = data['include'][i]['base_image']
- del data['include'][i]['base_image']
- data['include'][i]['distro'] = ':'.join([data['include'][i]['distro'], str(data['include'][i]['version'])])
- del data['include'][i]['version']
- matrix = json.dumps(data, sort_keys=True)
+ e = {
+ 'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
+ 'version': v['version'],
+ }
+
+ if 'base_image' in v:
+ e['distro'] = ':'.join([v['base_image'], str(v['version'])])
+ else:
+ e['distro'] = ':'.join([v['distro'], str(v['version'])])
+
+ if 'env_prep' in v:
+ e['env_prep'] = v['env_prep']
+
+ if 'jsonc_removal' in v:
+ e['jsonc_removal'] = v['jsonc_removal']
+
+ entries.append(e)
+
+ entries.sort(key=lambda k: k['distro'])
+ matrix = json.dumps({'include': entries}, sort_keys=True)
print('Generated Matrix: ' + matrix)
print('::set-output name=matrix::' + matrix)
- name: Failure Notification
@@ -207,6 +235,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
@@ -306,6 +335,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
source-build: # Test various source build arrangements.
@@ -378,6 +408,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
updater-check: # Test the generated dist archive using the updater code.
@@ -455,6 +486,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
prepare-upload: # Consolidate the artifacts for uploading or releasing.
@@ -521,6 +553,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
@@ -569,6 +602,7 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
@@ -617,12 +651,13 @@ jobs:
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
+ && github.repository == 'netdata/netdata'
}}
upload-nightly: # Upload the nightly build artifacts to GCS.
name: Upload Nightly Artifacts
runs-on: ubuntu-latest
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly'
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
needs:
- updater-check
- source-build
@@ -690,7 +725,7 @@ jobs:
upload-release: # Create the draft release and upload the build artifacts.
name: Create Release Draft
runs-on: ubuntu-latest
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata'
needs:
- updater-check
- source-build