Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion samcli/commands/_utils/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class ExperimentalFlag:
"""Class for storing all experimental related ConfigEntries"""

All = ExperimentalEntry("experimentalAll", EXPERIMENTAL_ENV_VAR_PREFIX + "FEATURES")
Accelerate = ExperimentalEntry("experimentalAccelerate", EXPERIMENTAL_ENV_VAR_PREFIX + "ACCELERATE")
Esbuild = ExperimentalEntry("experimentalEsbuild", EXPERIMENTAL_ENV_VAR_PREFIX + "ESBUILD")


Expand Down
3 changes: 1 addition & 2 deletions samcli/commands/_utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,11 @@ def common_observability_click_options():
"-t",
is_flag=True,
help="Tail events. This will ignore the end time argument and continue to fetch events as they "
"become available. [Beta Feature] If in beta --tail without a --name will pull from all possible resources",
"become available. If --tail without a --name will pull from all possible resources",
),
click.option(
"--output",
help="""
[Beta Feature]
The formatting style of the command output. Following options are available:\n
TEXT: Prints information as regular text with some formatting (default option)\n
JSON: Prints each line as JSON without formatting
Expand Down
22 changes: 3 additions & 19 deletions samcli/commands/logs/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@

from samcli.cli.cli_config_file import configuration_option, TomlProvider
from samcli.cli.main import pass_context, common_options as cli_framework_options, aws_creds_options, print_cmdline_args
from samcli.commands._utils.experimental import (
ExperimentalFlag,
force_experimental_option,
experimental,
prompt_experimental,
)
from samcli.commands._utils.options import common_observability_options
from samcli.commands.logs.validation_and_exception_handlers import (
SAM_LOGS_ADDITIONAL_EXCEPTION_HANDLERS,
Expand Down Expand Up @@ -44,8 +38,6 @@
Use the --filter option to quickly find logs that match terms, phrases or values in your log events.
$ sam logs -n HelloWorldFunction --stack-name mystack --filter "error" \n
\b
[Beta Features]
\b
You can now fetch logs from supported resources, by only providing --stack-name parameter
$ sam logs --stack-name mystack \n
\b
Expand Down Expand Up @@ -81,27 +73,22 @@
"--include-traces",
"-i",
is_flag=True,
help="[Beta Feature] Include the XRay traces in the log output.",
help="Include the XRay traces in the log output.",
)
@click.option(
"--cw-log-group",
multiple=True,
help="[Beta Feature] "
"Additional CloudWatch Log group names that are not auto-discovered based upon --name parameter. "
help="Additional CloudWatch Log group names that are not auto-discovered based upon --name parameter. "
"When provided, it will only tail the given CloudWatch Log groups. If you want to tail log groups related "
"to resources, please also provide their names as well",
)
@common_observability_options
@experimental
@cli_framework_options
@aws_creds_options
@pass_context
@track_command
@check_newer_version
@print_cmdline_args
@force_experimental_option("include_traces", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
@force_experimental_option("cw_log_group", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
@force_experimental_option("output", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
@command_exception_handler(SAM_LOGS_ADDITIONAL_EXCEPTION_HANDLERS)
@stack_name_cw_log_group_validation
def cli(
Expand Down Expand Up @@ -162,10 +149,7 @@ def do_cli(
from samcli.lib.observability.util import OutputOption
from samcli.lib.utils.boto_utils import get_boto_client_provider_with_config, get_boto_resource_provider_with_config

if not names or len(names) > 1:
if not prompt_experimental(ExperimentalFlag.Accelerate):
return
else:
if names and len(names) <= 1:
click.echo(
"You can now use 'sam logs' without --name parameter, "
"which will pull the logs from all supported resources in your stack."
Expand Down
34 changes: 3 additions & 31 deletions samcli/commands/sync/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
)
from samcli.cli.context import Context
from samcli.lib.sync.watch_manager import WatchManager
from samcli.commands._utils.experimental import (
ExperimentalFlag,
experimental,
is_experimental_enabled,
set_experimental,
update_experimental_context,
)

if TYPE_CHECKING: # pragma: no cover
from samcli.commands.deploy.deploy_context import DeployContext
Expand All @@ -60,7 +53,7 @@
LOG = logging.getLogger(__name__)

HELP_TEXT = """
[Beta Feature] Update/Sync local artifacts to AWS
Update/Sync local artifacts to AWS

By default, the sync command runs a full stack update. You can specify --code or --watch to switch modes.
\b
Expand All @@ -77,20 +70,8 @@
Enter Y to proceed with the command, or enter N to cancel:
"""

SYNC_CONFIRMATION_TEXT_WITH_BETA = """
This feature is currently in beta. Visit the docs page to learn more about the AWS Beta terms https://aws.amazon.com/service-terms/.

The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without
performing a CloudFormation deployment. This will cause drift in your CloudFormation stack.
**The sync command should only be used against a development stack**.

Confirm that you are synchronizing a development stack and want to turn on beta features.

Enter Y to proceed with the command, or enter N to cancel:
"""


SHORT_HELP = "[Beta Feature] Sync a project to AWS"
SHORT_HELP = "Sync a project to AWS"

DEFAULT_TEMPLATE_NAME = "template.yaml"
DEFAULT_CAPABILITIES = ("CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND")
Expand Down Expand Up @@ -145,7 +126,6 @@
@notification_arns_option
@tags_option
@capabilities_option(default=DEFAULT_CAPABILITIES) # pylint: disable=E1120
@experimental
@pass_context
@track_command
@image_repository_validation
Expand Down Expand Up @@ -242,17 +222,9 @@ def do_cli(
from samcli.commands.package.package_context import PackageContext
from samcli.commands.deploy.deploy_context import DeployContext

confirmation_text = SYNC_CONFIRMATION_TEXT

if not is_experimental_enabled(ExperimentalFlag.Accelerate):
confirmation_text = SYNC_CONFIRMATION_TEXT_WITH_BETA

if not click.confirm(Colored().yellow(confirmation_text), default=False):
if not click.confirm(Colored().yellow(SYNC_CONFIRMATION_TEXT), default=False):
return

set_experimental(ExperimentalFlag.Accelerate)
update_experimental_context()

s3_bucket = manage_stack(profile=profile, region=region)

build_dir = DEFAULT_BUILD_DIR_WITH_AUTO_DEPENDENCY_LAYER if dependency_layer else DEFAULT_BUILD_DIR
Expand Down
7 changes: 3 additions & 4 deletions samcli/commands/traces/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from samcli.lib.observability.util import OutputOption
from samcli.lib.telemetry.metric import track_command
from samcli.lib.utils.version_checker import check_newer_version
from samcli.commands._utils.experimental import ExperimentalFlag, force_experimental


LOG = logging.getLogger(__name__)

HELP_TEXT = """
[Beta Feature] Use this command to fetch AWS X-Ray traces generated by your stack.\n
Use this command to fetch AWS X-Ray traces generated by your stack.\n
"""


@click.command("traces", help=HELP_TEXT, short_help="[Beta Feature] Fetch AWS X-Ray traces")
@click.command("traces", help=HELP_TEXT, short_help="Fetch AWS X-Ray traces")
@configuration_option(provider=TomlProvider(section="parameters"))
@click.option(
"--trace-id",
Expand All @@ -31,7 +31,6 @@
)
@common_observability_options
@cli_framework_options
@force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
@aws_creds_options
@pass_context
@track_command
Expand Down
7 changes: 3 additions & 4 deletions samcli/lib/build/build_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from copy import deepcopy
from typing import Callable, Dict, List, Any, Optional, cast, Set

from samcli.commands._utils.experimental import is_experimental_enabled, ExperimentalFlag
from samcli.lib.utils import osutils
from samcli.lib.utils.async_utils import AsyncContext
from samcli.lib.utils.hash import dir_checksum
Expand Down Expand Up @@ -163,7 +162,7 @@ def build_single_function_definition(self, build_definition: FunctionBuildDefini
single_build_dir,
build_definition.metadata,
container_env_vars,
build_definition.dependencies_dir if is_experimental_enabled(ExperimentalFlag.Accelerate) else None,
build_definition.dependencies_dir,
build_definition.download_dependencies,
)
function_build_results[single_full_path] = result
Expand Down Expand Up @@ -210,7 +209,7 @@ def build_single_layer_definition(self, layer_definition: LayerBuildDefinition)
layer.build_architecture,
single_build_dir,
layer_definition.env_vars,
layer_definition.dependencies_dir if is_experimental_enabled(ExperimentalFlag.Accelerate) else None,
layer_definition.dependencies_dir,
layer_definition.download_dependencies,
)
}
Expand Down Expand Up @@ -562,7 +561,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:

@staticmethod
def _is_incremental_build_supported(runtime: Optional[str]) -> bool:
if not runtime or not is_experimental_enabled(ExperimentalFlag.Accelerate):
if not runtime:
return False

for supported_runtime_prefix in CachedOrIncrementalBuildStrategyWrapper.SUPPORTED_RUNTIME_PREFIXES:
Expand Down
4 changes: 0 additions & 4 deletions samcli/lib/observability/cw_logs/cw_log_group_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
from typing import Optional

from samcli.commands._utils.experimental import force_experimental, ExperimentalFlag
from samcli.lib.utils.resources import (
AWS_LAMBDA_FUNCTION,
AWS_APIGATEWAY_RESTAPI,
Expand Down Expand Up @@ -53,7 +52,6 @@ def for_lambda_function(function_name: str) -> str:
return "/aws/lambda/{}".format(function_name)

@staticmethod
@force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
def for_apigw_rest_api(rest_api_id: str, stage: str = "Prod") -> str:
"""
Returns the CloudWatch Log Group Name created by default for the AWS Api gateway rest api with given id
Expand All @@ -76,7 +74,6 @@ def for_apigw_rest_api(rest_api_id: str, stage: str = "Prod") -> str:
return "API-Gateway-Execution-Logs_{}/{}".format(rest_api_id, stage)

@staticmethod
@force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
def for_apigwv2_http_api(
boto_client_provider: BotoProviderType, http_api_id: str, stage: str = "$default"
) -> Optional[str]:
Expand Down Expand Up @@ -110,7 +107,6 @@ def for_apigwv2_http_api(
return log_group_name

@staticmethod
@force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120
def for_step_functions(
boto_client_provider: BotoProviderType,
step_function_name: str,
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,9 +1653,9 @@ def test_no_cached_override_build(self):
cmdlist = self.get_command_list(parameter_overrides=overrides)
cmdlist.extend(["--config-file", config_file])
command_result = run_command(cmdlist, cwd=self.working_dir)
self.assertTrue(
"Valid cache found, copying previously built resources for following functions"
in str(command_result.stderr),
self.assertRegex(
str(command_result.stderr),
"Manifest is not changed for .* running incremental build",
"Should have built using cache",
)
cmdlist.extend(["--no-cached"])
Expand Down
11 changes: 9 additions & 2 deletions tests/integration/telemetry/test_experimental_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import platform
import time
from pathlib import Path
from unittest import skip
from unittest.mock import ANY

from .integ_base import IntegBase, TelemetryServer
Expand All @@ -13,6 +14,10 @@ class TestExperimentalMetric(IntegBase):
Validates the basic tenets/contract Telemetry module needs to adhere to
"""

@skip(
"Accelerate are not in experimental any more, just skip this test. If we have new experimental commands, "
"we can update this test"
)
def test_must_send_experimental_metrics_if_experimental_command(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
Expand Down Expand Up @@ -53,7 +58,6 @@ def test_must_send_experimental_metrics_if_experimental_command(self):
"region": ANY,
"commandName": ANY,
"metricSpecificAttributes": {
"experimentalAccelerate": True,
"experimentalAll": False,
"experimentalEsbuild": False,
},
Expand All @@ -67,6 +71,10 @@ def test_must_send_experimental_metrics_if_experimental_command(self):
self.assertEqual(request["data"], expected_data)
os.environ["SAM_CLI_BETA_ACCELERATE"] = "0"

@skip(
"Accelerate are not in experimental any more, just skip this test. If we have new experimental commands, "
"we can update this test"
)
def test_must_send_experimental_metrics_if_experimental_option(self):
"""
Metrics should be sent if "Disabled via config file but Enabled via Envvar"
Expand Down Expand Up @@ -104,7 +112,6 @@ def test_must_send_experimental_metrics_if_experimental_option(self):
"region": ANY,
"commandName": ANY,
"metricSpecificAttributes": {
"experimentalAccelerate": True,
"experimentalAll": True,
"experimentalEsbuild": True,
},
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/commands/_utils/test_experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def test_set_experimental(self):
self.gc_mock.return_value.set_value.assert_called_once_with(config_entry, False, is_flag=True, flush=False)

def test_get_all_experimental(self):
self.assertEqual(len(get_all_experimental()), 3)
self.assertEqual(len(get_all_experimental()), 2)

def test_get_all_experimental_statues(self):
self.assertEqual(len(get_all_experimental_statues()), 3)
self.assertEqual(len(get_all_experimental_statues()), 2)

def test_get_enabled_experimental_flags(self):
self.assertEqual(len(get_enabled_experimental_flags()), 3)
self.assertEqual(len(get_enabled_experimental_flags()), 2)

@patch("samcli.commands._utils.experimental.set_experimental")
@patch("samcli.commands._utils.experimental.get_all_experimental")
Expand Down
6 changes: 0 additions & 6 deletions tests/unit/commands/sync/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def setUp(self):

@parameterized.expand([(False, False, True), (False, False, False)])
@patch("os.environ", {**os.environ, "SAM_CLI_POLL_DELAY": 10})
@patch("samcli.commands.sync.command.update_experimental_context")
@patch("samcli.commands.sync.command.click")
@patch("samcli.commands.sync.command.execute_code_sync")
@patch("samcli.commands.build.command.click")
Expand All @@ -75,7 +74,6 @@ def test_infra_must_succeed_sync(
mock_build_click,
execute_code_sync_mock,
click_mock,
update_experimental_context_mock,
):

build_context_mock = Mock()
Expand Down Expand Up @@ -177,7 +175,6 @@ def test_infra_must_succeed_sync(
execute_code_sync_mock.assert_not_called()

@parameterized.expand([(False, True, False)])
@patch("samcli.commands.sync.command.update_experimental_context")
@patch("samcli.commands.sync.command.click")
@patch("samcli.commands.sync.command.execute_watch")
@patch("samcli.commands.build.command.click")
Expand All @@ -203,7 +200,6 @@ def test_watch_must_succeed_sync(
mock_build_click,
execute_watch_mock,
click_mock,
update_experimental_context_mock,
):

build_context_mock = Mock()
Expand Down Expand Up @@ -303,7 +299,6 @@ def test_watch_must_succeed_sync(
)

@parameterized.expand([(True, False, True)])
@patch("samcli.commands.sync.command.update_experimental_context")
@patch("samcli.commands.sync.command.click")
@patch("samcli.commands.sync.command.execute_code_sync")
@patch("samcli.commands.build.command.click")
Expand All @@ -329,7 +324,6 @@ def test_code_must_succeed_sync(
mock_build_click,
execute_code_sync_mock,
click_mock,
update_experimental_context_mock,
):

build_context_mock = Mock()
Expand Down
Loading