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

Ability to run clone operation i the foreground #143

Open
mrfelton opened this issue May 25, 2014 · 3 comments
Open

Ability to run clone operation i the foreground #143

mrfelton opened this issue May 25, 2014 · 3 comments

Comments

@mrfelton
Copy link

As part of our CI setup, we run something like this:

if curl -s --head  --request GET http://$CIRCLE_BRANCH-$PANTHEON_SITE_NAME.gotpantheon.com | grep "404 Unknown site!" > /dev/null; then
  drush pantheon-site-environment-create $PANTHEON_SITE_UUID $CIRCLE_BRANCH --source=$PANTHEON_SOURCE
  drush pantheon-site-environment-lock $SITE_UUID $CIRCLE_BRANCH $PANTHEON_ENV_USERNAME $PANTHEON_ENV_PASSWORD
else
  drush pantheon-site-clone $PANTHEON_SITE_UUID $PANTHEON_SOURCE $CIRCLE_BRANCH --db -y
fi

We are checking wether an environment already exists for the branch and if not we create it. If it does already exists we clone a fresh database onto it.

In the case where we create the environment using pantheon-site-environment-create the process waits until the environment has actually been created before moving on - which is what we want.

However, in the case pantheon-site-clone the process ends immediately, before pantheon actually cloned the environment. The problem with this is any any attempts to run commands or tests against the freshly cloned environment fail, as the database is still in the process of being created.

Any way to get psite-clone to work in the same way as psite-ecreate (in the foreground)?

@joshkoenig
Copy link
Contributor

Hey Tom,

This is definitely possible, and will become even easier with some of the behind the scenes changes that are being done to make it simpler and more precise to externally track individual job status.

In the short term it's feasible to add a call in to terminus_job_poll():

https://github.com/pantheon-systems/terminus/blob/master/terminus.drush.inc#L1533

Which would look for the 'clone_db_from_' . $env_source . '_to_' . $new_environment) "slot".

@mikevanwinkle
Copy link
Contributor

perhaps we should do this with a --wait flag so as not to disrupt any existing user experiences.

@joshkoenig
Copy link
Contributor

This should be easy if we tap into the terminus_workflow_poll() function that was recently added:

https://github.com/pantheon-systems/terminus/blob/master/terminus.drush.inc#L1804

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

No branches or pull requests

3 participants