fix: show cicd version is available message only for deploy command#223
fix: show cicd version is available message only for deploy command#223aviatco wants to merge 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Fabric CLI deploy flow so that fabric_cicd is only imported when the deploy command actually runs, preventing import-time side effects (like the “New cicd version available” message) from appearing during unrelated commands.
Changes:
- Moved
fabric_cicdimports from module scope intodeploy_with_config_file(...)to avoid import-time side effects outsidedeploy. - Added a Changie “fixed” unreleased entry documenting the behavior change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/fabric_cli/commands/fs/deploy/fab_fs_deploy_config_file.py |
Delays fabric_cicd import until deploy execution to avoid cross-command side effects. |
.changes/unreleased/fixed-20260427-141642.yaml |
Release note entry describing the bug fix. |
| from fabric_cicd import append_feature_flag, configure_external_file_logging, deploy_with_config, disable_file_logging # type: ignore | ||
|
|
||
| try: |
There was a problem hiding this comment.
The local fabric_cicd import is placed before the try: block, so ImportError/ModuleNotFoundError (or other import-time errors) will bypass the existing error wrapping and surface as an unhandled exception/traceback. Move the import into the try: (or catch ImportError explicitly and raise a FabricCLIError) so failures are reported consistently as Deployment failed.
| from fabric_cicd import append_feature_flag, configure_external_file_logging, deploy_with_config, disable_file_logging # type: ignore | |
| try: | |
| try: | |
| from fabric_cicd import append_feature_flag, configure_external_file_logging, deploy_with_config, disable_file_logging # type: ignore |
|
|
||
| def deploy_with_config_file(args: Namespace) -> None: | ||
| """deploy fabric items to a workspace using a configuration file and target environment - delegates to CICD library.""" | ||
| from fabric_cicd import append_feature_flag, configure_external_file_logging, deploy_with_config, disable_file_logging # type: ignore |
There was a problem hiding this comment.
This change is meant to prevent the CICD "new version available" message from showing up for non-deploy commands (by avoiding import-time side effects). There doesn’t appear to be a regression test asserting that running another fs command (e.g., ls) does not trigger the fabric_cicd import / message; adding such a test would help prevent this from coming back.
📥 Pull Request
✨ Description of new changes
This pull request fixes an issue where the "New cicd version available" message was shown outside of the intended context. Now, the message will only appear when the deploy command is used. Additionally, the import of certain
fabric_cicdfunctions has been moved inside the relevant function for better scope management.Bug fix:
Code organization:
fabric_cicdfunctions (append_feature_flag,configure_external_file_logging,deploy_with_config,disable_file_logging) inside thedeploy_with_config_filefunction infab_fs_deploy_config_file.pyto limit their scope and potentially improve performance. [1] [2]