From b2db8f0aa0a3efd1c8f61585e89ea6b8f5ba09bd Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Tue, 28 Jul 2026 22:16:32 +0100 Subject: [PATCH] Refactor Bun installation checks in Jenkinsfile - Renamed the function from `ensureBunInstalled` to `checkBun` for clarity. - Simplified the Bun version check process by removing installation commands, focusing solely on verifying Bun's presence. - Updated stage names in the CI pipeline to reflect the new function and improve readability. --- Jenkinsfile | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dcd584c..ae562b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,23 +16,11 @@ def withBun(Closure body) { } } -def ensureBunInstalled() { +def checkBun() { if (isUnix()) { - sh ''' - set -eu - export BUN_INSTALL="${HOME}/.bun" - export PATH="${BUN_INSTALL}/bin:${PATH}" - if ! command -v bun >/dev/null 2>&1; then - curl -fsSL https://bun.sh/install | bash - fi - bun -v - ''' + sh 'bun -v' } else { - bat ''' - where bun >nul 2>nul || %SystemRoot%/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "irm bun.sh/install.ps1 | iex" - set PATH=%USERPROFILE%/.bun/bin;%PATH% - bun -v - ''' + bat 'bun -v' } } @@ -56,8 +44,8 @@ def buildLinux() { } withBun { - stage('Setup Bun (Ubuntu)') { - ensureBunInstalled() + stage('Check Bun (Ubuntu)') { + checkBun() } stage('Install Dependencies (Ubuntu)') { @@ -90,8 +78,8 @@ def buildOnLabel(label, buildCommand) { } withBun { - stage("Setup Bun (${label})") { - ensureBunInstalled() + stage("Check Bun (${label})") { + checkBun() } stage("Install Dependencies (${label})") { @@ -127,7 +115,7 @@ def setBuildNameFromPackageVersion() { stage('Set Build Name') { checkout scm withBun { - ensureBunInstalled() + checkBun() def version = sh( script: "bun --eval \"console.log(JSON.parse(await Bun.file('package.json').text()).version)\"", returnStdout: true