Skip to content

build(livekit): [email protected] and build it from source, + - #23351

Merged
prlanzarin merged 6 commits into
bigbluebutton:v3.0.x-releasefrom
prlanzarin:u30/fix/lk-190-cdeps
Jun 10, 2025
Merged

prlanzarin merged 6 commits into
bigbluebutton:v3.0.x-releasefrom
prlanzarin:u30/fix/lk-190-cdeps

Conversation

@prlanzarin

@prlanzarin prlanzarin commented Jun 10, 2025 •

Copy link
Copy Markdown
Member

What does this PR do?

Closes Issue(s)

None

Motivation

#21059

How to test

More

  • Added/updated documentation

Add more information to LK's screnshare bridge logs so that it's easier
to debug in production:
  - Guarantee trackSid, streamData, source, streamId are present in all
    relevant logs
  - Refactor log messages to be more consistent with other LK bridges
The selective subscription hooks currently rely on remote participants
only for defining the desired vs current subscription maps.
Those remove participants are filtered to avoid spurious updates, but
the filter is too restrictive and may be impacting our ability to react
to subscription failures, upstream publication state changes et al.

Extend the participant filters with additional events so that the local
refs are more frequently updated. We'll track metrics and log data to see
if this improves the subscription situation.

Additionally: extend the camera bridge track filter as well for the same
reasons above.
livekit-server's binary is currently pulled directly from GitHub. This
works, but we'd like to have the ability to test LiveKit builds that are
not necessarily tied to tags (e.g.: commits).

Adjust bbb-livekit's build script so that livekit-server is built from
source. Upstream's build instructions (via mage) were followed.
@prlanzarin prlanzarin added this to the Release 3.0 milestone Jun 10, 2025
@coderabbitai

coderabbitai Bot commented Jun 10, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce new event handlers and enhance logging across several modules related to LiveKit integration. In the audio bridge, a handler for track subscription status changes is added, logging detailed track information. The screenshare bridge now handles local track publication events with enriched logging, and removes a redundant publication start log. Logging in error cases for media streams is improved by explicitly indicating stream validity. UI components for selective subscription and camera tracks expand their event filters to react to a broader set of LiveKit room and track events. The build script is overhauled to build LiveKit server and SIP components from source, update versioning, and improve robustness and error handling. The LiveKit configuration file is updated to add a new TCP fallback parameter, adjust audio active level, and include additional codecs.

Sequence Diagram(s)

LiveKitAudioBridge: Handling Track Subscription Status Changes

sequenceDiagram
    participant LiveKitRoom
    participant LiveKitAudioBridge

    LiveKitRoom->>LiveKitAudioBridge: TrackSubscriptionStatusChanged(publication, status)
    LiveKitAudioBridge->>LiveKitAudioBridge: handleTrackSubscriptionStatusChanged(publication, status)
    LiveKitAudioBridge->>LiveKitAudioBridge: Log track SID, name, role, and status
Loading

LiveKitScreenshareBridge: Handling Local Track Published Event

sequenceDiagram
    participant LocalParticipant
    participant LiveKitScreenshareBridge

    LocalParticipant->>LiveKitScreenshareBridge: LocalTrackPublished(publication)
    LiveKitScreenshareBridge->>LiveKitScreenshareBridge: handleLocalTrackPublished(publication)
    LiveKitScreenshareBridge->>LiveKitScreenshareBridge: Log track SID, name, and stream data
Loading

UI Components: Expanded Event Filtering for Updates

sequenceDiagram
    participant LiveKitRoom
    participant UIComponent

    LiveKitRoom->>UIComponent: ParticipantConnected/Disconnected
    LiveKitRoom->>UIComponent: ConnectionStateChanged
    LiveKitRoom->>UIComponent: TrackPublished/Unpublished
    LiveKitRoom->>UIComponent: TrackSubscriptionPermissionChanged
    LiveKitRoom->>UIComponent: TrackSubscriptionStatusChanged
    LiveKitRoom->>UIComponent: TrackSubscribed/Unsubscribed
    LiveKitRoom->>UIComponent: TrackSubscriptionFailed
    UIComponent->>UIComponent: Update state/UI as needed
