Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dd1b5089a | ||
|
|
923e0f5502 | ||
|
|
6d45e0d494 | ||
|
|
a29ed2b7bd | ||
|
|
3fe447dc67 | ||
|
|
f78cb33088 | ||
|
|
9c09be6ced | ||
|
|
a220e86e95 | ||
|
|
5a2c15d4be |
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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%
|
||||
Reference in new issue
Block a user