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,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)
}
}
}
}
}