Page MenuHomePhabricator

DEPLOY_HEAD should be a symbolic ref
Open, LowPublic

Description

Scap3's .git/DEPLOY_HEAD looks like a symbolic ref, but doesn't have the benefits of a symbolic ref.

Ideally, you should be able to do:

git log DEPLOY_HEAD

To see a history of deployments

and

git show DEPLOY_HEAD

Whether we point to the tag we create, or a branch we create, it would be nice to track the history of deployments via git. That is, let git be a deploy log.

Event Timeline

thcipriani moved this task from Needs triage to Experiments on the Scap board.

This isn't really possible right now because we store a ton of extra info in DEPLOY_HEAD that's not just a name of a reference. Furthermore, it must be a ref, it cannot be a sha1. From the manpage itself:

A symbolic ref is a regular file that stores a string that begins with ref: refs/. For example, your .git/HEAD is a regular file whose contents is ref: refs/heads/master.

I tried to create a local TEST symbolic-ref that pointed to a sha1 (like we provide in commit and git_rev in DEPLOY_HEAD), you end up with the following error:

warning: ignoring dangling symref TEST.
warning: ignoring dangling symref TEST.
fatal: ambiguous argument 'TEST': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

So while it's a cool idea, I think we have 2 major problems we'd need to overcome:

  1. Splitting DEPLOY_HEAD into two files, one just for the ref and the rest in the other
  2. We'd need to use an actual ref (tag or branch) prior to writing DEPLOY_HEAD and sync'ing