Blame SPECS/grafana-pcp.spec

c9cdef
# gobuild and gotest macros are not available on CentOS Stream
c9cdef
# remove once BZ 1965292 is resolved
c9cdef
# definitions lifted from Fedora 34 podman.spec
c9cdef
%if ! 0%{?gobuild:1}
c9cdef
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**};
c9cdef
%endif
c9cdef
%if ! 0%{?gotest:1}
c9cdef
%define gotest() GO111MODULE=off go test -buildmode pie -compiler gc -ldflags "${LDFLAGS:-} -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" %{?**};
c9cdef
%endif
c9cdef
c9cdef
%global grafanapcp_arches %{lua: go_arches = {}
c9cdef
  for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do
c9cdef
    go_arches[arch] = 1
c9cdef
  end
c9cdef
  for arch in rpm.expand("%{nodejs_arches}"):gmatch("%S+") do
c9cdef
    if go_arches[arch] then
c9cdef
      print(arch .. " ")
c9cdef
  end
c9cdef
end}
c9cdef
c9cdef
# Specify if the frontend and dashboards will be compiled as part of the build or are attached
c9cdef
# as a webpack tarball (in case of an unsuitable nodejs or jsonnet version on the build system)
c9cdef
%define compile_frontend 0
c9cdef
c9cdef
Name:           grafana-pcp
338776
Version:        3.2.0
2397f4
Release:        3%{?dist}
c9cdef
Summary:        Performance Co-Pilot Grafana Plugin
c9cdef
License:        ASL 2.0
c9cdef
URL:            https://github.com/performancecopilot/grafana-pcp
c9cdef
c9cdef
Source0:        https://github.com/performancecopilot/grafana-pcp/archive/v%{version}/%{name}-%{version}.tar.gz
338776
Source1:        grafana-pcp-vendor-%{version}-1.tar.xz
338776
# Note: In case there were no changes to this tarball, the NVR of this tarball
338776
# lags behind the NVR of this package.
c9cdef
%if %{compile_frontend} == 0
c9cdef
# Source2 contains the precompiled frontend and dashboards
338776
# Note: In case there were no changes to this tarball, the NVR of this tarball
338776
# lags behind the NVR of this package.
338776
Source2:        grafana-pcp-webpack-%{version}-1.tar.gz
c9cdef
%endif
c9cdef
Source3:        Makefile
c9cdef
Source4:        build_frontend.sh
c9cdef
Source5:        list_bundled_nodejs_packages.py
c9cdef
c9cdef
Patch1:         001-remove-unused-frontend-crypto.patch
c9cdef
c9cdef
# Intersection of go_arches and nodejs_arches
c9cdef
ExclusiveArch:  %{grafanapcp_arches}
c9cdef
c9cdef
BuildRequires:  systemd-rpm-macros, golang, go-srpm-macros
c9cdef
%if 0%{?fedora} >= 31
c9cdef
BuildRequires:  go-rpm-macros
c9cdef
%endif
c9cdef
c9cdef
%if %{compile_frontend}
c9cdef
BuildRequires:  make, nodejs >= 1:14, yarnpkg, golang-github-google-jsonnet
c9cdef
%endif
c9cdef
c9cdef
# omit golang debugsource, see BZ 995136 and related
c9cdef
%global         dwz_low_mem_die_limit 0
c9cdef
%global         _debugsource_template %{nil}
c9cdef
c9cdef
%global         install_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app
c9cdef
c9cdef
Requires:       grafana >= 7.5.9
c9cdef
Suggests:       pcp >= 5.2.2
c9cdef
Suggests:       redis >= 5.0.0
c9cdef
Suggests:       bpftrace >= 0.9.2
c9cdef
c9cdef
# Obsolete old webapps
c9cdef
Obsoletes: pcp-webjs <= 4.3.4
c9cdef
Obsoletes: pcp-webapp-blinkenlights <= 4.3.4
c9cdef
Obsoletes: pcp-webapp-grafana <= 4.3.4
c9cdef
Obsoletes: pcp-webapp-graphite <= 4.3.4
c9cdef
Obsoletes: pcp-webapp-vector <= 4.3.4
c9cdef
c9cdef
# vendored golang and node.js build dependencies
c9cdef
# this is for security purposes, if nodejs-foo ever needs an update,
c9cdef
# affected packages can be easily identified.
c9cdef
# Note: generated by the Makefile (see README.md)
338776
Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.115.0
c9cdef
Provides: bundled(golang(github.com/stretchr/testify)) = 1.7.0
338776
Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.16.0
338776
Provides: bundled(npm(@grafana/data)) = 7.5.11
338776
Provides: bundled(npm(@grafana/runtime)) = 7.5.11
338776
Provides: bundled(npm(@grafana/toolkit)) = 7.5.11
338776
Provides: bundled(npm(@grafana/ui)) = 7.5.11
c9cdef
Provides: bundled(npm(@testing-library/jest-dom)) = 5.4.0
c9cdef
Provides: bundled(npm(@testing-library/react)) = 10.4.9
c9cdef
Provides: bundled(npm(@types/blueimp-md5)) = 2.18.0
c9cdef
Provides: bundled(npm(@types/d3-selection)) = 1.4.3
c9cdef
Provides: bundled(npm(@types/enzyme)) = 3.10.8
c9cdef
Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6
c9cdef
Provides: bundled(npm(@types/expect-puppeteer)) = 3.3.1
c9cdef
Provides: bundled(npm(@types/jest)) = 26.0.15
c9cdef
Provides: bundled(npm(@types/jest-environment-puppeteer)) = 4.4.1
338776
Provides: bundled(npm(@types/lodash)) = 4.14.176
c9cdef
Provides: bundled(npm(@types/memoize-one)) = 5.1.2
c9cdef
Provides: bundled(npm(@types/react-autosuggest)) = 9.3.14
338776
Provides: bundled(npm(@types/react-redux)) = 7.1.20
c9cdef
Provides: bundled(npm(@types/redux)) = 3.6.0
c9cdef
Provides: bundled(npm(@types/redux-persist)) = 4.3.1
c9cdef
Provides: bundled(npm(@types/redux-persist-transform-filter)) = 0.0.4
c9cdef
Provides: bundled(npm(babel-plugin-remove-object-properties)) = 1.0.2
338776
Provides: bundled(npm(blueimp-md5)) = 2.19.0
c9cdef
Provides: bundled(npm(core-js)) = 2.6.12
c9cdef
Provides: bundled(npm(d3-flame-graph)) = 3.1.1
c9cdef
Provides: bundled(npm(d3-selection)) = 1.4.2
c9cdef
Provides: bundled(npm(emotion)) = 10.0.27
c9cdef
Provides: bundled(npm(enzyme)) = 3.11.0
c9cdef
Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.6
c9cdef
Provides: bundled(npm(eslint-plugin-prettier)) = 3.3.1
c9cdef
Provides: bundled(npm(jest-date-mock)) = 1.0.8
c9cdef
Provides: bundled(npm(jest-puppeteer)) = 5.0.4
c9cdef
Provides: bundled(npm(lodash)) = 4.17.21
c9cdef
Provides: bundled(npm(loglevel)) = 1.7.1
c9cdef
Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4
c9cdef
Provides: bundled(npm(memoize-one)) = 4.1.0
c9cdef
Provides: bundled(npm(monaco-editor)) = 0.20.0
c9cdef
Provides: bundled(npm(monaco-editor-webpack-plugin)) = 1.9.0
338776
Provides: bundled(npm(prettier-plugin-organize-imports)) = 2.3.4
338776
Provides: bundled(npm(puppeteer)) = 10.4.0
c9cdef
Provides: bundled(npm(react-autosuggest)) = 10.1.0
c9cdef
Provides: bundled(npm(react-monaco-editor)) = 0.36.0
338776
Provides: bundled(npm(react-redux)) = 7.2.6
c9cdef
Provides: bundled(npm(react-use)) = 15.3.8
c9cdef
Provides: bundled(npm(redux)) = 3.7.2
c9cdef
Provides: bundled(npm(redux-persist)) = 4.10.2
338776
Provides: bundled(npm(redux-thunk)) = 2.4.0
c9cdef
Provides: bundled(npm(utility-types)) = 3.10.0
c9cdef
c9cdef
c9cdef
%description
c9cdef
This Grafana plugin for Performance Co-Pilot includes datasources for
c9cdef
scalable time series from pmseries(1) and Redis, live PCP metrics and
c9cdef
bpftrace scripts from pmdabpftrace(1), as well as several dashboards.
c9cdef
c9cdef
%prep
c9cdef
%setup -q -T -D -b 0
c9cdef
%setup -q -T -D -b 1
c9cdef
%if %{compile_frontend} == 0
c9cdef
%setup -q -T -D -b 2
c9cdef
%endif
c9cdef
c9cdef
%patch1 -p1
c9cdef
c9cdef
# Set up Go build subdir and links
c9cdef
mkdir -p %{_builddir}/src/github.com/performancecopilot
c9cdef
ln -s %{_builddir}/%{name}-%{version} \
c9cdef
    %{_builddir}/src/github.com/performancecopilot/grafana-pcp
