@@ -30,15 +30,23 @@ pipeline {
3030 )
3131 }
3232
33+ // Determine if BRANCH_NAME is a tag (timestamp format) or actual branch
34+ def isTag = env.BRANCH_NAME ==~ /^\d{14}-.+/
35+ def refSpec = isTag ? "+refs/tags/*:refs/remotes/origin/tags/*" : "+refs/heads/*:refs/remotes/origin/*"
36+ def branchSpec = isTag ? "refs/tags/${env.BRANCH_NAME}" : "${env.BRANCH_NAME}"
37+
38+ echo "Checking out ${isTag ? 'tag' : 'branch'}: ${env.BRANCH_NAME}"
39+
3340 checkout([
3441 $class: 'GitSCM',
35- branches: [[name: "${env.BRANCH_NAME}" ]],
42+ branches: [[name: branchSpec ]],
3643 extensions: [
37- [$class: 'CloneOption', depth: 1, shallow: true, noTags: true ]
44+ [$class: 'CloneOption', depth: 1, shallow: true, noTags: false ]
3845 ],
3946 userRemoteConfigs: [[
4047 url: 'https://github.com/nhsd-exeter/dos-road-distance.git',
41- credentialsId: 'gitlab-texas_automation-user'
48+ credentialsId: 'gitlab-texas_automation-user',
49+ refspec: refSpec
4250 ]]
4351 ])
4452
@@ -56,6 +64,14 @@ pipeline {
5664 script { sh "make show-configuration" }
5765 }
5866 }
67+ stage("Build App") {
68+ when { expression { env.PROFILE == "put" || env.PROFILE == "live" } }
69+ steps {
70+ script { sh "make build" }
71+ script { sh "make unit-test" }
72+ script { sh "make push" }
73+ }
74+ }
5975 stage("Propagate Artefacts") {
6076 when { expression { env.PROFILE == "put" || env.PROFILE == "live" } }
6177 steps{
0 commit comments