jenkinsfile: fix paths for all steps

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: https://github.com/status-im/status-web/issues/590

Signed-off-by: markoburcul <marko@status.im>
This commit is contained in:
markoburcul 2024-10-10 12:57:08 +02:00
parent 8cf67b1419
commit 0d89bf4683
No known key found for this signature in database
GPG Key ID: FC4CD2F9A040D54A
1 changed files with 38 additions and 18 deletions

View File

@ -28,19 +28,32 @@ pipeline {
stages { stages {
stage('Install') { stage('Install') {
steps { script { steps {
dir("${env.WORKSPACE}/apps/connector") {
script {
withEnv(["WORKSPACE=${env.WORKSPACE}/apps/connector"]) { // Override WORKSPACE
nix.shell('yarn install --frozen-lockfile', pure: false) nix.shell('yarn install --frozen-lockfile', pure: false)
} } }
}
}
}
} }
stage('Build') { stage('Build') {
steps { script { steps {
dir("${env.WORKSPACE}/apps/connector") {
script {
withEnv(["WORKSPACE=${env.WORKSPACE}/apps/connector"]) { // Override WORKSPACE
nix.shell('yarn build:chrome', pure: false) nix.shell('yarn build:chrome', pure: false)
} } }
}
}
}
} }
stage('Zip') { stage('Zip') {
steps { steps {
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
zip( zip(
zipFile: env.ZIP_NAME, zipFile: env.ZIP_NAME,
dir: 'build/chrome-mv3-prod', dir: 'build/chrome-mv3-prod',
@ -48,20 +61,27 @@ pipeline {
) )
} }
} }
}
stage('Archive') { stage('Archive') {
steps { steps {
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
archiveArtifacts( archiveArtifacts(
artifacts: env.ZIP_NAME, artifacts: env.ZIP_NAME,
fingerprint: true, fingerprint: true,
) )
} }
} }
}
stage('Upload') { stage('Upload') {
steps { script { steps {
dir("${env.WORKSPACE}/apps/connector") { // Set the working directory to apps/connector
script {
env.PKG_URL = s5cmd.upload(env.ZIP_NAME) env.PKG_URL = s5cmd.upload(env.ZIP_NAME)
} } }
}
}
} }
} }