Loading

Build Script: Building LiveKit Components from Source

sequenceDiagram
    participant BuildScript
    participant SourceArchive
    participant BuildDir
    participant StagingDir

    BuildScript->>SourceArchive: Download livekit-server and livekit-sip source archives
    BuildScript->>BuildDir: Extract archives
    BuildScript->>BuildDir: Build livekit-server (bootstrap.sh, mage)
    BuildScript->>BuildDir: Build livekit-sip (go build)
    BuildDir->>StagingDir: Copy built binaries
    BuildScript->>BuildDir: Clean up temporary directories
    BuildScript->>BuildScript: Package binaries
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 877555a and 0a73d38.

📒 Files selected for processing (1)
  • build/packages-template/bbb-livekit/livekit.yaml (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • build/packages-template/bbb-livekit/livekit.yaml
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-freeswitch)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: build-package (bbb-etherpad)
  • GitHub Check: build-package (bbb-playback-record)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Tweak default configs with:
  - RED and RTX enable by default at the server side
  - TCP fallback disabled by default
  - Audio activity threshold slightly lowered

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (12)
build/packages-template/bbb-livekit/build.sh (12)

3-3: Avoid relying on pwd for package metadata.
Parsing TARGET from the current working directory name is brittle—consider passing it as an explicit argument or validating its format before use.


5-5: Ensure consistent version prefixing.
SERVER_VERSION is defined as v1.9.0 while CLI_VERSION omits the v prefix. Unify version formatting across variables.


7-7: Consistent prefix for SIP_VERSION.
SIP_VERSION includes a leading v; match the chosen versioning style (with or without v) for all components.


13-15: Use a dedicated temporary staging directory.
Defining DESTDIR inside $PWD risks polluting source folders. Consider using mktemp -d for the entire staging area and cleaning it up automatically.


25-27: Use install for consistent file permissions.
Replace mkdir + cp with:

install -Dm644 livekit.nginx "$DESTDIR/usr/share/bigbluebutton/nginx/livekit.nginx"

to set directory and file permissions in one step.


28-30: Use install for systemd units.
Likewise, install service definitions with:

install -Dm644 livekit-server.service livekit-sip.service "$DESTDIR/lib/systemd/system/"

for cleaner permission handling.


46-49: Redirect error messages to stderr.
Echoing errors without redirecting can mix logs. Change:

echo "Error: Could not find livekit-server directory in extracted archive"

to

echo "Error: Could not find livekit-server directory in extracted archive" >&2

53-64: Streamline Go build environment setup.
Rather than exporting each variable in a subshell block, consider a one-liner:

GOPATH="/tmp/go-${TARGET}" GOBIN="$GOPATH/bin" PATH="$GOBIN:$PATH" \
  mage -v

This reduces boilerplate and ensures the environment is isolated.


66-68: Use install for the built binary.
Replace:

cp "$LIVEKIT_DIR/bin/livekit-server" "$DESTDIR/usr/bin"

with:

install -Dm755 "$LIVEKIT_DIR/bin/livekit-server" "$DESTDIR/usr/bin/livekit-server"

79-82: Consistently redirect SIP errors to stderr.
Mirror the livekit-server error handling:

echo "Error: Could not find livekit-sip directory in extracted archive" >&2; exit 1

86-90: Consider supporting more TARGETPLATFORM values.
The script only handles linux/arm64 and defaults to amd64. If you plan to build for arm/v7 or others, extend this logic or derive GOARCH directly from $TARGETPLATFORM.


92-94: Optimize Go build flags and installation.
Strip debug symbols with -ldflags '-s -w' to reduce binary size, and use install:

CGO_ENABLED=1 GOOS=linux GOARCH="${GOARCH}" go build -ldflags '-s -w' -o livekit-sip ./cmd/livekit-sip
install -Dm755 livekit-sip "$DESTDIR/usr/bin/livekit-sip"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db6fed9 and 877555a.