c9cdef
c9cdef
c9cdef
%build
c9cdef
# Build frontend datasources
c9cdef
%if %{compile_frontend}
c9cdef
%{SOURCE4}
c9cdef
%endif
c9cdef
c9cdef
# Build backend datasource
c9cdef
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
c9cdef
export GOPATH=%{_builddir}
c9cdef
%gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg
c9cdef
c9cdef
c9cdef
%install
c9cdef
install -d -m 755 %{buildroot}/%{install_dir}
c9cdef
cp -a dist/* %{buildroot}/%{install_dir}
c9cdef
c9cdef
%postun
c9cdef
# uninstall of old package
c9cdef
%systemd_postun_with_restart grafana-server.service
c9cdef
c9cdef
%posttrans
c9cdef
# install or upgrade of new package
c9cdef
if [ -x /usr/bin/systemctl ]; then
c9cdef
  /usr/bin/systemctl try-restart grafana-server.service || :
c9cdef
fi
c9cdef
c9cdef
c9cdef
%check
c9cdef
# Test frontend datasources
c9cdef
%if %{compile_frontend}
c9cdef
yarn test
c9cdef
%endif
c9cdef
c9cdef
# Test backend datasource
c9cdef
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
c9cdef
export GOPATH=%{_builddir}
c9cdef
%gotest ./pkg/...
c9cdef
c9cdef
c9cdef
%files
c9cdef
%{install_dir}
c9cdef
c9cdef
%license LICENSE NOTICE
c9cdef
%doc README.md
c9cdef
c9cdef
c9cdef
%changelog
2397f4
* Wed Aug 24 2022 Andreas Gerstmayr <agerstmayr@redhat.com> 3.2.0-3
2397f4
- bump NVR
2397f4
2397f4
* Thu Aug 11 2022 Andreas Gerstmayr <agerstmayr@redhat.com> 3.2.0-2
2397f4
- resolve CVE-2022-1705 golang: net/http: improper sanitization of Transfer-Encoding header
2397f4
- resolve CVE-2022-32148 golang: net/http/httputil: NewSingleHostReverseProxy - omit X-Forwarded-For not working
2397f4
- resolve CVE-2022-30631 golang: compress/gzip: stack exhaustion in Reader.Read
2397f4
- resolve CVE-2022-30630 golang: io/fs: stack exhaustion in Glob
2397f4
- resolve CVE-2022-30632 golang: path/filepath: stack exhaustion in Glob
2397f4
- resolve CVE-2022-30635 golang: encoding/gob: stack exhaustion in Decoder.Decode
adfd0f
338776
* Fri Nov 12 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.2.0-1
338776
- update to 3.2.0 tagged upstream community sources, see CHANGELOG
338776
c9cdef
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.1.0-2
c9cdef
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
c9cdef
  Related: rhbz#1991688
c9cdef
c9cdef
* Fri Jun 25 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.1.0-1
c9cdef
- update to 3.1.0 tagged upstream community sources, see CHANGELOG
c9cdef
- remove unused cryptographic implementations
c9cdef
c9cdef
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 3.0.2-4
c9cdef
- Rebuilt for RHEL 9 BETA for openssl 3.0
c9cdef
  Related: rhbz#1971065
c9cdef
c9cdef
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 3.0.2-3
c9cdef
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
c9cdef
c9cdef
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
c9cdef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
c9cdef
c9cdef
* Fri Jan 22 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.2-1
c9cdef
- update to 3.0.2 tagged upstream community sources, see CHANGELOG
c9cdef
c9cdef
* Wed Dec 23 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.1-1
c9cdef
- update to 3.0.1 tagged upstream community sources, see CHANGELOG
c9cdef
c9cdef
* Thu Nov 26 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.0-1
c9cdef
- update to 3.0.0 tagged upstream community sources, see CHANGELOG
c9cdef
- bundle golang dependencies and (optionally) node.js dependencies
c9cdef
c9cdef
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
c9cdef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
c9cdef
c9cdef
* Tue Feb 25 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.2-1
c9cdef
- vector, redis: remove autocompletion cache (PCP metrics can be added and removed dynamically)
c9cdef
c9cdef
* Thu Feb 20 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.1-1
c9cdef
- support for Grafana 6.6+, drop support for Grafana < 6.6
c9cdef
- vector, bpftrace: fix version checks on dashboard load (prevent multiple pmcd.version checks on dashboard load)
c9cdef
- vector, bpftrace: change datasource check box to red if URL is inaccessible
c9cdef
- redis: add tests
c9cdef
- flame graphs: support multidimensional eBPF maps (required to display e.g. the process name)
c9cdef
- dashboards: remove BCC metrics from Vector host overview (because the BCC PMDA is not installed by default)
c9cdef
- misc: update dependencies
c9cdef
- build: fix production build (implement workaround for https://github.com/systemjs/systemjs/issues/2117, https://github.com/grafana/grafana/issues/21785)
c9cdef
c9cdef
* Wed Jan 29 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.7-1
c9cdef
- redis: fix timespec (fixes empty graphs for large time ranges)
c9cdef
c9cdef
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-2
c9cdef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
c9cdef
c9cdef
* Tue Jan 07 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.6-1
c9cdef
- redis: support wildcards in metric names
c9cdef
- redis: fix label support
c9cdef
- redis: fix legends
c9cdef
- redis: set default sample interval to 60s (fixes empty graph borders)
c9cdef
- build: upgrade copy-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency
c9cdef
- build: remove deprecated uglify-webpack-plugin
c9cdef
c9cdef
* Thu Dec 12 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.4-2
c9cdef
- remove node_modules/node-notifier directory from webpack (due to licensing issues)
c9cdef
c9cdef
* Wed Dec 11 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.4-1
c9cdef
- flame graphs: clean flame graph stacks every 5s (reduces CPU load)
c9cdef
- general: implement PCP version checks
c9cdef
- build: remove weak dependency (doesn't work with Node.js 12)
c9cdef
- build: upgrade terser-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency
c9cdef
c9cdef
* Tue Nov 26 2019 Nathan Scott <nathans@redhat.com> 1.0.3-1
c9cdef
- fix flame graph dependency (flamegraph.destroy error in javascript console)
c9cdef
c9cdef
* Tue Nov 12 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.2-1
c9cdef
- handle counter wraps (overflows)
c9cdef
- convert time based counters to time utilization
c9cdef
- flame graphs: aggregate stack counts by selected time range in the Grafana UI
c9cdef
- flame graphs: add option to hide idle stacks
c9cdef
- vector: fix container dropdown in query editor
c9cdef
- vector: remove container setting from datasource settings page
c9cdef
- redis: fix value transformations (e.g. rate conversation of counters)
c9cdef
- request more datapoints from the datasource to fill the borders of the graph panel
c9cdef
c9cdef
* Fri Oct 11 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.0-1
c9cdef
- bpftrace: support for Flame Graphs
c9cdef
- bpftrace: context-sensitive auto completion for bpftrace probes, builtin variables and functions incl. help texts
c9cdef
- bpftrace: parse output of bpftrace scripts (e.g. using `printf()`) as CSV and display it in the Grafana table panel
c9cdef
- bpftrace: sample dashboards (BPFtrace System Analysis, BPFtrace Flame Graphs)
c9cdef
- vector: table output: show instance name in left column
c9cdef
- vector: table output: support non-matching instance names (cells of metrics which don't have the specific instance will be blank)
c9cdef
- vector & bpftrace: if the metric/script gets changed in the query editor, immeditately stop polling the old metric/deregister the old script
c9cdef
- vector & bpftrace: improve pmwebd compatibility
c9cdef
- misc: help texts for all datasources (visible with the **[ ? ]** button in the query editor)
c9cdef
- misc: renamed PCP Live to PCP Vector
c9cdef
- misc: logos for all datasources
c9cdef
- misc: improved error handling
c9cdef
c9cdef
* Fri Aug 16 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 0.0.7-1
c9cdef
- converted into a Grafana app plugin, renamed to grafana-pcp
c9cdef
- redis: support for instance domains, labels, autocompletion, automatic rate conversation
c9cdef
- live and bpftrace: initial commit of datasources
c9cdef
c9cdef
* Tue Jun 11 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.6-1
c9cdef
- renamed package to grafana-pcp-redis, updated README, etc
c9cdef
c9cdef
* Wed Jun 05 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.5-1
c9cdef
- renamed package to grafana-pcp-datasource, README, etc
c9cdef
c9cdef
* Fri May 17 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.4-1
c9cdef
- add suggested pmproxy URL in config html
c9cdef
- updated instructions and README.md now that grafana is in Fedora
c9cdef
c9cdef
* Fri Apr 12 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.3-1
c9cdef
- require grafana v6.1.3 or later
c9cdef
- install directory is now below /var/lib/grafana/plugins
c9cdef
c9cdef
* Wed Mar 20 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.2-1
c9cdef
- initial version