Skip to content

Docker: Remove Hub GraphQL dependency from video recorder #2813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented May 1, 2025

User description

Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

After the fix [java] Add "se" prefixed capabilities to session response (SeleniumHQ/selenium#14323) available from version 4.24+
All capabilities with prefix se: could be seen in Node /status session capabilities.
Video recorder to get file name via cap se:name, or se:videoName no need to extract from Hub GraphQL anymore.
Container video recorder also no need to pass ENV variable of Hub GraphQL anymore.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement


Description

  • Remove Hub GraphQL dependency from video recorder logic

    • Use session capabilities from Node /status endpoint
    • Eliminate need for Hub GraphQL ENV variable
  • Add new script to extract video recording info from capabilities

    • Determine video file name and recording flag from session capabilities

Changes walkthrough 📝

Relevant files
Enhancement
video.sh
Refactor video recorder to use Node session capabilities 

Video/video.sh

  • Refactored to fetch session info from Node /status endpoint, not
    GraphQL
  • Added logic to extract video recording info from session capabilities
  • Removed all Hub GraphQL endpoint and ENV variable usage
  • Integrated new script for video file name and recording flag
    extraction
  • +12/-13 
    video_nodeQuery.sh
    Add script to parse video recording info from capabilities

    Video/video_nodeQuery.sh

  • New script to extract video recording flag and file name from session
    capabilities
  • Determines file name based on se:name or se:videoName capabilities
  • Normalizes and formats the video file name
  • Outputs recording flag and file name for use by other scripts
  • +49/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    qodo-merge-pro bot commented May 1, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The script doesn't handle the case where session_capabilities might be empty or null when trying to use it with jq. This could cause unexpected behavior if the status endpoint returns incomplete data.

    return_list=($(bash "${VIDEO_CONFIG_DIRECTORY}/video_nodeQuery.sh" "${session_id}" "${session_capabilities}"))
    caps_se_video_record="${return_list[0]}"
    Default Value

    The script doesn't set a default value for SESSION_CAPABILITIES if it's not provided as an argument, which could lead to errors when the script is called without the second parameter.

    SESSION_CAPABILITIES=$2
    

    Copy link

    qodo-merge-pro bot commented May 1, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix character class syntax

    The character class syntax is incorrect for tr. The pattern [:alnum:]-_ should
    be enclosed in square brackets for tr to properly interpret it as a set of
    characters to keep.

    Video/video_nodeQuery.sh [10]

    -VIDEO_FILE_NAME_TRIM=${SE_VIDEO_FILE_NAME_TRIM_REGEX:-"[:alnum:]-_"}
    +VIDEO_FILE_NAME_TRIM=${SE_VIDEO_FILE_NAME_TRIM_REGEX:-"[:alnum:]_-"}
    • Apply this suggestion
    Suggestion importance[1-10]: 3

    __

    Why: The suggestion correctly identifies that placing a hyphen (-) at the end of a tr character set ([:alnum:]_-) is safer and more portable than placing it elsewhere ([:alnum:]-_), although the original syntax often works. This is a minor improvement for robustness.

    Low
    • Update

    Copy link

    qodo-merge-pro bot commented May 1, 2025

    CI Feedback 🧐

    (Feedback updated until commit 10c1a3a)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: Rerun workflow when failure

    Failed stage: Authenticate GitHub CLI for PR [❌]

    Failure summary:

    The action failed because the GitHub token provided for authentication lacks the required 'read:org'
    scope. The error occurred during the gh auth login --with-token command (line 176), which was unable
    to validate the token due to insufficient permissions.

    Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    22:  Issues: write
    23:  Metadata: read
    24:  Models: read
    25:  Packages: write
    26:  Pages: write
    27:  PullRequests: write
    28:  RepositoryProjects: write
    29:  SecurityEvents: write
    30:  Statuses: write
    31:  ##[endgroup]
    32:  Secret source: Actions
    33:  Prepare workflow directory
    34:  Prepare all required actions
    35:  Getting action download info
    36:  Download action repository 'actions/checkout@main' (SHA:85e6279cec87321a52edac9c87bce653a07cf6c2)
    37:  Complete job name: Rerun workflow when failure
    38:  ##[group]Run actions/checkout@main
    ...
    
    42:  ssh-strict: true
    43:  ssh-user: git
    44:  persist-credentials: true
    45:  clean: true
    46:  sparse-checkout-cone-mode: true
    47:  fetch-depth: 1
    48:  fetch-tags: false
    49:  show-progress: true
    50:  lfs: false
    51:  submodules: false
    52:  set-safe-directory: true
    53:  env:
    54:  GH_CLI_TOKEN: ***
    55:  GH_CLI_TOKEN_PR: ***
    56:  RUN_ID: 14771084141
    57:  RERUN_FAILED_ONLY: true
    58:  RUN_ATTEMPT: 1
    ...
    
    113:  Or undo this operation with:
    114:  git switch -
    115:  Turn off this advice by setting config variable advice.detachedHead to false
    116:  HEAD is now at 83b8aaf Merge 10c1a3a13620697565f292342503edc6529b7d38 into cdbf770c615cec5af79bf7cdb840d17bebe8c773
    117:  ##[endgroup]
    118:  [command]/usr/bin/git log -1 --format=%H
    119:  83b8aaf566304877d8e289516e09acb08c8b9e51
    120:  ##[group]Run sudo apt update
    121:  �[36;1msudo apt update�[0m
    122:  �[36;1msudo apt install gh�[0m
    123:  shell: /usr/bin/bash -e {0}
    124:  env:
    125:  GH_CLI_TOKEN: ***
    126:  GH_CLI_TOKEN_PR: ***
    127:  RUN_ID: 14771084141
    128:  RERUN_FAILED_ONLY: true
    129:  RUN_ATTEMPT: 1
    ...
    
    158:  Reading state information...
    159:  37 packages can be upgraded. Run 'apt list --upgradable' to see them.
    160:  WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    161:  Reading package lists...
    162:  Building dependency tree...
    163:  Reading state information...
    164:  gh is already the newest version (2.71.2).
    165:  0 upgraded, 0 newly installed, 0 to remove and 37 not upgraded.
    166:  ##[group]Run echo "$GH_CLI_TOKEN_PR" | gh auth login --with-token
    167:  �[36;1mecho "$GH_CLI_TOKEN_PR" | gh auth login --with-token�[0m
    168:  shell: /usr/bin/bash -e {0}
    169:  env:
    170:  GH_CLI_TOKEN: ***
    171:  GH_CLI_TOKEN_PR: ***
    172:  RUN_ID: 14771084141
    173:  RERUN_FAILED_ONLY: true
    174:  RUN_ATTEMPT: 1
    175:  ##[endgroup]
    176:  error validating token: missing required scope 'read:org'
    177:  ##[error]Process completed with exit code 1.
    178:  Post job cleanup.
    

    Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
    @VietND96 VietND96 force-pushed the recorder-remove-graphql branch from 3b5e9df to 10c1a3a Compare May 1, 2025 06:29
    @VietND96 VietND96 merged commit 7f266c4 into trunk May 1, 2025
    53 of 55 checks passed
    @VietND96 VietND96 deleted the recorder-remove-graphql branch May 1, 2025 07:45
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant