Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Version when branch changes #125

Open
jameswilson opened this issue Jun 2, 2016 · 1 comment
Open

Update Version when branch changes #125

jameswilson opened this issue Jun 2, 2016 · 1 comment

Comments

@jameswilson
Copy link
Contributor

jameswilson commented Jun 2, 2016

I believe it may be a caching thing where the App Environment Version gets cached based on the git branch you use when you create the environment. If you switch branches at some point, this information is not updated when you do a terra status <appname>, it lists the branch name you used when you cloned the code.

@jonpugh
Copy link
Member

jonpugh commented Jun 2, 2016

Yeah.... this one is tricky. I'm not sure we should store branch name at all in the metadata. It's very fast to extract it from the git repo itself.

That said we want to know the version, and we need to let the user choose the version, so we should...

  1. Remove it from the environments config. Make sure the desired branch is still passed to the git clone in environment:add and the git checkout in environment:deploy.

  2. Add a getVersion() method to EnvironmentFactory that figures out the actual branch or tag, straight from the git repo. I already do this in devshop in a nice little hack: https://github.com/opendevshop/devmaster/blob/1.x/modules/devshop/devshop_projects/projects.inc#L304

    // Get the actual tag or branch
    $environment->git_ref = trim(str_replace('refs/heads/', '', shell_exec("cd {$environment->repo_root}; git describe --tags --exact-match || git symbolic-ref -q HEAD")));
  3. Implement getVersion() wherever we wanted to show environment version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants