Closed c-bordon closed 1 year ago
jq -r '.version' $(TARGET_DIR)$(INSTALLATION_DIR)/plugins/wazuh/package.json | tr -d '.' >> $(TARGET_DIR)$(INSTALLATION_DIR)/tmp2.txt
jq -r '.revision' $(TARGET_DIR)$(INSTALLATION_DIR)/plugins/wazuh/package.json >> $(TARGET_DIR)$(INSTALLATION_DIR)/tmp.txt
tr -d '\n' < $(TARGET_DIR)$(INSTALLATION_DIR)/tmp.txt >> $(TARGET_DIR)$(INSTALLATION_DIR)/tmp2.txt
cat $(TARGET_DIR)$(INSTALLATION_DIR)/tmp2.txt
jq --slurpfile BUILD_NUMBER $(TARGET_DIR)$(INSTALLATION_DIR)/tmp2.txt '.build.number=${BUILD_NUMBER}' $(TARGET_DIR)$(INSTALLATION_DIR)/package.json > $(TARGET_DIR)$(INSTALLATION_DIR)/package.json.tmp
mv $(TARGET_DIR)$(INSTALLATION_DIR)/package.json.tmp $(TARGET_DIR)$(INSTALLATION_DIR)/package.json
rm -f $(TARGET_DIR)$(INSTALLATION_DIR)/tmp.txt $(TARGET_DIR)$(INSTALLATION_DIR)/tmp2.txt
This command cannot be executed:
jq ".build.number=$(jq -r '.version' ./plugins/wazuh/package.json | tr -d '.')$(jq -r '.revision' ./plugins/wazuh/package. json)" ./package.json > ./package.json.tmp
--argfile variable-name filename
option root@ubuntu20:~# cat /usr/share/wazuh-dashboard/package.json
{
"name": "opensearch-dashboards",
"description": "OpenSearch Dashboards is a browser based analytics and search dashboard for OpenSearch. OpenSearch Dashboards is a snap to setup and start using. OpenSearch Dashboards strives to be easy to get started with, while also being flexible and powerful, just like OpenSearch.",
"keywords": [
"opensearch-dashboards",
"opensearch",
"logstash",
"analytics",
"visualizations",
"dashboards",
"dashboarding"
],
"version": "2.4.1",
"branch": "2.4",
"build": {
"number": 44000,
"sha": "ea36827cdedf1e726e7cb8315ffc49f73f9b4eb7",
"distributable": true,
"release": true
},
"repository": {
"type": "git",
"url": "https://github.com/opensearch-project/opensearch-dashboards.git"
},
"engines": {
"node": "14.20.0"
}
}
Blocked: Waiting for response from the @wazuh/frontend team
After checking with the frontend team, they told me that the revision change has to be done in 2 files in the app, after executing changes and testing the error keeps appearing, I attach the results:
/usr/share/wazuh-dashboard/package.json
{
"name": "opensearch-dashboards",
"description": "OpenSearch Dashboards is a browser based analytics and search dashboard for OpenSearch. OpenSearch Dashboards is a snap to setup and start using. OpenSearch Dashboards strives to be easy to get started with, while also being flexible and powerful, just like OpenSearch.",
"keywords": [
"opensearch-dashboards",
"opensearch",
"logstash",
"analytics",
"visualizations",
"dashboards",
"dashboarding"
],
"version": "2.4.1",
"branch": "2.4",
"build": {
"number": 44000,
"sha": "ea36827cdedf1e726e7cb8315ffc49f73f9b4eb7",
"distributable": true,
"release": true
},
"repository": {
"type": "git",
"url": "https://github.com/opensearch-project/opensearch-dashboards.git"
},
"engines": {
"node": "14.20.0"
}
}
/usr/share/wazuh-dashboard/plugins/wazuh/opensearch_dashboards.json
{
"id": "wazuh",
"version": "4.4.0-00",
"opensearchDashboardsVersion": "2.4.1",
"configPath": [
"wazuh"
],
"requiredPlugins": [
"navigation",
"data",
"discover",
"inspector",
"visualizations",
"uiActions",
"charts",
"savedObjects",
"opensearchDashboardsReact",
"opensearchDashboardsUtils",
"opensearchDashboardsLegacy"
],
"optionalPlugins": [
"security",
"securityDashboards",
"searchguard",
"telemetry"
],
"server": true,
"ui": true
}
/usr/share/wazuh-dashboard/plugins/wazuh/package.json
{
"name": "wazuh",
"version": "4.4.0",
"revision": "00",
"code": "alpha2",
"pluginPlatform": {
"version": "2.4.1"
},
"description": "Wazuh dashboard",
"keywords": [
"opensearch_dashboards",
"wazuh",
"ossec"
],
"node_build": "10.23.1",
"author": "Wazuh, Inc",
"license": "GPL-2.0",
"repository": {
"type": "git",
"url": "https://github.com/wazuh/wazuh-kibana-app.git"
},
"bugs": {
"url": "https://github.com/wazuh/wazuh-kibana-app/issues"
},
"homepage": "https://www.wazuh.com/",
"scripts": {
"lint": "eslint {public,server,common}/**/*.{js,jsx,ts,tsx,json}",
"lint:public": "eslint public/**/*.{js,jsx,ts,tsx,json}",
"lint:server": "eslint server/**/*.{js,jsx,ts,tsx,json}",
"lint:common": "eslint common/**/*.{js,jsx,ts,tsx,json}",
"lint:fix": "eslint --fix '{public,server,common}/**/*.{js,jsx,ts,tsx,json}'",
"format": "prettier --write '{public,server,common}/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
"kbn": "node ../../scripts/kbn",
"es": "node ../../scripts/es",
"start": "plugin-helpers start",
"build": "yarn plugin-helpers build --opensearch-dashboards-version=$OPENSEARCH_DASHBOARDS_VERSION",
"plugin-helpers": "node ../../scripts/plugin_helpers",
"test:ui:runner": "node ../../scripts/functional_test_runner.js",
"test:server": "plugin-helpers test:server",
"test:browser": "plugin-helpers test:browser",
"test:jest": "node scripts/jest",
"generate:api-4.0-info": "cd scripts/generate-api-4.0-info;./generate-api-4.0-info.sh;cd ../..",
"prebuild": "node scripts/generate-build-version"
},
"dependencies": {
"angular-animate": "1.7.8",
"angular-material": "1.1.18",
"axios": "^0.21.1",
"install": "^0.10.1",
"js2xmlparser": "^3.0.0",
"json2csv": "^4.1.2",
"jwt-decode": "^2.2.0",
"loglevel": "^1.7.1",
"markdown-it-link-attributes": "^3.0.0",
"md5": "^2.3.0",
"needle": "^2.0.1",
"node-cron": "^1.1.2",
"pdfmake": "0.2.6",
"pug-loader": "^2.4.0",
"querystring-browser": "1.0.4",
"react-codemirror": "^1.0.0",
"react-cookie": "^4.0.3",
"read-last-lines": "^1.7.2",
"timsort": "^0.3.0",
"typescript": "^4.4.2",
"winston": "3.5.1"
},
"devDependencies": {
"@types/node-cron": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "2.7.1",
"eslint-plugin-async-await": "^0.0.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-filenames-simple": "^0.7.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.7.1",
"redux-mock-store": "^1.5.4",
"tslint": "^5.11.0",
"typescript-eslint-parser": "^18.0.0"
},
"opensearchDashboards": {
"version": "2.4.1"
}
}
Blocked: Waiting for response from the https://github.com/orgs/wazuh/teams/frontend team
root@ubuntu20:~# cat /usr/share/wazuh-dashboard/package.json
{
"name": "opensearch-dashboards",
"description": "OpenSearch Dashboards is a browser based analytics and search dashboard for OpenSearch. OpenSearch Dashboards is a snap to setup and start using. OpenSearch Dashboards strives to be easy to get started with, while also being flexible and powerful, just like OpenSearch.",
"keywords": [
"opensearch-dashboards",
"opensearch",
"logstash",
"analytics",
"visualizations",
"dashboards",
"dashboarding"
],
"version": "2.4.1",
"branch": "2.4",
"build": {
"number": 44001,
"sha": "ea36827cdedf1e726e7cb8315ffc49f73f9b4eb7",
"distributable": true,
"release": true
},
"repository": {
"type": "git",
"url": "https://github.com/opensearch-project/opensearch-dashboards.git"
},
"engines": {
"node": "14.20.0"
}
}
+ jq-linux64 '.build.number=%{buildnumber}' /build/rpmbuild/BUILDROOT/wazuh-dashboard-4.4.0-1.x86_64/usr/share/wazuh-dashboard/package.json
jq: error: syntax error, unexpected '%' (Unix shell quoting issues?) at <top-level>, line 1:
.build.number=%{buildnumber}
jq: 1 compile error
error: Bad exit status from /var/tmp/rpm-tmp.HwleD0 (%install)
Description
It is necessary that the build number of the Wazuh dashboard packages.json matches that of the Wazuh plugin, for this, it is necessary to modify the construction of the base to remove the lines: https://github.com/wazuh/wazuh-packages/blob/ee55f21fed27ecfa9603a3523854ac99a3a2f101/stack/dashboard/base/builder.sh#L128-L130
and move them to the specs to be done after the plugin installation
Tasks
Validation