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
void call(Map config = [:]) {
void call(Map config = [:], Closure body) {
Map defaults = [
saveArtifaces: false,
buildTest: 'Makefile',
buildCmd: 'make all'
buildCmd: 'make all',
stepName: 'Build'
]
Map runConfig = defaults + config
stage(runConfig.stepName) {
if (runConfig.saveArtifacts) {
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('[\\[\\]\'\"]', '')
archiveArtifacts artifacts: artifactsList, followSymlinks: false
}
body()
}
}

View File

@ -1,5 +1,13 @@
#!/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
body()
}
}

View File

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