Permalink
Browse files

Tag deploys with the git-describe output

This way we can see what's going on more easily, and know which
version of the git repo is deployed to production.

Also, we need to set up staging/prod and chef deployments for this.
  • Loading branch information...
1 parent 922c972 commit 2f9dbb9d2f75c96183f9b0cbdbafaa790d380d29 @isaacs isaacs committed Feb 23, 2014
View
2 push.sh
@@ -62,7 +62,7 @@ EOF
c=${c/PASSWORD/$PASSWORD}
c=${c// /%20}
which couchapp
-couchapp push registry/app.js "$c" && \
+DEPLOY_VERSION=`git describe --tags` couchapp push registry/app.js "$c" && \
@terinjokes
terinjokes Feb 25, 2014

Because of the check in registry/app.js don't we also need this in load-views.sh?

scratch_message && \
exit 0 || \
( ret=$?
View
5 registry/app.js
@@ -9,5 +9,10 @@ var ddoc = module.exports =
, language: "javascript"
}
+if (process.env.DEPLOY_VERSION)
+ ddoc.deploy_version = process.env.DEPLOY_VERSION
+else
+ throw new Error('Must set DEPLOY_VERSION env to `git describe` output')
+
var modules = require("./modules.js")
for (var i in modules) ddoc[i] = modules[i]
View
14 test/00-setup.js
@@ -71,6 +71,20 @@ test('create test db', function(t) {
}).end()
})
+test('get the git-describe output', function(t) {
+ var c = spawn('git', ['describe', '--tags'])
+ c.stderr.pipe(process.stderr)
+ var desc = ''
+ c.stdout.on('data', function(d) {
+ desc += d
+ })
+
+ c.stdout.on('end', function() {
+ process.env.DEPLOY_VERSION = desc.trim()
+ t.end()
+ })
+})
+
test('ddoc', function(t) {
var app = require.resolve('../registry/app.js')
var couch = 'http://admin:admin@localhost:15984/registry'
View
1 test/pkg-update-copy-fields.js
@@ -5,6 +5,7 @@ Object.keys(mod).forEach(function (m) {
process.binding('natives')[m] = mod[m]
})
+process.env.DEPLOY_VERSION = 'testing'
var pkg = require("../registry/app.js").updates.package
var doc =
View
1 test/pkg-update-deprecate-msg.js
@@ -5,6 +5,7 @@ Object.keys(mod).forEach(function (m) {
process.binding('natives')[m] = mod[m]
})
+process.env.DEPLOY_VERSION = 'testing'
var pkg = require("../registry/app.js").updates.package
var doc =
View
1 test/pkg-update-star-nopt.js
@@ -5,6 +5,7 @@ Object.keys(mod).forEach(function (m) {
process.binding('natives')[m] = mod[m]
})
+process.env.DEPLOY_VERSION = 'testing'
var pkg = require("../registry/app.js").updates.package
var doc = require("./fixtures/star-nopt.json")
View
1 test/pkg-update-yui-error.js
@@ -5,6 +5,7 @@ Object.keys(mod).forEach(function (m) {
process.binding('natives')[m] = mod[m]
})
+process.env.DEPLOY_VERSION = 'testing'
var pkg = require("../registry/app.js").updates.package
var doc = require("./fixtures/yui-old.json")
View
1 test/vdu.js
@@ -15,6 +15,7 @@ Object.keys(mod).forEach(function (m) {
process.binding('natives')[m] = mod[m]
})
+process.env.DEPLOY_VERSION = 'testing'
var vdu = require("../registry/app.js").validate_doc_update
var test = require("tap").test

0 comments on commit 2f9dbb9

Please sign in to comment.