akester/storehouse

Fork Project

2513643247b913e0a4caf03c89006c09f2d494ab

Authored By: Andrew Kester Date: May 5, 2019 3:57 am

Update artifact name syntax

.builds/build/Jenkinsfile
5 5
 
6 6
     environment {
7 7
         SYMFONY_ENV = 'test'
8
+        GIT_COMMIT_SHORT = sh(
9
+                script: "printf \$(git rev-parse --short ${GIT_COMMIT})",
10
+                returnStdout: true
11
+        )
12 8
     }
13 9
 
14 10
     stages {
35 39
             steps {
36 40
                 echo 'Deploying...'
37 41
 
42
-                shortCommit = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
43
-
38 44
                 withAWS(credentials:'Jenkins-S3PublishUser') {
39 45
                     echo 'Uploading S3 Artifacts....'
40 46
                     // We copy the artifact to S3 twice, once as the "latest" image, once as a past image for archival
41 47
                     s3Upload file:'build/artifacts/code.tar.gz', bucket:'storehouse-builds', path:'latest/storehouse.tar.gz'
48
-                    s3Upload file:'build/artifacts/code.tar.gz', bucket:'storehouse-builds', path:"past/storehouse-${env.BUILD_ID}-${shortCommit}"
42
+                    s3Upload file:'build/artifacts/code.tar.gz', bucket:'storehouse-builds', path:"past/storehouse-${env.BUILD_ID}-${env.GIT_COMMIT_SHORT}"
43 49
                 }
44 50
             }
45 51
         }
46 52