📒 Files selected for processing (6)
  • bigbluebutton-html5/imports/api/audio/client/bridge/livekit.ts (4 hunks)
  • bigbluebutton-html5/imports/api/screenshare/client/bridge/livekit.ts (11 hunks)
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/video-provider/livekit-camera-bridge/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/utils/media-stream-utils.js (2 hunks)
  • build/packages-template/bbb-livekit/build.sh (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
bigbluebutton-html5/imports/api/screenshare/client/bridge/livekit.ts (2)
bigbluebutton-html5/imports/ui/components/screenshare/service.js (5)
  • screenShareEndAlert (354-357)
  • screenShareEndAlert (354-357)
  • track (113-113)
  • stream (250-250)
  • stream (300-300)
bigbluebutton-html5/imports/utils/media-stream-utils.js (1)
  • track (45-45)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (others)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (18)
bigbluebutton-html5/imports/ui/components/video-provider/livekit-camera-bridge/component.tsx (1)

106-107: LGTM! Enhanced subscription event handling

The addition of TrackSubscriptionStatusChanged, TrackSubscriptionPermissionChanged, and TrackSubscriptionFailed events to the updateOnlyOn array improves the component's responsiveness to track subscription lifecycle events. This aligns well with similar enhancements in other LiveKit components throughout the codebase.

bigbluebutton-html5/imports/utils/media-stream-utils.js (2)

77-77: LGTM! Explicit validity indication

Adding the valid: true property to the success case provides explicit validity status for media stream data, improving error handling and logging throughout the application.


94-94: LGTM! Consistent error handling

The valid: false property in the error case maintains consistency with the success case and provides clear validity indication for error scenarios.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)

36-45: LGTM! Comprehensive event filtering

The expansion of PARTICIPANTS_UPDATE_FILTER to include participant lifecycle events (ParticipantConnected, ParticipantDisconnected) and subscription-related events significantly improves the responsiveness of the selective subscription system. This aligns with the broader pattern of enhanced event handling across LiveKit components.

bigbluebutton-html5/imports/api/audio/client/bridge/livekit.ts (4)

73-73: LGTM! Proper method binding

The binding of handleTrackSubscriptionStatusChanged in the constructor follows the established pattern in the class.


210-228: LGTM! Well-implemented event handler

The handleTrackSubscriptionStatusChanged method properly filters for microphone publications and provides detailed logging with relevant context including trackSid, trackName, and subscription status. The implementation is consistent with other event handlers in the class.


307-307: LGTM! Proper event registration

The event listener registration for TrackSubscriptionStatusChanged is correctly placed in the observeLiveKitEvents method.


320-320: LGTM! Proper cleanup

The event listener deregistration in removeLiveKitObservers ensures proper cleanup and prevents memory leaks.

bigbluebutton-html5/imports/api/screenshare/client/bridge/livekit.ts (8)

15-15: LGTM! Import addition

The addition of ParticipantEvent import is necessary for the new local track published event handling.


114-114: LGTM! Proper method binding

The binding of handleLocalTrackPublished in the constructor follows the established pattern.


242-258: LGTM! Dedicated local track publication handler

The new handleLocalTrackPublished method provides dedicated logging for local track publications with comprehensive context including trackSid, trackName, and stream data. This improves observability for screen share events.


221-221: LGTM! Enhanced logging context

The addition of trackName to the destructuring and inclusion of streamData in the logging provides better traceability and debugging information for screen share unpublication events.

Also applies to: 230-234


282-282: LGTM! Improved subscription logging

The enhanced logging in handleTrackSubscribed with trackName and streamId provides better context for debugging subscription events.

Also applies to: 289-295


304-304: LGTM! Consistent unsubscription logging

The enhanced logging in handleTrackUnsubscribed maintains consistency with the subscription handler and provides comprehensive context for debugging.

Also applies to: 310-316


340-340: LGTM! Proper event handling

The registration and deregistration of the LocalTrackPublished event listener is correctly implemented, ensuring proper lifecycle management.

Also applies to: 352-352


533-533: LGTM! Enhanced error logging context

