commit 851b25600e3084c248d949735747e19d883826b1 Author: CentOS Sources Date: Tue Mar 28 10:13:48 2023 +0000 import grafana-pcp-5.1.1-1.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9411df4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/grafana-pcp-5.1.1.tar.gz +SOURCES/grafana-pcp-vendor-5.1.1-1.tar.xz +SOURCES/grafana-pcp-webpack-5.1.1-1.tar.gz diff --git a/.grafana-pcp.metadata b/.grafana-pcp.metadata new file mode 100644 index 0000000..ad5f855 --- /dev/null +++ b/.grafana-pcp.metadata @@ -0,0 +1,3 @@ +3b2c6875861e93eade0ab4321a49dfd6c692ca7a SOURCES/grafana-pcp-5.1.1.tar.gz +3eabf083226c04c7c5fa031d3b67d060cfc294f7 SOURCES/grafana-pcp-vendor-5.1.1-1.tar.xz +55fa447cbf8ffddc4ba5e50dc81b81e89f0f2fc7 SOURCES/grafana-pcp-webpack-5.1.1-1.tar.gz diff --git a/SOURCES/0001-remove-unused-frontend-crypto.patch b/SOURCES/0001-remove-unused-frontend-crypto.patch new file mode 100644 index 0000000..0991d4b --- /dev/null +++ b/SOURCES/0001-remove-unused-frontend-crypto.patch @@ -0,0 +1,259 @@ +From 7ed5650dc812fcbfcda7162845c4e6ea73a239a6 Mon Sep 17 00:00:00 2001 +From: Andreas Gerstmayr +Date: Thu, 7 Jul 2022 15:38:28 +0200 +Subject: [PATCH] remove unused frontend crypto + +update `package.json` and then run `yarn install` to update the +`yarn.lock` lockfile + +diff --git a/package.json b/package.json +index 14c2960..db6858a 100644 +--- a/package.json ++++ b/package.json +@@ -63,6 +63,10 @@ + "redux-persist": "^6.0.0", + "redux-thunk": "^2.3.0" + }, ++ "resolutions": { ++ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz", ++ "http-signature": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz" ++ }, + "engines": { + "node": ">=14" + } +diff --git a/yarn.lock b/yarn.lock +index 44bcec7..c2a86be 100644 +--- a/yarn.lock ++++ b/yarn.lock +@@ -4067,18 +4067,6 @@ array.prototype.flatmap@^1.2.5: + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" + +-asn1@~0.2.3: +- version "0.2.6" +- resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" +- integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== +- dependencies: +- safer-buffer "~2.1.0" +- +-assert-plus@1.0.0, assert-plus@^1.0.0: +- version "1.0.0" +- resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" +- integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== +- + astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" +@@ -4321,13 +4309,6 @@ base64-js@^1.3.1: + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +-bcrypt-pbkdf@^1.0.0: +- version "1.0.2" +- resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" +- integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== +- dependencies: +- tweetnacl "^0.14.3" +- + big.js@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" +@@ -4839,11 +4820,6 @@ core-js@^3.6.5: + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.26.0.tgz#a516db0ed0811be10eac5d94f3b8463d03faccfe" + integrity sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw== + +-core-util-is@1.0.2: +- version "1.0.2" +- resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +- integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== +- + cosmiconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" +@@ -4890,6 +4866,10 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: + shebang-command "^2.0.0" + which "^2.0.1" + ++"crypto-browserify@https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz", "http-signature@https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz", http-signature@~1.3.6: ++ version "1.1.1" ++ resolved "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz#f8cae15d883ffc0abc663b5eaaa711fcc64bb5c2" ++ + css-animation@^1.3.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/css-animation/-/css-animation-1.6.1.tgz#162064a3b0d51f958b7ff37b3d6d4de18e17039e" +@@ -5469,13 +5449,6 @@ d3@5.15.0: + d3-voronoi "1" + d3-zoom "1" + +-dashdash@^1.12.0: +- version "1.14.1" +- resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" +- integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== +- dependencies: +- assert-plus "^1.0.0" +- + data-urls@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" +@@ -5722,14 +5695,6 @@ duplexer@^0.1.2: + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6" + integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== + +-ecc-jsbn@~0.1.1: +- version "0.1.2" +- resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" +- integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== +- dependencies: +- jsbn "~0.1.0" +- safer-buffer "^2.1.0" +- + electron-to-chromium@^1.4.172: + version "1.4.264" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.264.tgz#2f68a062c38b7a04bf57f3e6954b868672fbdcd3" +@@ -6336,16 +6301,6 @@ extract-zip@2.0.1: + optionalDependencies: + "@types/yauzl" "^2.9.1" + +-extsprintf@1.3.0: +- version "1.3.0" +- resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" +- integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== +- +-extsprintf@^1.2.0: +- version "1.4.1" +- resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" +- integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== +- + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" +@@ -6746,13 +6701,6 @@ getos@^3.2.1: + dependencies: + async "^3.2.0" + +-getpass@^0.1.1: +- version "0.1.7" +- resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" +- integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== +- dependencies: +- assert-plus "^1.0.0" +- + glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" +@@ -7011,15 +6959,6 @@ http-proxy@^1.18.1: + follow-redirects "^1.0.0" + requires-port "^1.0.0" + +-http-signature@~1.3.6: +- version "1.3.6" +- resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.3.6.tgz#cb6fbfdf86d1c974f343be94e87f7fc128662cf9" +- integrity sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw== +- dependencies: +- assert-plus "^1.0.0" +- jsprim "^2.0.2" +- sshpk "^1.14.1" +- + https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" +@@ -7990,11 +7929,6 @@ js-yaml@^4.1.0: + dependencies: + argparse "^2.0.1" + +-jsbn@~0.1.0: +- version "0.1.1" +- resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +- integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== +- + jsdoc-type-pratt-parser@~2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz#c9f93afac7ee4b5ed4432fe3f09f7d36b05ed0ff" +@@ -8058,11 +7992,6 @@ json-schema-traverse@^1.0.0: + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +-json-schema@0.4.0: +- version "0.4.0" +- resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" +- integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== +- + json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" +@@ -8092,16 +8021,6 @@ jsonfile@^6.0.1: + optionalDependencies: + graceful-fs "^4.1.6" + +-jsprim@^2.0.2: +- version "2.0.2" +- resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" +- integrity sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ== +- dependencies: +- assert-plus "1.0.0" +- extsprintf "1.3.0" +- json-schema "0.4.0" +- verror "1.10.0" +- + "jsx-ast-utils@^2.4.1 || ^3.0.0": + version "3.3.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.1.tgz#a3e0f1cb7e230954eab4dcbce9f6288a78f8ba44" +@@ -10611,7 +10530,7 @@ safe-buffer@~5.1.1: + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +-"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: ++"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +@@ -10989,21 +10908,6 @@ sprintf-js@~1.0.2: + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +-sshpk@^1.14.1: +- version "1.17.0" +- resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" +- integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== +- dependencies: +- asn1 "~0.2.3" +- assert-plus "^1.0.0" +- bcrypt-pbkdf "^1.0.0" +- dashdash "^1.12.0" +- ecc-jsbn "~0.1.1" +- getpass "^0.1.1" +- jsbn "~0.1.0" +- safer-buffer "^2.0.2" +- tweetnacl "~0.14.0" +- + stable@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" +@@ -11459,11 +11363,6 @@ tunnel-agent@^0.6.0: + dependencies: + safe-buffer "^5.0.1" + +-tweetnacl@^0.14.3, tweetnacl@~0.14.0: +- version "0.14.5" +- resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" +- integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== +- + type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" +@@ -11649,15 +11548,6 @@ value-equal@^1.0.1: + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" + integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== + +-verror@1.10.0: +- version "1.10.0" +- resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" +- integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== +- dependencies: +- assert-plus "^1.0.0" +- core-util-is "1.0.2" +- extsprintf "^1.2.0" +- + w3c-hr-time@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" diff --git a/SOURCES/build_frontend.sh b/SOURCES/build_frontend.sh new file mode 100755 index 0000000..a0443d7 --- /dev/null +++ b/SOURCES/build_frontend.sh @@ -0,0 +1,24 @@ +#!/bin/bash -eu + +# Revert upstream change: "rename plugin IDs from pcp-*-* to performancecopilot-*-*" +# https://github.com/performancecopilot/grafana-pcp/commit/70ca5cc307e231cea14281e1cd2268ae4f1f445c +# This change would break all existing custom dashboards. Using sed here instead of a patch +# to catch all future usage of the new upstream plugin ids. +find src cypress \( -name '*.ts' -o -name '*.json' -o -name '*.jsonnet' -o -name '*.libsonnet' \) \ + -exec sed -i \ + -e 's/performancecopilot-redis-datasource/pcp-redis-datasource/g' \ + -e 's/performancecopilot-vector-datasource/pcp-vector-datasource/g' \ + -e 's/performancecopilot-bpftrace-datasource/pcp-bpftrace-datasource/g' \ + -e 's/performancecopilot-flamegraph-panel/pcp-flamegraph-panel/g' \ + -e 's/performancecopilot-breadcrumbs-panel/pcp-breadcrumbs-panel/g' \ + -e 's/performancecopilot-troubleshooting-panel/pcp-troubleshooting-panel/g' \ + {} \; + +# Build the frontend +yarn run build + +# Build the dashboards +make build-dashboards + +# Fix permissions (webpack sometimes outputs files with mode = 666 due to reasons unknown (race condition/umask issue afaics)) +chmod -R g-w,o-w dist diff --git a/SOURCES/create_bundles.sh b/SOURCES/create_bundles.sh new file mode 100755 index 0000000..278046b --- /dev/null +++ b/SOURCES/create_bundles.sh @@ -0,0 +1,68 @@ +#!/bin/bash -eux +VERSION=$(rpm --specfile ./*.spec --qf '%{VERSION}\n' | head -1) +RELEASE=$(rpm --specfile ./*.spec --qf '%{RELEASE}\n' | head -1 | cut -d. -f1) +CHANGELOGTIME=$(rpm --specfile ./*.spec --qf '%{CHANGELOGTIME}\n' | head -1) +SOURCE_DATE_EPOCH=$((CHANGELOGTIME - CHANGELOGTIME % 86400)) + +SOURCE_DIR=grafana-pcp-$VERSION +SOURCE_TAR=grafana-pcp-$VERSION.tar.gz +VENDOR_TAR=grafana-pcp-vendor-$VERSION-$RELEASE.tar.xz +WEBPACK_TAR=grafana-pcp-webpack-$VERSION-$RELEASE.tar.gz + + +## Download and extract source tarball +spectool -g grafana-pcp.spec +rm -rf "${SOURCE_DIR}" +tar xf "${SOURCE_TAR}" + + +## Create vendor bundle +pushd "${SOURCE_DIR}" + +# Vendor Go dependencies +go mod vendor + +# List bundled dependencies +awk '$2 ~ /^v/ && $4 != "indirect" {print "Provides: bundled(golang(" $1 ")) = " substr($2, 2)}' go.mod | \ + sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > "../${VENDOR_TAR}.manifest" + +# Vendor Node.js dependencies +patch -p1 --fuzz=0 < ../0001-remove-unused-frontend-crypto.patch +yarn install --frozen-lockfile + +# Remove files with licensing issues +find . -type d -name 'node-notifier' -prune -exec rm -r {} \; +find . -type f -name '*.exe' -delete + +# List bundled dependencies +../list_bundled_nodejs_packages.py . >> "../${VENDOR_TAR}.manifest" + +# Vendor Jsonnet dependencies +jb --jsonnetpkg-home=vendor_jsonnet install + +popd + +# Create tarball +# shellcheck disable=SC2046 +XZ_OPT=-9 tar \ + --sort=name \ + --mtime="@${SOURCE_DATE_EPOCH}" --clamp-mtime \ + --owner=0 --group=0 --numeric-owner \ + -cJf "${VENDOR_TAR}" \ + "${SOURCE_DIR}/vendor" \ + "${SOURCE_DIR}/node_modules" \ + "${SOURCE_DIR}/vendor_jsonnet" + + +## Create webpack +pushd "${SOURCE_DIR}" +../build_frontend.sh +popd + +# Create tarball +tar \ + --sort=name \ + --mtime="@${SOURCE_DATE_EPOCH}" --clamp-mtime \ + --owner=0 --group=0 --numeric-owner \ + -czf "${WEBPACK_TAR}" \ + "${SOURCE_DIR}/dist" diff --git a/SOURCES/create_bundles_in_container.sh b/SOURCES/create_bundles_in_container.sh new file mode 100755 index 0000000..2524525 --- /dev/null +++ b/SOURCES/create_bundles_in_container.sh @@ -0,0 +1,21 @@ +#!/bin/bash -eu +# +# create vendor and webpack bundles inside a container (for reproducibility) +# using a Go cache: +# ./create_bundles_in_container.sh --security-opt label=disable -v $(pwd)/.gocache:/root/go +# + +cat <= 1:14, yarnpkg, golang-github-google-jsonnet +%endif + +%global plugin_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app +%global install_dir %{_datadir}/performancecopilot-pcp-app + +# grafana-pcp requires systemd-tmpfiles +%{?systemd_requires} +Requires: grafana >= 9.0.9 +Suggests: pcp >= 5.2.2 +Suggests: redis >= 5.0.0 +Suggests: bpftrace >= 0.9.2 + +# Obsolete old webapps +Obsoletes: pcp-webjs <= 4.3.4 +Obsoletes: pcp-webapp-blinkenlights <= 4.3.4 +Obsoletes: pcp-webapp-grafana <= 4.3.4 +Obsoletes: pcp-webapp-graphite <= 4.3.4 +Obsoletes: pcp-webapp-vector <= 4.3.4 + +# vendored golang and node.js build dependencies +# this is for security purposes, if nodejs-foo ever needs an update, +# affected packages can be easily identified. +# Note: generated by the Makefile (see README.md) +Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.141.0 +Provides: bundled(golang(github.com/hashicorp/golang-lru)) = 0.5.4 +Provides: bundled(golang(github.com/stretchr/testify)) = 1.8.0 +Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.18.6 +Provides: bundled(npm(@grafana/data)) = 9.1.6 +Provides: bundled(npm(@grafana/runtime)) = 9.1.6 +Provides: bundled(npm(@grafana/toolkit)) = 9.1.6 +Provides: bundled(npm(@grafana/ui)) = 9.1.6 +Provides: bundled(npm(@trivago/prettier-plugin-sort-imports)) = 3.4.0 +Provides: bundled(npm(@types/blueimp-md5)) = 2.18.0 +Provides: bundled(npm(@types/d3-selection)) = 2.0.1 +Provides: bundled(npm(@types/enzyme)) = 3.10.8 +Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6 +Provides: bundled(npm(@types/jest)) = 26.0.24 +Provides: bundled(npm(@types/lodash)) = 4.14.181 +Provides: bundled(npm(@types/memoize-one)) = 5.1.2 +Provides: bundled(npm(@types/react-autosuggest)) = 10.1.5 +Provides: bundled(npm(@types/react-redux)) = 7.1.24 +Provides: bundled(npm(@types/redux)) = 3.6.0 +Provides: bundled(npm(@types/redux-persist)) = 4.3.1 +Provides: bundled(npm(babel-plugin-react-remove-properties)) = 0.3.0 +Provides: bundled(npm(blueimp-md5)) = 2.19.0 +Provides: bundled(npm(core-js)) = 2.6.12 +Provides: bundled(npm(cypress)) = 10.10.0 +Provides: bundled(npm(d3-flame-graph)) = 3.1.1 +Provides: bundled(npm(d3-selection)) = 1.4.2 +Provides: bundled(npm(emotion)) = 10.0.27 +Provides: bundled(npm(enzyme)) = 3.11.0 +Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.6 +Provides: bundled(npm(eslint-plugin-prettier)) = 4.2.1 +Provides: bundled(npm(lodash)) = 4.17.21 +Provides: bundled(npm(loglevel)) = 1.8.0 +Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4 +Provides: bundled(npm(memoize-one)) = 4.1.0 +Provides: bundled(npm(monaco-editor)) = 0.31.1 +Provides: bundled(npm(monaco-editor-webpack-plugin)) = 7.0.1 +Provides: bundled(npm(prettier-plugin-organize-imports)) = 2.3.4 +Provides: bundled(npm(react-autosuggest)) = 10.1.0 +Provides: bundled(npm(react-monaco-editor)) = 0.47.0 +Provides: bundled(npm(react-redux)) = 7.2.9 +Provides: bundled(npm(react-use)) = 17.4.0 +Provides: bundled(npm(redux)) = 4.1.0 +Provides: bundled(npm(redux-persist)) = 6.0.0 +Provides: bundled(npm(redux-thunk)) = 2.4.1 +Provides: bundled(npm(utility-types)) = 3.10.0 + + +%description +This Grafana plugin for Performance Co-Pilot includes data sources for +scalable time series from pmseries(1) and Redis, live PCP metrics and +bpftrace scripts from pmdabpftrace(1), as well as several dashboards. + +%prep +%setup -q -T -D -b 0 +%setup -q -T -D -b 1 +%if %{compile_frontend} == 0 +%setup -q -T -D -b 2 +%endif + +%patch1 -p1 + + +%build +# Build frontend data sources +%if %{compile_frontend} +%{SOURCE4} +%endif + +# Build backend data source +%gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg + + +%install +install -d -m 755 %{buildroot}/%{install_dir} +cp -a dist/* %{buildroot}/%{install_dir} + +# On rpm-ostree based distributions, /var is exclusively reserved for application state. +# Grafana also supports installing plugins through the UI, therefore this RPM installs +# its content to /usr/share, and creates a symlink from /var to it using systemd-tmpfiles. +mkdir -p %{buildroot}%{_tmpfilesdir} +echo "L+ %{plugin_dir} - - - - %{install_dir}" > %{buildroot}%{_tmpfilesdir}/%{name}.conf + +%postun +# uninstall of old package +%systemd_postun_with_restart grafana-server.service + +%posttrans +# install or upgrade of new package + +# create symlink after the previous package got removed +%tmpfiles_create %_tmpfilesdir/%{name}.conf + +# restart Grafana after the previous package got removed +if [ -x /usr/bin/systemctl ]; then + /usr/bin/systemctl try-restart grafana-server.service || : +fi + + +%check +# Test frontend data sources +%if %{compile_frontend} +yarn test +%endif + +# Test backend data source +%gotest ./pkg/... + + +%files +%{install_dir} +%{_tmpfilesdir}/%{name}.conf +# remove symlink when package is uninstalled +%ghost %{plugin_dir} + +%license LICENSE NOTICE +%doc README.md + + +%changelog +* Thu Oct 27 2022 Andreas Gerstmayr 5.1.1-1 +- update to 5.1.1 tagged upstream community sources, see CHANGELOG +- resolve CVE-2022-27664 golang: net/http: handle server errors after sending GOAWAY + +* Mon Sep 19 2022 Andreas Gerstmayr 5.0.0-4 +- update to 5.0.0 tagged upstream community sources, see CHANGELOG +- install plugin in /usr/share and create symlink from /var using + systemd-tmpfiles to work on rpm-ostree based distributions +- revert the breaking change (change of internal plugin IDs) of upstream v5.0.0, + i.e. there are no breaking changes when performing this upgrade +- enable Go modules in build process +- make vendor and webpack tarballs reproducible +- drop makefile in favor of create_bundles.sh script + +* Wed Aug 24 2022 Andreas Gerstmayr 3.2.0-3 +- bump NVR + +* Thu Aug 11 2022 Andreas Gerstmayr 3.2.0-2 +- resolve CVE-2022-1705 golang: net/http: improper sanitization of Transfer-Encoding header +- resolve CVE-2022-32148 golang: net/http/httputil: NewSingleHostReverseProxy - omit X-Forwarded-For not working +- resolve CVE-2022-30631 golang: compress/gzip: stack exhaustion in Reader.Read +- resolve CVE-2022-30630 golang: io/fs: stack exhaustion in Glob +- resolve CVE-2022-30632 golang: path/filepath: stack exhaustion in Glob +- resolve CVE-2022-30635 golang: encoding/gob: stack exhaustion in Decoder.Decode + +* Fri Nov 12 2021 Andreas Gerstmayr 3.2.0-1 +- update to 3.2.0 tagged upstream community sources, see CHANGELOG + +* Mon Aug 09 2021 Mohan Boddu - 3.1.0-2 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Jun 25 2021 Andreas Gerstmayr 3.1.0-1 +- update to 3.1.0 tagged upstream community sources, see CHANGELOG +- remove unused cryptographic implementations + +* Tue Jun 22 2021 Mohan Boddu - 3.0.2-4 +- Rebuilt for RHEL 9 BETA for openssl 3.0 + Related: rhbz#1971065 + +* Thu Apr 15 2021 Mohan Boddu - 3.0.2-3 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 3.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Jan 22 2021 Andreas Gerstmayr 3.0.2-1 +- update to 3.0.2 tagged upstream community sources, see CHANGELOG + +* Wed Dec 23 2020 Andreas Gerstmayr 3.0.1-1 +- update to 3.0.1 tagged upstream community sources, see CHANGELOG + +* Thu Nov 26 2020 Andreas Gerstmayr 3.0.0-1 +- update to 3.0.0 tagged upstream community sources, see CHANGELOG +- bundle golang dependencies and (optionally) node.js dependencies + +* Tue Jul 28 2020 Fedora Release Engineering - 2.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Feb 25 2020 Andreas Gerstmayr 2.0.2-1 +- vector, redis: remove autocompletion cache (PCP metrics can be added and removed dynamically) + +* Thu Feb 20 2020 Andreas Gerstmayr 2.0.1-1 +- support for Grafana 6.6+, drop support for Grafana < 6.6 +- vector, bpftrace: fix version checks on dashboard load (prevent multiple pmcd.version checks on dashboard load) +- vector, bpftrace: change datasource check box to red if URL is inaccessible +- redis: add tests +- flame graphs: support multidimensional eBPF maps (required to display e.g. the process name) +- dashboards: remove BCC metrics from Vector host overview (because the BCC PMDA is not installed by default) +- misc: update dependencies +- build: fix production build (implement workaround for https://github.com/systemjs/systemjs/issues/2117, https://github.com/grafana/grafana/issues/21785) + +* Wed Jan 29 2020 Andreas Gerstmayr 1.0.7-1 +- redis: fix timespec (fixes empty graphs for large time ranges) + +* Wed Jan 29 2020 Fedora Release Engineering - 1.0.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Jan 07 2020 Andreas Gerstmayr 1.0.6-1 +- redis: support wildcards in metric names +- redis: fix label support +- redis: fix legends +- redis: set default sample interval to 60s (fixes empty graph borders) +- build: upgrade copy-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency +- build: remove deprecated uglify-webpack-plugin + +* Thu Dec 12 2019 Andreas Gerstmayr 1.0.4-2 +- remove node_modules/node-notifier directory from webpack (due to licensing issues) + +* Wed Dec 11 2019 Andreas Gerstmayr 1.0.4-1 +- flame graphs: clean flame graph stacks every 5s (reduces CPU load) +- general: implement PCP version checks +- build: remove weak dependency (doesn't work with Node.js 12) +- build: upgrade terser-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency + +* Tue Nov 26 2019 Nathan Scott 1.0.3-1 +- fix flame graph dependency (flamegraph.destroy error in javascript console) + +* Tue Nov 12 2019 Andreas Gerstmayr 1.0.2-1 +- handle counter wraps (overflows) +- convert time based counters to time utilization +- flame graphs: aggregate stack counts by selected time range in the Grafana UI +- flame graphs: add option to hide idle stacks +- vector: fix container dropdown in query editor +- vector: remove container setting from datasource settings page +- redis: fix value transformations (e.g. rate conversation of counters) +- request more datapoints from the datasource to fill the borders of the graph panel + +* Fri Oct 11 2019 Andreas Gerstmayr 1.0.0-1 +- bpftrace: support for Flame Graphs +- bpftrace: context-sensitive auto completion for bpftrace probes, builtin variables and functions incl. help texts +- bpftrace: parse output of bpftrace scripts (e.g. using `printf()`) as CSV and display it in the Grafana table panel +- bpftrace: sample dashboards (BPFtrace System Analysis, BPFtrace Flame Graphs) +- vector: table output: show instance name in left column +- vector: table output: support non-matching instance names (cells of metrics which don't have the specific instance will be blank) +- vector & bpftrace: if the metric/script gets changed in the query editor, immeditately stop polling the old metric/deregister the old script +- vector & bpftrace: improve pmwebd compatibility +- misc: help texts for all datasources (visible with the **[ ? ]** button in the query editor) +- misc: renamed PCP Live to PCP Vector +- misc: logos for all datasources +- misc: improved error handling + +* Fri Aug 16 2019 Andreas Gerstmayr 0.0.7-1 +- converted into a Grafana app plugin, renamed to grafana-pcp +- redis: support for instance domains, labels, autocompletion, automatic rate conversation +- live and bpftrace: initial commit of datasources + +* Tue Jun 11 2019 Mark Goodwin 0.0.6-1 +- renamed package to grafana-pcp-redis, updated README, etc + +* Wed Jun 05 2019 Mark Goodwin 0.0.5-1 +- renamed package to grafana-pcp-datasource, README, etc + +* Fri May 17 2019 Mark Goodwin 0.0.4-1 +- add suggested pmproxy URL in config html +- updated instructions and README.md now that grafana is in Fedora + +* Fri Apr 12 2019 Mark Goodwin 0.0.3-1 +- require grafana v6.1.3 or later +- install directory is now below /var/lib/grafana/plugins + +* Wed Mar 20 2019 Mark Goodwin 0.0.2-1 +- initial version