Example #1
0
 def test_deploy_application(self):
     with self.check_output_swap:
         gcloud_adapter.deploy_application('yaml path',
                                           'app name',
                                           version='2.1.1')
     self.assertEqual(self.check_function_calls,
                      self.expected_check_function_calls)
Example #2
0
def deploy_application_and_write_log_entry(
        app_name, version_to_deploy_to, current_git_revision):
    """Deploys the app and writes the log entry.

    Args:
        app_name: str. The name of the app to deploy.
        version_to_deploy_to: str. The version to deploy to.
        current_git_revision: str. The current git revision.
    """
    # Deploy export service to GAE.
    gcloud_adapter.deploy_application('export/app.yaml', app_name)
    # Deploy app to GAE.
    gcloud_adapter.deploy_application(
        './app.yaml', app_name, version=version_to_deploy_to)
    # Writing log entry.
    common.ensure_directory_exists(os.path.dirname(LOG_FILE_PATH))
    with python_utils.open_file(LOG_FILE_PATH, 'a') as log_file:
        log_file.write(
            'Successfully deployed to %s at %s (version %s)\n' % (
                app_name, CURRENT_DATETIME.strftime('%Y-%m-%d %H:%M:%S'),
                current_git_revision))