Skip to content

Commit

Permalink
jenkinsfile: fix paths for all steps
Browse files Browse the repository at this point in the history
Since nix shell function from jenkins librarz uses WORKSPACE env
variable to find shell.nix we need to override it for steps using nix
shell. For all of the steps I'm using dir directive to change cwd to the
apps/connector.

Referenced issue: #590

Signed-off-by: markoburcul <[email protected]>
  • Loading branch information
markoburcul committed Oct 10, 2024
1 parent 8cf67b1 commit 0d89bf4
Showing 1 changed file with 38 additions and 18 deletions.
56 changes: 38 additions & 18 deletions apps/connector/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,60 @@ pipeline {

stages {
stage('Install') {
steps { script {
nix.shell('yarn install --frozen-lockfile', pure: false)
} }
steps {
dir("${env.WORKSPACE}/apps/connector") {
script {
withEnv(["WORKSPACE=${env.WORKSPACE}/apps/connector"]) { // Override WORKSPACE
nix.shell('yarn install --frozen-lockfile', pure: false)
}
}
}
}
}

stage('Build') {
steps { script {
nix.shell('yarn build:chrome', pure: false)
} }
steps {
dir("${env.WORKSPACE}/apps/connector") {
script {
withEnv(["WORKSPACE=${env.WORKSPACE}/apps/connector"]) { // Override WORKSPACE
nix.shell('yarn build:chrome', pure: false)
}
}
}
}
}

stage('Zip') {
steps {
zip(
zipFile: env.ZIP_NAME,
dir: 'build/chrome-mv3-prod',
archive: false,
)
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
zip(
zipFile: env.ZIP_NAME,
dir: 'build/chrome-mv3-prod',
archive: false,
)
}
}
}

stage('Archive') {
steps {
archiveArtifacts(
artifacts: env.ZIP_NAME,
fingerprint: true,
)
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
archiveArtifacts(
artifacts: env.ZIP_NAME,
fingerprint: true,
)
}
}
}

stage('Upload') {
steps { script {
env.PKG_URL = s5cmd.upload(env.ZIP_NAME)
} }
steps {
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
script {
env.PKG_URL = s5cmd.upload(env.ZIP_NAME)
}
}
}
}
}

Expand Down

0 comments on commit 0d89bf4

Please sign in to comment.