Compare commits

...
Author SHA1 Message Date
John Colvin 5dd1b5089a build: Add build-spark-prod-installer.Jenkinsfile 2023-07-23 23:10:56 -04:00
John Colvin 923e0f5502 fix build: Fix jenkins build script
Clean it up a bit in the process
2023-07-21 14:27:39 -04:00
John Colvin 6d45e0d494 temp 2023-07-20 00:36:40 -04:00
John Colvin a29ed2b7bd temp 2023-07-20 00:35:47 -04:00
John Colvin 3fe447dc67 Don't wipe workspace 2023-07-20 00:15:43 -04:00
John Colvin f78cb33088 wipe workspace 2023-07-19 23:45:29 -04:00
John Colvin 9c09be6ced temp 2023-07-19 23:39:31 -04:00
John Colvin a220e86e95 temp 2023-07-19 23:33:23 -04:00
John Colvin 5a2c15d4be build: Add Jenkinsfile for Spark 2023-07-19 14:55:47 -04:00
3 changed files with 163 additions and 4 deletions

No files matched your search

@@ -0,0 +1,82 @@
pipeline {
agent {
label 'os=windows && ram=8gb && installed=python3'
}
parameters {
choice(name: 'JOB', choices: ['build-spark-prod'])
string(name: 'BUILD_NUMBER', defaultValue: '', description: "The build number for which to make the installer (runs new build if blank).")
string(name: 'RELEASE_ID', defaultValue: 'latest', description: "The release id (aka version tag). For ex, 'v1.1.1'")
booleanParam(name: 'CLEAN', defaultValue: false, description: "Whether or not to perform a 'clean' build. If true, 'BUILD_NUMBER' must be blank.")
string(name: 'CONFIG_SERVER', defaultValue: "http://<server_ip>:<config_port>", description: "Default server url for the installer.")
}
stages {
stage('Validate Params') {
steps {
script {
if ("${params.BUILD_NUMBER}" != "") {
if (params.CLEAN) {
error "BUILD_NUMBER must be left blank for CLEAN builds"
}
if (!("${params.BUILD_NUMBER}" =~ "^[1-9][0-9]*\$")) {
error "BUILD_NUMBER must be positive non-zero integer (or left blank)"
}
}
if ("${params.RELEASE_ID}" == "") {
error "RELEASE_ID must not be blank"
}
}
}
}
stage('Build') {
when {
expression { params.CLEAN || params.BUILD_NUMBER == '' }
}
steps {
script {
build(
job: params.JOB,
parameters: [
booleanParam(name: 'CLEAN', value: params.CLEAN),
booleanParam(name: 'CLEAN_REPO', value: false),
booleanParam(name: 'CLEAN_VENV', value: params.CLEAN)
])
}
}
}
stage('Build Installer') {
steps {
script {
src_dir='installer_src'
out_dir='installer'
out_name="spark-${params.RELEASE_ID}"
echo 'Cleaning files leftover from previous builds'
fileOperations([
fileDeleteOperation(includes: 'publish.zip'),
folderDeleteOperation(folderPath: src_dir),
folderDeleteOperation(folderPath: out_dir)])
if (params.BUILD_NUMBER == '') {
copyArtifacts(projectName: params.JOB, selector: lastSuccessfulBuild());
} else {
copyArtifacts(projectName: params.JOB, selector: specific("${params.BUILD_NUMBER}"));
}
fileOperations([
fileUnZipOperation(filePath: 'publish.zip', targetLocation: src_dir),
fileCreateOperation(fileName: "${src_dir}\\spark.version", fileContent: params.RELEASE_ID)])
innosetup_exe="C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe"
innosetup_args = String.join(
" ",
"spark-prod-client.iss",
"/DMySourceDir=${src_dir}",
"/DMyAppVersion=${params.RELEASE_ID}",
"/DMyConfigServer=\"${params.CONFIG_SERVER}\"",
"/O${out_dir}",
"/F${out_name}");
bat "@call \"${innosetup_exe}\" ${innosetup_args}"
}
archiveArtifacts artifacts: "${out_dir}\\${out_name}.exe", followSymlinks: false, onlyIfSuccessful: true
}
}
}
}
+72
View File
@@ -0,0 +1,72 @@
pipeline {
agent {
label 'os=windows && ram=8gb && installed=vs2022 && installed=python3'
}
parameters {
booleanParam(name: 'CLEAN', defaultValue: false, description: 'Perform a clean build')
booleanParam(name: 'CLEAN_VENV', defaultValue: false, description: 'Create the python venv from scratch (delete existing)')
gitParameter(
name: 'TAG',
type: 'PT_BRANCH_TAG',
defaultValue: 'origin/spark_crypto.prod',
listSize: '0',
sortMode: 'ASCENDING_SMART')
}
stages {
stage('Build') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: "${params.TAG}"]],
extensions: [
[
$class: 'SubmoduleOption',
disableSubmodules: false,
recursiveSubmodules: true,
trackingSubmodules: true,
parentCredentials: true,
],
[
$class: 'CloneOption',
],
[
$class: 'PruneStaleBranch'
],
[
$class: 'PruneStaleTag'
],
[
$class: 'WipeWorkspace'
]
],
userRemoteConfigs: [[url: "https://john_colvin:ATBBLTcLcmD4ysvbC8D9j5sXhpMAF4312F8F@bitbucket.org/bluetradesys/spark.git"]]
])
script {
// Python venv
if ("${params.CLEAN_VENV}") {
echo "Cleaning python virtual environment..."
bat "@call rmdir /s /q .venv > nul 2>&1"
}
bat '@call tools\\ensure_venv.cmd'
// Main build
if ("${params.CLEAN}") {
echo "Cleaning build"
bat "@call rmdir /s /q .venv > nul 2>&1"
}
bat '@call tools\\jenkins_build_spark.cmd --target publish'
}
}
}
stage('Archive') {
steps {
dir ('build\\Release\\bin\\net7.0-windows\\win-x64') {
bat """
"C:\\Program Files\\7-Zip\\7z.exe" a -tzip ..\\..\\..\\..\\..\\spark.zip publish
"""
}
archiveArtifacts artifacts: 'spark.zip', followSymlinks: false, onlyIfSuccessful: true
}
}
}
}
+9 -4
View File
@@ -1,8 +1,13 @@
@echo off
@setlocal
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat"
call .venv\\Scripts\\activate
call set PYTHONPATH=%~dp0\..\.venv\Scripts\python
call .venv\Scripts\python.exe tools\py\build_spark.py %*
if not defined VENV_DIR (
set VENV_DIR=%~dp0..\.venv
)
set BUILD_SPARK_PY="%~dp0py\build_spark.py"
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
call "%VENV_DIR%\Scripts\activate"
call python "%BUILD_SPARK_PY%" %*
EXIT /B %ERRORLEVEL%