Files
openobserve/.github/workflows/playwright.yml
T
+2 0d9f47966b feat: Organization revamp (#5579)
Fixes #5131 
Addresses #5408 

### Revamp
- Created a new table to store organizations in the `organizations`
table. Earlier, we never stored organizations in any table, rather we
used to store the organizations in the meta table as part of the `user`
json.
- The users and organization membership relations are now moved to its
own separate tables - `users` and `org_users`.

### New changes

**API changes** -
- `/organizations` - `POST` api to create an org and save it in the meta
table. In non-enterprise version, currently only the root user can
create the org. For enterprise version with rbac enabled, anyone with
`CREATE` access for organizations can create the organization and
becomes an admin. Root user can always create an organization.
- `/{org_id}/rename` - `PUT` api to rename the existing org. Only root
user and the admins of the org can access this API.

The payload for following APIs are changed -
- `POST api/{org_id}/roles` - `{"name":"new_role"}` is changed to
`{"role":"new_role"}
- `POST api/{org_id}/users/{user}` -
`{"role":"viewer","custom_role":["role_name"]}` is the new payload where
`custom_role` is optional and is array of custom roles (only works in
enterprise with rbac enabled) which will be assigned to the user. The
value of `role` can be standard role or as well as any custom role (when
it is custom role, the standard role assigned to the user is decided
based on the enterprise env variable - `O2_DEX_DEFAULT_ROLE`).
- `POST api/{org_id}/users`- the payload -
```
{"email":"user@user.com","role":"viewer","custom_role":["create_org_permission"],"password":"12345678", "first_name": "", "last_name":""}
```

- `PUT api//{org_id}/users/{email_id}` the payload -
```
{"first_name":"Hello","last_name":"j","role":"viewer","isExternal":false,"change_password":false,"password":"","custom_role":["create_org_permission"]}
```


A new ENV variable is introduced - `ZO_CREATE_ORG_THROUGH_INGESTION`
(default `false`) which if true, an org will automatically created when
ingesting data to a new org. If false, user can not create org by
ingesting data to new org, they need to first call the `POST
/organizations` API.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

**New Features**
- Added a `cloud` feature for enhanced organizational management
capabilities.
- Introduced new methods for managing organizational users and
asynchronous message processing.
- Enhanced user invitation and membership features, including improved
role handling.
- Implemented configurable ingestion URL support across various
components.
- Added new functionality for user management and organization handling
in the super cluster architecture.

**Improvements**
- Refined user authentication and authorization processes, including
error handling.
- Updated database schema to support multi-organization architecture.
- Enhanced pagination settings and UI components for better user
experience.
- Improved handling of organization names and user roles in
notifications and alerts.
- Streamlined service account token management with visibility
enhancements.
- Enhanced the `AddUpdateOrganization` component with improved user
input handling and validation.
- Updated the `AppOrganizations` component to dynamically load the
appropriate organization management interface.
- Improved the `ServiceAccountsList` component with updated pagination
options and token handling logic.

**Bug Fixes**
- Resolved issues with user role assignments and organization management
inconsistencies.
- Corrected routing and navigation logic for login and logout processes.
- Addressed various error handling scenarios in user and organization
processes.
- Fixed issues with the visibility of service account options in the
`EditGroup` and `EditRole` components based on the cloud configuration.

**Breaking Changes**
- Significant restructuring of user and organization data models.
- Changes to authentication workflows and configuration handling.
- Removal of certain components related to user and organization
management.
- Updated the logic for determining the ingestion URL across various
components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Bhargav <BJP232004@GMAIL.COM>
Co-authored-by: Taiming Liu <liutaiming3@gmail.com>
Co-authored-by: hengfei yang <hengfei.yang@gmail.com>
Co-authored-by: harshiv-7 <harshiv@openobserve.ai>
Co-authored-by: Huaijin <haohuaijin@gmail.com>
Co-authored-by: Zhao.wei <weizhao029@gmail.com>
Co-authored-by: ShyamOOAI <shyam@openobserve.ai>
Co-authored-by: oasisk <ashish.j.kolhe@gmail.com>
Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yashodhan@openobserve.ai>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
2025-05-25 21:53:55 -07:00

248 lines
7.7 KiB
YAML

name: Playwright UI Tests
on:
push:
branches:
- "main"
# paths:
# - "web/**"
pull_request:
branches:
- "*"
# paths:
# - "web/**"
env:
COLUMNS: 150
ZO_ROOT_USER_EMAIL: root@example.com
ZO_ROOT_USER_PASSWORD: Complexpass#123
ZO_BASE_URL: http://localhost:5080
WS_ZO_BASE_URL: ws://localhost:5080
ZO_BASE_URL_SC: http://localhost:5080
ZO_BASE_URL_SC_UI: http://localhost:5080
INGESTION_URL: http://localhost:5080
ORGNAME: default
ZO_QUICK_MODE_NUM_FIELDS: 100
ZO_QUICK_MODE_STRATEGY: first
ZO_ALLOW_USER_DEFINED_SCHEMAS: true
ZO_INGEST_ALLOWED_UPTO: 5
ZO_FEATURE_QUERY_EXCLUDE_ALL: false
ZO_USAGE_BATCH_SIZE: 200
ZO_USAGE_PUBLISH_INTERVAL: 2
ZO_USAGE_REPORTING_ENABLED: true
ZO_MIN_AUTO_REFRESH_INTERVAL: 5
ZO_WEBSOCKET_ENABLED: true
ZO_STREAMING_ENABLED: true
ZO_COLS_PER_RECORD_LIMIT: "80000"
ZO_SMTP_ENABLED: true
ZO_FORMAT_STREAM_NAME_TO_LOWERCASE: false
ZO_CREATE_ORG_THROUGH_INGESTION: true
jobs:
build_binary:
name: build_binary
runs-on:
labels: ubicloud-standard-16
steps:
- name: Remove unused tools
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Clone the current repo
uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-03-02
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "21.12"
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Build frontend code
env:
NODE_OPTIONS: "--max-old-space-size=8192"
VITE_COVERAGE: "true"
COVERAGE: "true"
run: cd web && npm install && npm run build
- name: Build and run binary
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: debug-binary
path: target/x86_64-unknown-linux-gnu/release/openobserve
retention-days: 1
ui_integration_tests:
name: playwright_ui_integration_tests
needs: [build_binary]
runs-on:
labels: ubicloud-standard-8
container:
image: mcr.microsoft.com/playwright:v1.50.0-jammy
options: --user root
strategy:
matrix:
browser: [chrome]
testfilename: [
"alertsfolders.spec.js",
"sanity.spec.js",
"alerts.spec.js",
"schema.spec.js",
"logspage.spec.js",
"logsqueries.spec.js",
"logsquickmode.spec.js",
"multiselect-stream.spec.js",
"pipelines.spec.js",
"dashboards/custom-charts.spec.js",
"dashboards/dashboardtype.spec.js",
"dashboards/dashboard.spec.js",
"dashboards/dashboard2.spec.js",
"dashboards/visualize.spec.js",
"unflattened.spec.js",
"secondsPrecisionAdded.spec.js",
# "dashboards/visualization-vrl.spec.js",
"dashboards/dashboard-transpose.spec.js",
"dashboards/dashboard-general-setting.spec.js",
"dashboards/dashboard-variables-setting.spec.js",
"dashboards/dashboard-tabs-setting.spec.js",
"dashboards/dashboard-import.spec.js",
"reportsUpdated.spec.js",
"reportsUpdated2.spec.js",
"dashboards/dashboard-filter.spec.js",
"dashboards/dashboard-geoMap.spec.js",
"dashboards/dashboard-maps.spec.js",
"dashboards/dashboard-folder.spec.js",
"dashboards/dashboard-multi-y-axis.spec.js",
"join.spec.js",
"changeOrg.spec.js",
"serviceAccount.spec.js",
"enrichment.spec.js",
"sanity2.spec.js",
"schemaload.spec.js",
"websocket.spec.js",
"alertImportTDA.spec.js",
"streamname.spec.js",
"streaming.spec.js",
# "remotepipeline.spec.js",
]
steps:
- name: Clone the current repo
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Start OpenObserve
run: chmod +x ./debug-binary/openobserve && ./debug-binary/openobserve > o2.log 2>&1 &
- name: Wait for start
run: sleep 15
- name: Ensure we are getting a reply from the server
run: curl http://localhost:5080/web/login
- name: Create coverage json folder
run: mkdir -p tests/ui-testing/.nyc_output
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies and run ui-tests
run: |
touch .env
echo "ZO_ROOT_USER_EMAIL=${ZO_ROOT_USER_EMAIL}" >> .env
echo "ZO_ROOT_USER_PASSWORD=${ZO_ROOT_USER_PASSWORD}" >> .env
echo "ZO_BASE_URL=${ZO_BASE_URL}" >> .env
echo "WS_ZO_BASE_URL=${WS_ZO_BASE_URL}" >> .env
echo "ZO_BASE_URL_SC=${ZO_BASE_URL_SC}" >> .env
echo "ZO_BASE_URL_SC_UI=${ZO_BASE_URL_SC_UI}" >> .env
echo "INGESTION_URL=${INGESTION_URL}" >> .env
echo "ORGNAME=${ORGNAME}" >> .env
echo "ZO_SMTP_ENABLED=${ZO_SMTP_ENABLED}" >> .env
mv .env tests/ui-testing
cd tests/ui-testing && npm ci && npx playwright test ./playwright-tests/${{ matrix.testfilename }}
# - name: Check OpenObserve logs
# if: always()
# run: cat o2.log
- name: Sanitize Test Filename
shell: bash
run: |
# Assign the matrix variable to a Bash variable
SANITIZED_FILENAME="${{ matrix.testfilename }}"
# Replace all '/' characters with '_'
SANITIZED_FILENAME="${SANITIZED_FILENAME//\//_}"
# Export as a GitHub Actions environment variable
echo "SANITIZED_FILENAME=$SANITIZED_FILENAME" >> $GITHUB_ENV
- name: Upload Coverage Data
uses: actions/upload-artifact@v4
with:
name: playwright-coverage-${{ env.SANITIZED_FILENAME }}
path: tests/ui-testing/.nyc_output
include-hidden-files: true
- name: Generate Coverage Report
run: cd tests/ui-testing && npx nyc report
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
generate_coverage_report:
name: Generate Coverage Report
needs: [build_binary, ui_integration_tests]
runs-on: ubicloud-standard-8
if: always()
steps:
- name: Clone the current repo
uses: actions/checkout@v4
- name: Download Playwright Coverage Data
uses: actions/download-artifact@v4
with:
pattern: playwright-coverage-* # Match all artifacts with this prefix
path: merged-coverage
merge-multiple: true
- name: Verify Downloaded Files
run: ls -R merged-coverage # Check the structure and contents
- name: Move Coverage Files to .nyc_output
run: |
mkdir -p tests/ui-testing/.nyc_output
mv merged-coverage/* tests/ui-testing/.nyc_output/ || echo "No files to move"
- name: Generate Coverage Report
run: cd tests/ui-testing && npm ci && npx nyc report
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: tests/ui-testing/coverage-report
retention-days: 7