@cryptotaxi247 / netdata-1 / commits / acf37621f

Remove code relying on autotools. (#16634)

Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>

vkalintiris committed Dec 20, 2023 at 15:53 UTC acf37621fcc7fa36c0356ddf399a9562a687af69
4 files changed +1 -322
.github/workflows/dashboard-pr.yml
+1 -1
@@ -25,7 +25,7 @@ jobs:
25 - name: Update Files
26 id: update
27 run: |
28 - web/gui/bundle_dashboard_v1.py ${{ github.event.inputs.dashboard_version }}
28 + web/gui/cmake_dashboard_v1.py ${{ github.event.inputs.dashboard_version }}
29 - name: Create Pull Request
30 id: pr
31 uses: peter-evans/create-pull-request@v5
web/gui/bundle_dashboard_v1.py deleted
-131
@@ -1,131 +0,0 @@
1 -#!/usr/bin/env python3
2 -#
3 -# Copyright: © 2021 Netdata Inc.
4 -# SPDX-License-Identifier: GPL-3.0-or-later
5 -'''Bundle the v1 dashboard code into the agent repo.
6 -
7 - This is designed to be run as part of a GHA workflow, but will work fine outside of one.'''
8 -
9 -import os
10 -import shutil
11 -import subprocess
12 -import sys
13 -
14 -from pathlib import Path
15 -
16 -os.chdir(Path(__file__).parent.absolute())
17 -
18 -BASEPATH = Path('v1')
19 -
20 -URLTEMPLATE = 'https://github.com/netdata/dashboard/releases/download/{0}/dashboard.tar.gz'
21 -
22 -MAKEFILETEMPLATE = '''
23 -# Auto-generated by bundle_dashboard.py
24 -# Copyright: © 2021 Netdata Inc.
25 -# SPDX-License-Identifier: GPL-3.0-or-later
26 -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
27 -
28 -dist_noinst_DATA = \\
29 - $(srcdir)/README.md
30 -
31 -dist_web_DATA = \\
32 - {0} \\
33 - $(NULL)
34 -
35 -webv1dir=$(webdir)/v1
36 -
37 -dist_webv1_DATA = \\
38 - index.html \\
39 - $(NULL)
40 -
41 -webcssdir=$(webdir)/css
42 -dist_webcss_DATA = \\
43 - {1} \\
44 - $(NULL)
45 -
46 -webfontsdir=$(webdir)/fonts
47 -dist_webfonts_DATA = \\
48 - {2} \\
49 - $(NULL)
50 -
51 -webimagesdir=$(webdir)/images
52 -dist_webimages_DATA = \\
53 - {3} \\
54 - $(NULL)
55 -
56 -weblibdir=$(webdir)/lib
57 -dist_weblib_DATA = \\
58 - {4} \\
59 - $(NULL)
60 -
61 -webstaticcssdir=$(webdir)/static/css
62 -dist_webstaticcss_DATA = \\
63 - {5} \\
64 - $(NULL)
65 -
66 -webstaticjsdir=$(webdir)/static/js
67 -dist_webstaticjs_DATA = \\
68 - {6} \\
69 - $(NULL)
70 -
71 -webstaticmediadir=$(webdir)/static/media
72 -dist_webstaticmedia_DATA = \\
73 - {7} \\
74 - $(NULL)
75 -'''
76 -
77 -
78 -def copy_dashboard(tag):
79 - '''Fetch and bundle the dashboard code.'''
80 - print('Preparing target directory')
81 - shutil.rmtree(BASEPATH)
82 - BASEPATH.mkdir()
83 - print('::group::Fetching dashboard release tarball')
84 - subprocess.check_call('curl -L -o dashboard.tar.gz ' + URLTEMPLATE.format(tag), shell=True)
85 - print('::endgroup::')
86 - print('::group::Extracting dashboard release tarball')
87 - subprocess.check_call('tar -xvzf dashboard.tar.gz -C ' + str(BASEPATH) + ' --strip-components=1', shell=True)
88 - print('::endgroup::')
89 - print('Copying README.md')
90 - BASEPATH.joinpath('README.md').symlink_to('../.dashboard-notice.md')
91 - print('Removing dashboard release tarball')
92 - BASEPATH.joinpath('..', 'dashboard.tar.gz').unlink()
93 -
94 -
95 -def genfilelist(path):
96 - '''Generate a list of files for the Makefile.'''
97 - files = [f for f in path.iterdir() if f.is_file() and f.name != 'README.md']
98 - files = [Path(*f.parts[1:]) for f in files]
99 - files.sort()
100 - return ' \\\n '.join([("$(srcdir)/" + str(f)) for f in files])
101 -
102 -
103 -def write_makefile():
104 - '''Write out the makefile for the dashboard code.'''
105 - print('Generating Makefile')
106 - MAKEFILEDATA = MAKEFILETEMPLATE.format(
107 - genfilelist(BASEPATH),
108 - genfilelist(BASEPATH.joinpath('css')),
109 - genfilelist(BASEPATH.joinpath('fonts')),
110 - genfilelist(BASEPATH.joinpath('images')),
111 - genfilelist(BASEPATH.joinpath('lib')),
112 - genfilelist(BASEPATH.joinpath('static', 'css')),
113 - genfilelist(BASEPATH.joinpath('static', 'js')),
114 - genfilelist(BASEPATH.joinpath('static', 'media')),
115 - )
116 -
117 - BASEPATH.joinpath('Makefile.am').write_text(MAKEFILEDATA)
118 -
119 -
120 -def list_changed_files():
121 - '''Create a list of changed files, and set it in an environment variable.'''
122 - if 'GITHUB_ENV' in os.environ:
123 - print('Generating file list for commit.')
124 - subprocess.check_call('echo "COMMIT_FILES<<EOF" >> $GITHUB_ENV', shell=True)
125 - subprocess.check_call('git status --porcelain=v1 --no-renames --untracked-files=all | rev | cut -d \' \' -f 1 | rev >> $GITHUB_ENV', shell=True)
126 - subprocess.check_call('echo "EOF" >> $GITHUB_ENV', shell=True)
127 -
128 -
129 -copy_dashboard(sys.argv[1])
130 -write_makefile()
131 -list_changed_files()
web/gui/bundle_dashboard_v2.py deleted
-138
@@ -1,138 +0,0 @@
1 -#!/usr/bin/env python3
2 -#
3 -# Copyright: © 2023 Netdata Inc.
4 -# SPDX-License-Identifier: GPL-3.0-or-later
5 -'''Bundle the v2 dashboard code into the agent repo.
6 -
7 - This is designed to be run as part of a GHA workflow, but will work fine outside of one.'''
8 -
9 -import os
10 -import shutil
11 -import subprocess
12 -
13 -from pathlib import Path
14 -
15 -os.chdir(Path(__file__).parent.absolute())
16 -
17 -BASEDIR = 'v2'
18 -
19 -BASEPATH = Path(BASEDIR)
20 -
21 -TMPPATH = Path('tmp')
22 -
23 -URLSRC = 'https://app.netdata.cloud/agent.tar.gz'
24 -
25 -MAKEFILETEMPLATE = '''
26 -# Auto-generated by bundle_dashboard_v2.py
27 -# Copyright: © 2023 Netdata Inc.
28 -# SPDX-License-Identifier: GPL-3.0-or-later
29 -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
30 -
31 -dist_noinst_DATA = \\
32 - $(srcdir)/README.md
33 -
34 -webv2dir=$(webdir)/v2
35 -
36 -dist_webv2_DATA = \\
37 - {0} \\
38 - $(NULL)
39 -
40 -webv2staticdir=$(webv2dir)/static
41 -dist_webv2static_DATA = \\
42 - {1} \\
43 - $(NULL)
44 -
45 -webv2staticemailimgdir=$(webv2staticdir)/email/img
46 -dist_webv2staticemailimg_DATA = \\
47 - {2} \\
48 - $(NULL)
49 -
50 -webv2staticimgdir=$(webv2staticdir)/img
51 -dist_webv2staticimg_DATA = \\
52 - {3} \\
53 - $(NULL)
54 -
55 -webv2staticimglogososdir=$(webv2staticimgdir)/logos/os
56 -dist_webv2staticimglogosos_DATA = \\
57 - {4} \\
58 - $(NULL)
59 -
60 -webv2staticimglogosservicesdir=$(webv2staticimgdir)/logos/services
61 -dist_webv2staticimglogosservices_DATA = \\
62 - {5} \\
63 - $(NULL)
64 -
65 -webv2staticimgmaildir=$(webv2staticimgdir)/mail
66 -dist_webv2staticimgmail_DATA = \\
67 - {6} \\
68 - $(NULL)
69 -
70 -webv2staticsitepagesholding503dir=$(webv2staticdir)/site/pages/holding-page-503
71 -dist_webv2staticsitepagesholding503_DATA = \\
72 - {7} \\
73 - $(NULL)
74 -'''
75 -
76 -
77 -def copy_dashboard():
78 - '''Fetch and bundle the dashboard code.'''
79 - print('Preparing target directory')
80 - shutil.rmtree(BASEPATH)
81 - TMPPATH.mkdir()
82 - print('::group::Fetching dashboard release tarball')
83 - subprocess.check_call(f'curl -L -o agent.tar { URLSRC }', shell=True)
84 - print('::endgroup::')
85 - print('::group::Extracting dashboard release tarball')
86 - subprocess.check_call(f"tar -xvf agent.tar -C { TMPPATH } --strip-components=1 --exclude='*.br' --exclude='*.gz'", shell=True)
87 - print('::endgroup::')
88 - print('Copying files')
89 - (TMPPATH / 'agent' / BASEDIR).rename(BASEPATH)
90 - (TMPPATH / 'agent' / 'index.html').rename(Path('./index.html'))
91 - (TMPPATH / 'agent' / 'registry-access.html').rename('./registry-access.html')
92 - (TMPPATH / 'agent' / 'registry-alert-redirect.html').rename('./registry-alert-redirect.html')
93 - (TMPPATH / 'agent' / 'registry-hello.html').rename('./registry-hello.html')
94 - shutil.copytree(TMPPATH / 'agent' / 'static', Path('./static'), dirs_exist_ok=True)
95 - shutil.rmtree(TMPPATH)
96 - print('Copying README.md')
97 - BASEPATH.joinpath('README.md').symlink_to('../.dashboard-v2-notice.md')
98 - print('Removing dashboard release tarball')
99 - BASEPATH.joinpath('..', 'agent.tar').unlink()
100 -
101 -
102 -def genfilelist(path):
103 - '''Generate a list of files for the Makefile.'''
104 - files = [f for f in path.iterdir() if f.is_file() and f.name != 'README.md']
105 - files = [Path(*f.parts[1:]) for f in files]
106 - files.sort()
107 - return ' \\\n '.join([("$(srcdir)/" + str(f)) for f in files])
108 -
109 -
110 -def write_makefile():
111 - '''Write out the makefile for the dashboard code.'''
112 - print('Generating Makefile')
113 - MAKEFILEDATA = MAKEFILETEMPLATE.format(
114 - genfilelist(BASEPATH),
115 - genfilelist(BASEPATH.joinpath('static')),
116 - genfilelist(BASEPATH.joinpath('static', 'email', 'img')),
117 - genfilelist(BASEPATH.joinpath('static', 'img')),
118 - genfilelist(BASEPATH.joinpath('static', 'img', 'logos', 'os')),
119 - genfilelist(BASEPATH.joinpath('static', 'img', 'logos', 'services')),
120 - genfilelist(BASEPATH.joinpath('static', 'img', 'mail')),
121 - genfilelist(BASEPATH.joinpath('static', 'site', 'pages', 'holding-page-503')),
122 - )
123 -
124 - BASEPATH.joinpath('Makefile.am').write_text(MAKEFILEDATA)
125 -
126 -
127 -def list_changed_files():
128 - '''Create a list of changed files, and set it in an environment variable.'''
129 - if 'GITHUB_ENV' in os.environ:
130 - print('Generating file list for commit.')
131 - subprocess.check_call('echo "COMMIT_FILES<<EOF" >> $GITHUB_ENV', shell=True)
132 - subprocess.check_call('git status --porcelain=v1 --no-renames --untracked-files=all | rev | cut -d \' \' -f 1 | rev >> $GITHUB_ENV', shell=True)
133 - subprocess.check_call('echo "EOF" >> $GITHUB_ENV', shell=True)
134 -
135 -
136 -copy_dashboard()
137 -write_makefile()
138 -list_changed_files()
web/gui/cmake_dashboard_v2.py
-52
@@ -33,58 +33,6 @@ CMAKETEMPLATE = '''
33 install(FILES {7} DESTINATION usr/share/netdata/web/v2/static/site/pages/holding-page-503)
34 '''
35
36 -MAKEFILETEMPLATE = '''
37 -# Auto-generated by bundle_dashboard_v2.py
38 -# Copyright: © 2023 Netdata Inc.
39 -# SPDX-License-Identifier: GPL-3.0-or-later
40 -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
41 -
42 -dist_noinst_DATA = \\
43 - $(srcdir)/README.md
44 -
45 -webv2dir=$(webdir)/v2
46 -
47 -dist_webv2_DATA = \\
48 - {0} \\
49 - $(NULL)
50 -
51 -webv2staticdir=$(webv2dir)/static
52 -dist_webv2static_DATA = \\
53 - {1} \\
54 - $(NULL)
55 -
56 -webv2staticemailimgdir=$(webv2staticdir)/email/img
57 -dist_webv2staticemailimg_DATA = \\
58 - {2} \\
59 - $(NULL)
60 -
61 -webv2staticimgdir=$(webv2staticdir)/img
62 -dist_webv2staticimg_DATA = \\
63 - {3} \\
64 - $(NULL)
65 -
66 -webv2staticimglogososdir=$(webv2staticimgdir)/logos/os
67 -dist_webv2staticimglogosos_DATA = \\
68 - {4} \\
69 - $(NULL)
70 -
71 -webv2staticimglogosservicesdir=$(webv2staticimgdir)/logos/services
72 -dist_webv2staticimglogosservices_DATA = \\
73 - {5} \\
74 - $(NULL)
75 -
76 -webv2staticimgmaildir=$(webv2staticimgdir)/mail
77 -dist_webv2staticimgmail_DATA = \\
78 - {6} \\
79 - $(NULL)
80 -
81 -webv2staticsitepagesholding503dir=$(webv2staticdir)/site/pages/holding-page-503
82 -dist_webv2staticsitepagesholding503_DATA = \\
83 - {7} \\
84 - $(NULL)
85 -'''
86 -
87 -
36 def copy_dashboard():
37 '''Fetch and bundle the dashboard code.'''
38 print('Preparing target directory')