2024-10-03 10:06:54 +00:00
|
|
|
#!/usr/bin/env groovy
|
2024-10-10 15:47:34 +00:00
|
|
|
library 'status-jenkins-lib@v1.9.11'
|
2024-10-03 10:06:54 +00:00
|
|
|
|
2024-10-11 14:55:32 +00:00
|
|
|
def changesDetected = false
|
|
|
|
|
2024-10-03 10:06:54 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
|
|
|
timeout(time: 10, unit: 'MINUTES')
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '20',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
|
|
|
PLATFORM = 'chrome'
|
|
|
|
ZIP_NAME = utils.pkgFilename(
|
|
|
|
type: 'Extension',
|
|
|
|
version: 'none',
|
|
|
|
arch: 'chrome',
|
|
|
|
ext: 'zip',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2024-10-11 14:55:32 +00:00
|
|
|
stage('Check Changed Files') {
|
2024-10-17 10:07:19 +00:00
|
|
|
when {
|
|
|
|
changeset pattern: "apps/connector/**", comparator: "GLOB"
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
changesDetected = true
|
2024-10-11 14:55:32 +00:00
|
|
|
}
|
2024-10-17 10:07:19 +00:00
|
|
|
}
|
2024-10-11 14:55:32 +00:00
|
|
|
}
|
|
|
|
|
2024-10-03 10:06:54 +00:00
|
|
|
stage('Install') {
|
2024-10-11 14:55:32 +00:00
|
|
|
when {
|
|
|
|
expression { changesDetected }
|
|
|
|
}
|
2024-10-10 15:47:34 +00:00
|
|
|
steps {
|
|
|
|
dir("${env.WORKSPACE}/apps/connector") {
|
|
|
|
script {
|
|
|
|
nix.shell(
|
2024-11-01 18:29:14 +00:00
|
|
|
'pnpm install --frozen-lockfile',
|
2024-10-10 15:47:34 +00:00
|
|
|
pure: false,
|
|
|
|
entryPoint: "${env.WORKSPACE}/apps/connector/shell.nix"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build') {
|
2024-10-11 14:55:32 +00:00
|
|
|
when {
|
|
|
|
expression { changesDetected }
|
|
|
|
}
|
2024-10-10 15:47:34 +00:00
|
|
|
steps {
|
2024-11-14 05:50:42 +00:00
|
|
|
dir("${env.WORKSPACE}") {
|
2024-10-10 15:47:34 +00:00
|
|
|
script {
|
|
|
|
nix.shell(
|
2024-11-14 05:50:42 +00:00
|
|
|
'pnpm turbo run build --filter=connector',
|
2024-10-10 15:47:34 +00:00
|
|
|
pure: false,
|
|
|
|
entryPoint: "${env.WORKSPACE}/apps/connector/shell.nix"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Zip') {
|
2024-10-11 14:55:32 +00:00
|
|
|
when {
|
|
|
|
expression { changesDetected }
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
steps {
|
2024-10-10 15:47:34 +00:00
|
|
|
dir("${env.WORKSPACE}/apps/connector") {
|
|
|
|
zip(
|
|
|
|
zipFile: env.ZIP_NAME,
|
|
|
|
dir: 'build/chrome-mv3-prod',
|
|
|
|
archive: false,
|
|
|
|
)
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Archive') {
|
2024-10-11 14:55:32 +00:00
|
|
|
when {
|
|
|
|
expression { changesDetected }
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
steps {
|
2024-10-10 15:47:34 +00:00
|
|
|
dir("${env.WORKSPACE}/apps/connector") {
|
|
|
|
archiveArtifacts(
|
|
|
|
artifacts: env.ZIP_NAME,
|
|
|
|
fingerprint: true,
|
|
|
|
)
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Upload') {
|
2024-10-11 14:55:32 +00:00
|
|
|
when {
|
|
|
|
expression { changesDetected }
|
|
|
|
}
|
2024-10-10 15:47:34 +00:00
|
|
|
steps {
|
|
|
|
dir("${env.WORKSPACE}/apps/connector") {
|
|
|
|
script {
|
|
|
|
env.PKG_URL = s5cmd.upload(env.ZIP_NAME)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
2024-10-11 14:55:32 +00:00
|
|
|
success {
|
|
|
|
script {
|
|
|
|
if(changesDetected) {
|
2024-11-01 18:29:14 +00:00
|
|
|
github.notifyPR(true)
|
|
|
|
}
|
2024-10-11 14:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
failure {
|
|
|
|
script {
|
|
|
|
if(changesDetected) {
|
2024-11-01 18:29:14 +00:00
|
|
|
github.notifyPR(false)
|
|
|
|
}
|
2024-10-11 14:55:32 +00:00
|
|
|
}
|
|
|
|
}
|
2024-10-03 10:06:54 +00:00
|
|
|
cleanup { cleanWs() }
|
|
|
|
}
|
|
|
|
}
|