Revamp stages and restructure project #1

Merged
jim merged 32 commits from newstage into master 2024-02-08 02:22:21 +00:00
4 changed files with 45 additions and 18 deletions
Showing only changes of commit cea3844edf - Show all commits

View File

@ -0,0 +1,6 @@
class Versioner {
}

View File

@ -1,12 +1,14 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
void call(Map config = [:]) { void call(Map config = [:], Closure body) {
Map defaults = [ Map defaults = [
saveArtifaces: false, saveArtifaces: false,
buildTest: 'Makefile', buildTest: 'Makefile',
buildCmd: 'make all' buildCmd: 'make all',
stepName: 'Build'
] ]
Map runConfig = defaults + config Map runConfig = defaults + config
stage(runConfig.stepName) {
if (runConfig.saveArtifacts) { if (runConfig.saveArtifacts) {
assert runConfig.artifacts : 'Error: saveArtifacts is set to true; must specify artifacts!' assert runConfig.artifacts : 'Error: saveArtifacts is set to true; must specify artifacts!'
} }
@ -21,4 +23,6 @@ void call(Map config = [:]) {
artifactsList = runConfig.artifacts.inspect().replaceAll('[\\[\\]\'\"]', '') artifactsList = runConfig.artifacts.inspect().replaceAll('[\\[\\]\'\"]', '')
archiveArtifacts artifacts: artifactsList, followSymlinks: false archiveArtifacts artifacts: artifactsList, followSymlinks: false
} }
body()
}
} }

View File

@ -1,5 +1,13 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
void call() { void call(Map config = [:], Closure body) {
Map defaults = [
stepName: 'Checkout',
useJobSCM: true
]
runDefaults = defaults + config
stage(runConfig.stepName) {
checkout scm checkout scm
body()
}
} }

View File

@ -10,5 +10,14 @@ String call(Map config = [:]) {
script: "git describe --tags --always --dirty=${runConfig.dirtyFlag}", script: "git describe --tags --always --dirty=${runConfig.dirtyFlag}",
returnStdout: true returnStdout: true
).trim() ).trim()
return gitTag
gitHash = sh(
script: 'git rev-parse --short HEAD',
returnStdout: true
).trim()
runConfig.tag = gitTag
runConfig.hash = gitHash
return runConfig
} }