It might be related to an upgrade issue but at the moment out verify task only reads the git url and current branch when it 'knows' the site is managed in git.

Can we either add an 'import git settings' task, or let is check some other way?

We could just always check for the existence of .git meta info in the filesystem... would that be serious overhead?

The most relevant code in hosting_git.drush.inc ... where deploy_from_git gets set.

/**
 * Implements hook_hosting_TASK_OBJECT_context_options().
 */
function hosting_git_hosting_platform_context_options(&$task) {
  // Set some defaults.
  $task->context_options['deploy_from_git'] = FALSE;
  $task->context_options['git_ref'] = '';

  // If we're actually provisioning from Git, populate real data.
  if (!empty($task->ref->git['repo_url'])) {
    $task->context_options['repo_url'] = $task->ref->git['repo_url'];
    $task->context_options['deploy_from_git'] = TRUE;
    $task->context_options['git_ref'] = $task->ref->git['git_ref'];
  }
  $task->context_options['deploy_from_git'] = TRUE;
}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ergonlogic’s picture

This seems reasonable. I don't think looking for .git/ in a site/platform root on verify tasks would add any significant overhead. If one is found, we should probably do some basic sanity checks to confirm that it is indeed a working git repo, that we can read from at least one remote, etc.

helmo’s picture

Status: Active » Needs work
FileSize
1.75 KB

Here's a bit of work in progress code.

I had it working for a bit with two verify tasks run after each other on a site. But it needs more though.

helmo’s picture

Status: Needs work » Needs review
FileSize
2.77 KB

This still itched .... and while working on #2871078: Saving site removes GIT credentials I started digging again.... this patch seems to work ... needs testing though.

  • helmo committed 50b5ffa on 7.x-3.x
    Issue #2544906 by helmo: Pickup git setting from disk
    
helmo’s picture

Status: Needs review » Fixed

Committed, It worked as expected on multiple sites.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Jon Pugh’s picture

Assigned: Unassigned » Jon Pugh
Priority: Normal » Critical
Status: Closed (fixed) » Active

This is way too loose.

My site nodes are getting the git information imported from the platform, and then the platform git repo cloned into the sites folder!

Still investigating...

Jon Pugh’s picture

I think I tracked it down to this:

    if (drush_shell_cd_and_exec($repo_path, 'git config --local --get remote.origin.url')) {

If we 'cd' to $repo_path and run that, we will get a result if the platform is a git repository.

is there a way to force `git config` to use only an exact folder, and not a parent? Or should I just check for .git folder?

Jon Pugh’s picture

For reference, this other issue was caused by this patch: #2893588: Removing a site or platform could remove all of /var/aegir

  • helmo committed 50b5ffa on 2544906-import-meta
    Issue #2544906 by helmo: Pickup git setting from disk
    
  • Jon Pugh committed 589125e on 2544906-import-meta
    Issue #2544906: Pickup git setting from disk: Fix improper git repo...
helmo’s picture

Your changes in 2544906-import-meta look OK, but I haven't been able to reproduce the problem yet.

I checked a site (that has no git) on a platform that is in git .... and a verify task there did not pick up git settings into the site.

But after merging 2544906-import-meta I didn't notice problems.

helmo’s picture

Status: Active » Needs review

What about calling provision_git_is_repo() from _provision_git_update_git_meta_data()? with the force_repo_path_as_toplevel option ...

Jon Pugh’s picture

One reason is that it's already being called before running the meta data hook:

 #Line 383
 // Check to see if we can puick up on existing Git info.
    if (provision_git_is_repo(NULL, FALSE)) {
      _provision_git_update_git_meta_data();
    }

provision_git_is_repo() does a lot more than just check a directory, it checks drush options, runs git status, drush log...

This was just for a final sanity check before importing that metadata.

Jon Pugh’s picture

Status: Needs review » Reviewed & tested by the community

I'm inferring from helmo in #11 and #12 that this is RTBC

  • Jon Pugh committed 589125e on 7.x-3.x
    Issue #2544906: Pickup git setting from disk: Fix improper git repo...
Jon Pugh’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.