The addition of streamId, contentType, and streamData to error logging provides valuable context for debugging screenshare initialization and exit issues.

Also applies to: 593-595, 639-639

build/packages-template/bbb-livekit/build.sh (2)

35-35: (Trivial mkdir -p; no further changes needed.)


96-97: (Cleanup via rm -rf "$buildbase" is straightforward.)

Comment on lines +9 to 12
PACKAGE=$(echo "$TARGET" | cut -d'_' -f1)
VERSION=$(echo "$TARGET" | cut -d'_' -f2)
DISTRO=$(echo "$TARGET" | cut -d'_' -f3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden parsing of TARGET components.
Splitting TARGET on underscores breaks if any component contains _. Use a more robust method—e.g.,

IFS='_' read -r PACKAGE VERSION DISTRO <<< "$TARGET"

or accept explicit parameters.

🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 9 to 12, the
current method of splitting the TARGET variable using cut with underscores fails
if any component contains underscores. Replace the three separate cut commands
with a single read command using IFS='_' to split TARGET into PACKAGE, VERSION,
and DISTRO variables robustly. This ensures correct parsing even if components
contain underscores.

Comment on lines +22 to +23
# shellcheck disable=SC1090
. "./opts-$DISTRO.sh"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Handle missing distro-specific options file.
Before sourcing opts-$DISTRO.sh, verify it exists to avoid a silent failure. For example:

if [[ -f "./opts-$DISTRO.sh" ]]; then
  source "./opts-$DISTRO.sh"
else
  echo "Error: opts-$DISTRO.sh not found" >&2; exit 1
fi
🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 22 to 23, the
script sources the file opts-$DISTRO.sh without checking if it exists, which can
cause silent failures. Modify the script to first check if the file
./opts-$DISTRO.sh exists using a conditional test, and only source it if
present. If the file is missing, print an error message to stderr and exit the
script with a non-zero status to prevent further execution.

Comment on lines +19 to +20
rm -rf "$DESTDIR"
mkdir -p "$DESTDIR"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add safety checks before rm -rf.
Unconditional rm -rf "$DESTDIR" may delete unintended paths if DESTDIR is empty or mis-set. Add a sanity check, e.g.:

[[ "$DESTDIR" =~ /staging$ ]] || { echo "Invalid DESTDIR" >&2; exit 1; }
🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 19 to 20, the
script unconditionally runs rm -rf on the DESTDIR variable, which risks deleting
unintended directories if DESTDIR is empty or incorrect. Add a safety check
before the rm command to verify that DESTDIR ends with /staging or matches an
expected pattern. If the check fails, print an error message to stderr and exit
with a non-zero status to prevent accidental deletions.

Comment on lines +37 to 39
# Pull built lk cli from github
curl "https://github.com/livekit/livekit-cli/releases/download/v${CLI_VERSION}/lk_${CLI_VERSION}_linux_amd64.tar.gz" -Lo - | tar -C "$DESTDIR/usr/bin" -xzf - lk

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve robustness of curl download.
Add --fail --silent --show-error and retry logic to avoid partial downloads:

curl -fSL --retry 3 "https://github.com/livekit/livekit-cli/releases/download/v${CLI_VERSION}/lk_${CLI_VERSION}_linux_amd64.tar.gz" \
  | tar -C "$DESTDIR/usr/bin" -xzf - lk
🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 37 to 39, the curl
command downloading the livekit CLI lacks options for robust error handling and
retries. Update the curl command to include --fail, --silent, and --show-error
flags to properly handle HTTP errors and suppress unnecessary output, and add
--retry 3 to attempt the download up to three times on failure. This will
prevent partial or failed downloads and improve script reliability.

Comment on lines 74 to +77
buildbase=$(mktemp -d)
curl https://github.com/livekit/sip/archive/refs/tags/v${SIP_VERSION}.tar.gz -Lo - | tar -xzf - -C $buildbase
pushd $buildbase/sip-${SIP_VERSION}

if [ "$TARGETPLATFORM" = "linux/arm64" ]; then GOARCH=arm64; else GOARCH=amd64; fi && \
CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} GO111MODULE=on go build -a -o livekit-sip ./cmd/livekit-sip

