# Copyright 2017 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

from recipe_engine import recipe_api


class RuntimeApi(recipe_api.RecipeApi):
  """This module assists in experimenting with production recipes.

  For example, when migrating builders from Buildbot to pure LUCI stack.
  """

  def __init__(self, properties, **kwargs):
    super(RuntimeApi, self).__init__(**kwargs)
    self._properties = properties

  @property
  def is_luci(self):
    """True if this recipe is currently running on LUCI stack.

    Should be used only during migration from Buildbot to LUCI stack.
    """
    return bool(self._properties.get('is_luci', False))

  @property
  def is_experimental(self):
    """True if this recipe is currently running in experimental mode.

    Typical usage is to modify steps which produce external side-effects so that
    non-production runs of the recipe do not affect production data.

    Examples:
      * Uploading to an alternate google storage file name when in non-prod mode
      * Appending a 'non-production' tag to external RPCs
    """
    return bool(self._properties.get('is_experimental', False))

# Copyright 2017 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

from recipe_engine import recipe_api


class RuntimeApi(recipe_api.RecipeApi):
  """This module assists in experimenting with production recipes.

  For example, when migrating builders from Buildbot to pure LUCI stack.
  """

  def __init__(self, properties, **kwargs):
    super(RuntimeApi, self).__init__(**kwargs)
    self._properties = properties

  @property
  def is_luci(self):
    """True if this recipe is currently running on LUCI stack.

    Should be used only during migration from Buildbot to LUCI stack.
    """
    return bool(self._properties.get('is_luci', True))

  @property
  def is_experimental(self):
    """True if this recipe is currently running in experimental mode.

    Typical usage is to modify steps which produce external side-effects so that
    non-production runs of the recipe do not affect production data.

    Examples:
      * Uploading to an alternate google storage file name when in non-prod mode
      * Appending a 'non-production' tag to external RPCs
    """
    return bool(self._properties.get('is_experimental', False))

Change is_luci default to True.
Change is_luci default to True.

Most things should be on LUCI now, so this better reflects reality, and
might help shakeout any obsolete non-LUCI handling.

Bug: 993137
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: depot_tools
Recipe-Nontrivial-Roll: infra
Recipe-Nontrivial-Roll: release_scripts
Recipe-Nontrivial-Roll: skia
Change-Id: I5d43654d1f8ef2d980a3c8892e718b102e6cbbe1
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/1750109
Auto-Submit: Michael Moss <9cc3612fe50cad025435ae878219b6203d6b641d@chromium.org>
Reviewed-by: Robbie Iannucci <40f3d43a28ebae3cb819288542e1c84d73d962d5@chromium.org>
Commit-Queue: Michael Moss <9cc3612fe50cad025435ae878219b6203d6b641d@chromium.org>
