wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
99 stars 90 forks source link

Change the build number of the Wazuh dashboard packages.json with the same as the Wazuh plugin #2012

Closed c-bordon closed 1 year ago

c-bordon commented 1 year ago

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

c-bordon commented 1 year ago

Update Report

Tasks

c-bordon commented 1 year ago

Update Report

Tasks

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

Screenshot_20230102_145115

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"
  }
}
c-bordon commented 1 year ago

Blocked: Waiting for response from the @wazuh/frontend team

c-bordon commented 1 year ago

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"
  }
}

image

c-bordon commented 1 year ago

Blocked: Waiting for response from the https://github.com/orgs/wazuh/teams/frontend team

c-bordon commented 1 year ago

Update Report

Tasks

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"
  }
}

Next steps

+ 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)