cp livekit-sip $DESTDIR/usr/bin

popd
rm -rf $buildbase

fpm -s dir -C $DESTDIR -n $PACKAGE \
--version $VERSION --epoch 2 \
--before-install before-install.sh \
--after-install after-install.sh \
--before-remove before-remove.sh \
--after-remove after-remove.sh \
curl "https://github.com/livekit/sip/archive/${SIP_VERSION}.tar.gz" -Lo - | tar -xzf - -C "$buildbase"
# Get livekit-sip's directory name from the extracted archive
SIP_DIR=$(find "$buildbase" -maxdepth 1 -type d -name "sip-*" | head -n 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve curl invocation for SIP source.
Apply the same robust pattern to avoid incomplete downloads:

curl -fSL --retry 3 "https://github.com/livekit/sip/archive/${SIP_VERSION}.tar.gz" \
  | tar -xzf - -C "$buildbase"
🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 74 to 77, the curl
command downloading the SIP source lacks flags for robustness and retry logic.
Update the curl invocation to include -fSL and --retry 3 options to ensure it
fails on HTTP errors, follows redirects, shows progress, and retries up to 3
times on transient failures. Replace the current curl command with this improved
pattern while keeping the tar extraction unchanged.

Comment on lines +100 to +107
fpm -s dir -C "$DESTDIR" -n "$PACKAGE" \
--version "$VERSION" --epoch 2 \
--before-install before-install.sh \
--after-install after-install.sh \
--before-remove before-remove.sh \
--after-remove after-remove.sh \
--description "BigBlueButton build of LiveKit Server" \
$DIRECTORIES \
$DIRECTORIES \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Validate FPM variables and quoting.
Ensure $DIRECTORIES and $OPTS are defined and safely expanded; unquoted expansions can lead to word-splitting bugs. For example:

: "${DIRECTORIES:?DIRECTORIES is not set}"
: "${OPTS:?OPTS is not set}"
fpm -s dir -C "$DESTDIR" -n "$PACKAGE" \
  --version "$VERSION" --epoch 2 \
  --before-install before-install.sh \
  --after-install after-install.sh \
  --before-remove before-remove.sh \
  --after-remove after-remove.sh \
  --description "BigBlueButton build of LiveKit Server" \
  "${DIRECTORIES[@]}" \
  "${OPTS[@]}"
🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 100 to 107, ensure
that the variables DIRECTORIES and OPTS are defined before use to prevent
errors. Add validation lines using parameter expansion to check if these
variables are set. Also, when passing these variables to the fpm command, quote
them properly as arrays (e.g., "${DIRECTORIES[@]}" and "${OPTS[@]}") to avoid
word-splitting and globbing issues.

Comment on lines +41 to +45
buildbase=$(mktemp -d)
curl "https://github.com/livekit/livekit/archive/${SERVER_VERSION}.tar.gz" -Lo - | tar -xzf - -C "$buildbase"
# Get livekit-server's directory name from the extracted archive
LIVEKIT_DIR=$(find "$buildbase" -maxdepth 1 -type d -name "livekit-*" | head -n 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enable pipefail for safer pipelines.
Shebang uses -e, but pipelines may mask failures. Add set -o pipefail near the top to catch errors in curl | tar and similar constructs.

🤖 Prompt for AI Agents
In build/packages-template/bbb-livekit/build.sh around lines 41 to 45, the
script uses a pipeline with curl and tar but does not have pipefail enabled,
which can mask failures in the pipeline. To fix this, add `set -o pipefail` near
the top of the script, ideally after the shebang and any existing `set -e` to
ensure that any failure in a pipeline command is properly detected and causes
the script to exit.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@prlanzarin
prlanzarin merged commit e67dfd7 into bigbluebutton:v3.0.x-release Jun 10, 2025
@prlanzarin
prlanzarin deleted the u30/fix/lk-190-cdeps branch June 10, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant