diff --git a/cumulusci/cli/tests/test_org.py b/cumulusci/cli/tests/test_org.py index dfa7874c9e..c85f2e0507 100644 --- a/cumulusci/cli/tests/test_org.py +++ b/cumulusci/cli/tests/test_org.py @@ -730,7 +730,6 @@ def test_org_list(self, cli_tbl): ], title="Connected Orgs", ) - assert scratch_table_call in cli_tbl.call_args_list assert connected_table_call in cli_tbl.call_args_list runtime.keychain.cleanup_org_cache_dirs.assert_called_once() diff --git a/cumulusci/core/config/scratch_org_config.py b/cumulusci/core/config/scratch_org_config.py index edd0c18807..d79f7fcb66 100644 --- a/cumulusci/core/config/scratch_org_config.py +++ b/cumulusci/core/config/scratch_org_config.py @@ -61,7 +61,7 @@ def days_alive(self) -> Optional[int]: return delta.days + 1 def create_org(self) -> None: - """Uses sfdx force:org:create to create the org""" + """Uses sf org create scratch to create the org""" if not self.config_file: raise ScratchOrgException( f"Scratch org config {self.name} is missing a config_file" @@ -72,7 +72,7 @@ def create_org(self) -> None: args: List[str] = self._build_org_create_args() extra_args = os.environ.get("SFDX_ORG_CREATE_ARGS", "") p: sarge.Command = sfdx( - f"force:org:create --json {extra_args}", + f"org create scratch --json {extra_args}", args=args, username=None, log_note="Creating scratch org", @@ -139,33 +139,32 @@ def _build_org_create_args(self) -> List[str]: args = ["-f", self.config_file, "-w", "120"] devhub_username: Optional[str] = self._choose_devhub_username() if devhub_username: - args += ["--targetdevhubusername", devhub_username] + args += ["--target-dev-hub", devhub_username] if not self.namespaced: - args += ["-n"] + args += ["--no-namespace"] if self.noancestors: - args += ["--noancestors"] + args += ["--no-ancestors"] if self.days: - args += ["--durationdays", str(self.days)] + args += ["--duration-days", str(self.days)] if self.release: - args += [f"release={self.release}"] + args += [f"--release={self.release}"] if self.sfdx_alias: args += ["-a", self.sfdx_alias] with open(self.config_file, "r") as org_def: org_def_data = json.load(org_def) org_def_has_email = "adminEmail" in org_def_data if self.email_address and not org_def_has_email: - args += [f"adminEmail={self.email_address}"] + args += [f"--admin-email={self.email_address}"] if self.default: - args += ["-s"] - if instance := self.instance or os.environ.get("SFDX_SIGNUP_INSTANCE"): - args += [f"instance={instance}"] + args += ["--set-default"] + return args def _choose_devhub_username(self) -> Optional[str]: """Determine which devhub username to specify when calling sfdx, if any.""" # If a devhub was specified via `cci org scratch`, use it. # (This will return None if "devhub" isn't set in the org config, - # in which case sfdx will use its defaultdevhubusername.) + # in which case sf will use its target-dev-hub.) devhub_username = self.devhub if not devhub_username and self.keychain is not None: # Otherwise see if one is configured via the "devhub" service @@ -178,7 +177,7 @@ def _choose_devhub_username(self) -> Optional[str]: return devhub_username def generate_password(self) -> None: - """Generates an org password with: sfdx force:user:password:generate. + """Generates an org password with: sf org generate password. On a non-zero return code, set the password_failed in our config and log the output (stdout/stderr) from sfdx.""" @@ -187,7 +186,7 @@ def generate_password(self) -> None: return p: sarge.Command = sfdx( - "force:user:password:generate", + "org generate password", self.username, log_note="Generating scratch org user password", ) @@ -214,13 +213,13 @@ def can_delete(self) -> bool: return bool(self.date_created) def delete_org(self) -> None: - """Uses sfdx force:org:delete to delete the org""" + """Uses sf org delete scratch to delete the org""" if not self.created: self.logger.info("Skipping org deletion: the scratch org does not exist.") return p: sarge.Command = sfdx( - "force:org:delete -p", self.username, "Deleting scratch org" + "org delete scratch -p", self.username, "Deleting scratch org" ) sfdx_output: List[str] = list(p.stdout_text) + list(p.stderr_text) diff --git a/cumulusci/core/config/sfdx_org_config.py b/cumulusci/core/config/sfdx_org_config.py index c466778047..dcf79b0a1b 100644 --- a/cumulusci/core/config/sfdx_org_config.py +++ b/cumulusci/core/config/sfdx_org_config.py @@ -27,9 +27,9 @@ def sfdx_info(self): if not self.print_json: self.logger.info(f"Getting org info from Salesforce CLI for {username}") - # Call force:org:display and parse output to get instance_url and + # Call org display and parse output to get instance_url and # access_token - p = sfdx("force:org:display --json", self.username) + p = sfdx("org display --json", self.username) org_info = None stderr_list = [line.strip() for line in p.stderr_text] @@ -166,7 +166,7 @@ def get_access_token(self, **userfields): else: username = result[0]["Username"] - p = sfdx(f"force:org:display --targetusername={username} --json") + p = sfdx(f"org display --target-org={username} --json") if p.returncode: output = p.stdout_text.read() try: @@ -183,9 +183,9 @@ def get_access_token(self, **userfields): return info["result"]["accessToken"] def force_refresh_oauth_token(self): - # Call force:org:display and parse output to get instance_url and + # Call org display and parse output to get instance_url and # access_token - p = sfdx("force:org:open -r", self.username, log_note="Refreshing OAuth token") + p = sfdx("org open -r", self.username, log_note="Refreshing OAuth token") stdout_list = [line.strip() for line in p.stdout_text] @@ -198,7 +198,7 @@ def force_refresh_oauth_token(self): # Added a print json argument to check whether it is there or not def refresh_oauth_token(self, keychain, print_json=False): - """Use sfdx force:org:describe to refresh token instead of built in OAuth handling""" + """Use sfdx org display to refresh token instead of built in OAuth handling""" if hasattr(self, "_sfdx_info"): # Cache the sfdx_info for 1 hour to avoid unnecessary calls out to sfdx CLI delta = datetime.datetime.utcnow() - self._sfdx_info_date @@ -208,7 +208,7 @@ def refresh_oauth_token(self, keychain, print_json=False): # Force a token refresh self.force_refresh_oauth_token() self.print_json = print_json - # Get org info via sfdx force:org:display + # Get org info via sf org display self.sfdx_info # Get additional org info by querying API self._load_orginfo() diff --git a/cumulusci/core/config/tests/test_config_expensive.py b/cumulusci/core/config/tests/test_config_expensive.py index 7c3e879fca..5003d4eceb 100644 --- a/cumulusci/core/config/tests/test_config_expensive.py +++ b/cumulusci/core/config/tests/test_config_expensive.py @@ -376,7 +376,7 @@ def test_get_access_token(self, Command): with mock.patch("cumulusci.core.config.sfdx_org_config.sfdx", sfdx): access_token = config.get_access_token(alias="dadvisor") sfdx.assert_called_once_with( - "force:org:display --targetusername=whatever@example.com --json" + "org display --target-org=whatever@example.com --json" ) assert access_token == "the-token" @@ -792,7 +792,6 @@ def test_build_org_create_args(self, scratch_def_file): "noancestors": True, "sfdx_alias": "project__org", "default": True, - "instance": "NA01", "release": "previous", }, "test", @@ -804,18 +803,17 @@ def test_build_org_create_args(self, scratch_def_file): "tmp.json", "-w", "120", - "--targetdevhubusername", + "--target-dev-hub", "fake@fake.devhub", - "-n", - "--noancestors", - "--durationdays", + "--no-namespace", + "--no-ancestors", + "--duration-days", "1", - "release=previous", + "--release=previous", "-a", "project__org", - "adminEmail=test@example.com", - "-s", - "instance=NA01", + "--admin-email=test@example.com", + "--set-default", ] def test_build_org_create_args__email_in_scratch_def(self): diff --git a/cumulusci/core/dependencies/tests/test_dependencies.py b/cumulusci/core/dependencies/tests/test_dependencies.py index 6462e440f5..3c9a2b8f0b 100644 --- a/cumulusci/core/dependencies/tests/test_dependencies.py +++ b/cumulusci/core/dependencies/tests/test_dependencies.py @@ -861,7 +861,7 @@ def test_get_metadata_package_zip_builder__sfdx( context=mock.ANY, ) sfdx_mock.assert_called_once_with( - "force:source:convert", + "project convert source", args=["-d", mock.ANY, "-r", "force-app"], capture_output=True, check_return=True, diff --git a/cumulusci/core/keychain/base_project_keychain.py b/cumulusci/core/keychain/base_project_keychain.py index 561caeaec7..cb1f99a2f8 100644 --- a/cumulusci/core/keychain/base_project_keychain.py +++ b/cumulusci/core/keychain/base_project_keychain.py @@ -96,11 +96,7 @@ def set_default_org(self, name): org.config["default"] = True org.save() if org.created: - sfdx( - sarge.shell_format( - "force:config:set defaultusername={}", org.sfdx_alias - ) - ) + sfdx(sarge.shell_format("force config set target-org={}", org.sfdx_alias)) def unset_default_org(self): """unset the default orgs for tasks""" @@ -110,7 +106,7 @@ def unset_default_org(self): if org_config.default: del org_config.config["default"] org_config.save() - sfdx("force:config:set defaultusername=") + sfdx("config unset target-org=") # This implementation of get_default_org, set_default_org, and unset_default_org # is currently kept for backwards compatibility, but EncryptedFileProjectKeychain diff --git a/cumulusci/core/sfdx.py b/cumulusci/core/sfdx.py index d1c8fd01d7..3058fc80ac 100644 --- a/cumulusci/core/sfdx.py +++ b/cumulusci/core/sfdx.py @@ -35,17 +35,17 @@ def sfdx( Returns a `sarge` Command instance with returncode, stdout, stderr """ - command = f"sfdx {command}" + command = f"sf {command}" if args is not None: for arg in args: command += " " + shell_quote(arg) if username: - command += f" -u {shell_quote(username)}" + command += f" -o {shell_quote(username)}" if log_note: logger.info(f"{log_note} with command: {command}") # Avoid logging access token if access_token: - command += f" -u {shell_quote(access_token)}" + command += f" -o {shell_quote(access_token)}" env = env or {} p = sarge.Command( command, @@ -86,15 +86,15 @@ def shell_quote(s: str): def get_default_devhub_username(): p = sfdx( - "force:config:get defaultdevhubusername --json", + "config get target-dev-hub --json", log_note="Getting default Dev Hub username from sfdx", check_return=True, ) result = json.load(p.stdout_text) if "result" not in result or "value" not in result["result"][0]: raise SfdxOrgException( - "No sfdx config found for defaultdevhubusername. " - "Please use the sfdx force:config:set to set the defaultdevhubusername and run again." + "No sf config found for target-dev-hub. " + "Please use the sf config set to set the target-dev-hub and run again." ) username = result["result"][0]["value"] return username @@ -145,7 +145,7 @@ def convert_sfdx_source( if name: args += ["-n", name] sfdx( - "force:source:convert", + "project convert source", args=args, capture_output=True, check_return=True, diff --git a/cumulusci/core/tests/test_sfdx.py b/cumulusci/core/tests/test_sfdx.py index 0d6661284e..205996f296 100644 --- a/cumulusci/core/tests/test_sfdx.py +++ b/cumulusci/core/tests/test_sfdx.py @@ -23,14 +23,15 @@ class TestSfdx: def test_posix_quoting(self, Command): sfdx("cmd", args=["a'b"]) cmd = Command.call_args[0][0] - assert cmd == r"sfdx cmd 'a'\''b'" + assert cmd == r"sf cmd 'a'\''b'" @mock.patch("platform.system", mock.Mock(return_value="Windows")) @mock.patch("sarge.Command") def test_windows_quoting(self, Command): sfdx("cmd", args=['a"b'], access_token="token") cmd = Command.call_args[0][0] - assert cmd == r'sfdx cmd "a\"b" -u token' + print(cmd) + assert cmd == r'sf cmd "a\"b" -o token' @mock.patch("platform.system", mock.Mock(return_value="Windows")) def test_shell_quote__str_with_space(self): @@ -93,7 +94,7 @@ def test_convert_sfdx(): assert p is not None sfdx.assert_called_once_with( - "force:source:convert", + "project convert source", args=["-d", mock.ANY, "-r", path, "-n", "Test Package"], capture_output=True, check_return=True, @@ -109,7 +110,7 @@ def test_convert_sfdx__cwd(): assert p is not None sfdx.assert_called_once_with( - "force:source:convert", + "project convert source", args=["-d", mock.ANY, "-n", "Test Package"], capture_output=True, check_return=True, diff --git a/cumulusci/cumulusci.yml b/cumulusci/cumulusci.yml index 3f5b20acd8..976806332f 100644 --- a/cumulusci/cumulusci.yml +++ b/cumulusci/cumulusci.yml @@ -267,14 +267,14 @@ tasks: path: unpackaged/config/qa group: Salesforce Metadata dx: - description: Execute an arbitrary Salesforce DX command against an org. Use the 'command' option to specify the command, such as 'force:package:install' + description: Execute an arbitrary Salesforce DX command against an org. Use the 'command' option to specify the command, such as 'package install' class_path: cumulusci.tasks.sfdx.SFDXOrgTask group: Salesforce DX dx_convert_to: description: Converts src directory metadata format into sfdx format under force-app class_path: cumulusci.tasks.sfdx.SFDXBaseTask options: - command: "force:mdapi:convert -r src" + command: "project convert mdapi -r src" group: Salesforce DX dx_convert_from: description: Converts force-app directory in sfdx format into metadata format under src @@ -286,13 +286,13 @@ tasks: description: Uses sfdx to pull from a scratch org into the force-app directory class_path: cumulusci.tasks.sfdx.SFDXOrgTask options: - command: "force:source:pull" + command: "project retrieve start --ignore-conflicts" group: Salesforce DX dx_push: description: Uses sfdx to push the force-app directory metadata into a scratch org class_path: cumulusci.tasks.sfdx.SFDXOrgTask options: - command: "force:source:push" + command: "project deploy start --ignore-conflicts" group: Salesforce DX enable_einstein_prediction: description: Enable an Einstein Prediction Builder prediction. diff --git a/cumulusci/tasks/command.py b/cumulusci/tasks/command.py index 2de71f8577..1935fc3e6f 100644 --- a/cumulusci/tasks/command.py +++ b/cumulusci/tasks/command.py @@ -146,7 +146,7 @@ class SalesforceCommand(Command): """Execute a Command with SF credentials provided on the environment. Provides: - * SF_INSTANCE_URL + * SF_ORG_INSTANCE_URL * SF_ACCESS_TOKEN """ @@ -158,7 +158,7 @@ def _update_credentials(self): def _get_env(self): env = super(SalesforceCommand, self)._get_env() env["SF_ACCESS_TOKEN"] = self.org_config.access_token - env["SF_INSTANCE_URL"] = self.org_config.instance_url + env["SF_ORG_INSTANCE_URL"] = self.org_config.instance_url return env diff --git a/cumulusci/tasks/connectedapp.py b/cumulusci/tasks/connectedapp.py index 2566e3b13a..706c8132fc 100644 --- a/cumulusci/tasks/connectedapp.py +++ b/cumulusci/tasks/connectedapp.py @@ -47,7 +47,7 @@ class CreateConnectedApp(SFDXBaseTask): "description": "The email address to associate with the connected app. Defaults to email address from the github service if configured." }, "username": { - "description": "Create the connected app in a different org. Defaults to the defaultdevhubusername configured in sfdx.", + "description": "Create the connected app in a different org. Defaults to the target-dev-hub configured in sfdx.", "required": False, }, "connect": { @@ -63,7 +63,7 @@ class CreateConnectedApp(SFDXBaseTask): def _init_options(self, kwargs): self.client_id = None self.client_secret = None - kwargs["command"] = "force:mdapi:deploy --wait {}".format(self.deploy_wait) + kwargs["command"] = "project deploy start --wait {}".format(self.deploy_wait) super(CreateConnectedApp, self)._init_options(kwargs) # Validate label @@ -91,7 +91,7 @@ def _set_default_username(self): self.logger.info("Getting username for the default devhub from sfdx") output = [] self._run_command( - command="{} force:config:get defaultdevhubusername --json".format(SFDX_CLI), + command="{} force config get target-dev-hub --json".format(SFDX_CLI), env=self._get_env(), output_handler=output.append, ) @@ -109,7 +109,7 @@ def _process_devhub_output(self, output): data = self._process_json_output(output) if "value" not in data["result"][0]: raise TaskOptionsError( - "No sfdx config found for defaultdevhubusername. Please use the sfdx force:config:set to set the defaultdevhubusername and run again" + "No sfdx config found for target-dev-hub. Please use the sf force config set to set the target-dev-hub and run again" ) self.options["username"] = data["result"][0]["value"] @@ -166,11 +166,11 @@ def _connect_service(self): def _get_command(self): command = super()._get_command() - # Default to sfdx defaultdevhubusername + # Default to sf target-dev-hub if "username" not in self.options: self._set_default_username() - command += " -u {}".format(self.options.get("username")) - command += " -d {}".format(self.tempdir) + command += " -o {}".format(self.options.get("username")) + command += " --metadata-dir {}".format(self.tempdir) return command def _run_task(self): diff --git a/cumulusci/tasks/dx_convert_from.py b/cumulusci/tasks/dx_convert_from.py index ff242ce91e..45d9f1bd0a 100644 --- a/cumulusci/tasks/dx_convert_from.py +++ b/cumulusci/tasks/dx_convert_from.py @@ -16,8 +16,8 @@ class DxConvertFrom(SFDXBaseTask): def _init_options(self, kwargs): super()._init_options(kwargs) - # append command -d option to sfdx} force:source:convert - self.options["command"] = f"force:source:convert -d {self.options['src_dir']}" + # append command -d option to sf} project convert source + self.options["command"] = f"project convert source -d {self.options['src_dir']}" def _run_task(self): src_dir = Path(self.options["src_dir"]) diff --git a/cumulusci/tasks/salesforce/sourcetracking.py b/cumulusci/tasks/salesforce/sourcetracking.py index 5dc9a83795..27567ddb20 100644 --- a/cumulusci/tasks/salesforce/sourcetracking.py +++ b/cumulusci/tasks/salesforce/sourcetracking.py @@ -150,7 +150,7 @@ def _reset_sfdx_snapshot(self): self.org_config, ScratchOrgConfig ): sfdx( - "force:source:tracking:reset", + "project reset tracking", args=["-p"], username=self.org_config.username, capture_output=True, @@ -229,7 +229,7 @@ def retrieve_components( ): """Retrieve specified components from an org into a target folder. - Retrieval is done using the sfdx force:source:retrieve command. + Retrieval is done using the sf project retrieve start command. Set `md_format` to True if retrieving into a folder with a package in metadata format. In this case the folder will be temporarily @@ -240,7 +240,6 @@ def retrieve_components( target = os.path.realpath(target) profiles = [] - # If retrieve_complete_profile and project_config is None, raise error # This is because project_config is only required if retrieve_complete_profile is True if retrieve_complete_profile and project_config is None: @@ -274,7 +273,7 @@ def retrieve_components( {"packageDirectories": [{"path": "force-app", "default": True}]}, f ) sfdx( - "force:mdapi:convert", + "project convert mdapi", log_note="Converting to DX format", args=["-r", target, "-d", "force-app"], check_return=True, @@ -292,7 +291,7 @@ def retrieve_components( # Retrieve specified components in DX format p = sfdx( - "force:source:retrieve", + "project retrieve start", access_token=org_config.access_token, log_note="Retrieving components", args=[ @@ -302,10 +301,11 @@ def retrieve_components( os.path.join(package_xml_path, "package.xml"), "-w", "5", + "--ignore-conflicts", ], capture_output=capture_output, check_return=True, - env={"SFDX_INSTANCE_URL": org_config.instance_url}, + env={"SF_ORG_INSTANCE_URL": org_config.instance_url}, ) # Extract Profiles @@ -321,11 +321,10 @@ def retrieve_components( task_config=task_config, ) cls_retrieve_profile() - if md_format: # Convert back to metadata format sfdx( - "force:source:convert", + "project convert source", log_note="Converting back to metadata format", args=["-r", "force-app", "-d", target], capture_output=capture_output, diff --git a/cumulusci/tasks/salesforce/tests/test_nonsourcetracking.py b/cumulusci/tasks/salesforce/tests/test_nonsourcetracking.py index 2dc1c1142e..066c371943 100644 --- a/cumulusci/tasks/salesforce/tests/test_nonsourcetracking.py +++ b/cumulusci/tasks/salesforce/tests/test_nonsourcetracking.py @@ -215,9 +215,9 @@ def test_run_task(self, sfdx, create_task_fixture): assert "SharingRules: alpha" in messages assert "SharingRules: BusinessBrand" not in messages assert sfdx_calls == [ - "force:mdapi:convert", - "force:source:retrieve", - "force:source:convert", + "project convert mdapi", + "project retrieve start", + "project convert source", ] assert os.path.exists(os.path.join("src", "package.xml")) diff --git a/cumulusci/tasks/salesforce/tests/test_sourcetracking.py b/cumulusci/tasks/salesforce/tests/test_sourcetracking.py index 97583af20c..258d1a1e32 100644 --- a/cumulusci/tasks/salesforce/tests/test_sourcetracking.py +++ b/cumulusci/tasks/salesforce/tests/test_sourcetracking.py @@ -188,11 +188,10 @@ def test_run_task(self, sfdx, create_task_fixture): pathlib.Path, "is_dir", return_value=True ): task._run_task() - assert sfdx_calls == [ - "force:mdapi:convert", - "force:source:retrieve", - "force:source:convert", + "project convert mdapi", + "project retrieve start", + "project convert source", ] assert os.path.exists(os.path.join("src", "package.xml")) mock_retrieve_profile.assert_called() diff --git a/cumulusci/tasks/sfdx.py b/cumulusci/tasks/sfdx.py index 612c1376f8..717fc26570 100644 --- a/cumulusci/tasks/sfdx.py +++ b/cumulusci/tasks/sfdx.py @@ -17,7 +17,7 @@ from cumulusci.core.tasks import BaseSalesforceTask from cumulusci.tasks.command import Command -SFDX_CLI = "sfdx" +SFDX_CLI = "sf" class SFDXBaseTask(Command): @@ -47,20 +47,20 @@ def _get_command(self): command = super()._get_command() # For scratch orgs, just pass the username in the command line if isinstance(self.org_config, ScratchOrgConfig): - command += " -u {username}".format(username=self.org_config.username) + command += " -o {username}".format(username=self.org_config.username) return command def _get_env(self): env = super(SFDXOrgTask, self)._get_env() if not isinstance(self.org_config, ScratchOrgConfig): # For non-scratch keychain orgs, pass the access token via env var - env["SFDX_INSTANCE_URL"] = self.org_config.instance_url - env["SFDX_DEFAULTUSERNAME"] = self.org_config.access_token + env["SF_ORG_INSTANCE_URL"] = self.org_config.instance_url + env["SF_TARGET_ORG"] = self.org_config.access_token return env class SFDXJsonTask(SFDXOrgTask): - command = "force:mdapi:deploy --json" + command = "project deploy start --json" task_options = { "extra": {"description": "Append additional options to the command"} diff --git a/cumulusci/tasks/tests/test_command.py b/cumulusci/tasks/tests/test_command.py index bea9df4fb6..128353f08c 100644 --- a/cumulusci/tasks/tests/test_command.py +++ b/cumulusci/tasks/tests/test_command.py @@ -126,4 +126,4 @@ def test_get_env(self): task = SalesforceCommand(self.project_config, self.task_config, self.org_config) env = task._get_env() assert "SF_ACCESS_TOKEN" in env - assert "SF_INSTANCE_URL" in env + assert "SF_ORG_INSTANCE_URL" in env diff --git a/cumulusci/tasks/tests/test_connectedapp.py b/cumulusci/tasks/tests/test_connectedapp.py index 3f4c4666b8..81e6f765eb 100644 --- a/cumulusci/tasks/tests/test_connectedapp.py +++ b/cumulusci/tasks/tests/test_connectedapp.py @@ -97,7 +97,10 @@ def test_get_command(self, run_command_mock): ) task.tempdir = "asdf" command = task._get_command() - assert command == "sfdx force:mdapi:deploy --wait 5 -u username -d asdf" + assert ( + command + == "sf project deploy start --wait 5 -o username --metadata-dir asdf" + ) def test_process_json_output(self): """_process_json_output returns valid json""" diff --git a/cumulusci/tasks/tests/test_dx_convert_from.py b/cumulusci/tasks/tests/test_dx_convert_from.py index a966fc7c1b..5c7b3f35bb 100644 --- a/cumulusci/tasks/tests/test_dx_convert_from.py +++ b/cumulusci/tasks/tests/test_dx_convert_from.py @@ -51,7 +51,7 @@ def test_dx_convert_from(sarge, sarge_process, dx_convert_task): assert not src_dir.exists() sarge.Command.assert_called_once_with( - "sfdx force:source:convert -d src", + "sf project convert source -d src", cwd=".", env=ANY, shell=True, diff --git a/cumulusci/tasks/tests/test_sfdx.py b/cumulusci/tasks/tests/test_sfdx.py index b2e443e45b..513793cc08 100644 --- a/cumulusci/tasks/tests/test_sfdx.py +++ b/cumulusci/tasks/tests/test_sfdx.py @@ -37,7 +37,7 @@ def setup_method(self): def test_base_task(self): """The command is prefixed w/ sfdx""" - self.task_config.config["options"] = {"command": "force:org", "extra": "--help"} + self.task_config.config["options"] = {"command": "org", "extra": "--help"} task = SFDXBaseTask(self.project_config, self.task_config) try: @@ -45,8 +45,8 @@ def test_base_task(self): except CommandException: pass - assert task.options["command"] == "force:org" - assert task._get_command() == "sfdx force:org --help" + assert task.options["command"] == "org" + assert task._get_command() == "sf org --help" @patch("cumulusci.tasks.command.Command._run_task", MagicMock(return_value=None)) def test_keychain_org_creds(self): @@ -71,24 +71,26 @@ def refresh_oauth_token(keychain): task() org_config.refresh_oauth_token.assert_called_once() - assert "SFDX_INSTANCE_URL" in task._get_env() - assert "SFDX_DEFAULTUSERNAME" in task._get_env() - assert access_token in task._get_env()["SFDX_DEFAULTUSERNAME"] + print(task._get_env()) + assert "SF_ORG_INSTANCE_URL" in task._get_env() + assert "SF_TARGET_ORG" in task._get_env() + assert access_token in task._get_env()["SF_TARGET_ORG"] def test_scratch_org_username(self): """Scratch Org credentials are passed by -u flag""" - self.task_config.config["options"] = {"command": "force:org --help"} + self.task_config.config["options"] = {"command": "org --help"} org_config = ScratchOrgConfig({"username": "test@example.com"}, "test") task = SFDXOrgTask(self.project_config, self.task_config, org_config) - assert "-u test@example.com" in task._get_command() + assert "-o test@example.com" in task._get_command() class TestSFDXJsonTask: def test_get_command(self): task = create_task(SFDXJsonTask) command = task._get_command() - assert command == "sfdx force:mdapi:deploy --json" + print(command) + assert command == "sf project deploy start --json" def test_process_output(self): task = create_task(SFDXJsonTask) diff --git a/cumulusci/tasks/vlocity/tests/test_vlocity.py b/cumulusci/tasks/vlocity/tests/test_vlocity.py index 7fa45536ad..e30be94ab2 100644 --- a/cumulusci/tasks/vlocity/tests/test_vlocity.py +++ b/cumulusci/tasks/vlocity/tests/test_vlocity.py @@ -247,7 +247,7 @@ def test_deploy_omni_studio_site_settings( # The frequent error is: # # "name": "NoOrgFound", -# "action": "Run the \"sfdx force:auth\" commands with --setdefaultusername to connect to an org and set it as your default org.\nRun \"force:org:create\" with --setdefaultusername to create a scratch org and set it as your default org.\nRun \"sfdx force:config:set defaultusername=\" to set your default username." +# "action": "Run the \"sfdx force:auth\" commands with --target-org to connect to an org and set it as your default org.\nRun \"org create scratch\" with --target-org to create a scratch org and set it as your default org.\nRun \"sf config set target-org=\" to set your default username." # } diff --git a/cumulusci/tasks/vlocity/vlocity.py b/cumulusci/tasks/vlocity/vlocity.py index 2071a61c83..c1d0f68085 100644 --- a/cumulusci/tasks/vlocity/vlocity.py +++ b/cumulusci/tasks/vlocity/vlocity.py @@ -105,8 +105,8 @@ def _add_token_to_sfdx(self, access_token: str, instance_url: str) -> str: """ # TODO: Use the sf v2 form of this command instead (when we migrate) token_store_cmd = [ - "sfdx", - "force:auth:accesstoken:store", + "sf", + "org login access-token", "--no-prompt", "--alias", f"{VBT_SF_ALIAS}", diff --git a/docs/env-var-reference.md b/docs/env-var-reference.md index b9f5628e5c..cc01c8a798 100644 --- a/docs/env-var-reference.md +++ b/docs/env-var-reference.md @@ -69,5 +69,4 @@ org, e.g. a Dev Hub. Set with SFDX_CLIENT_ID. ## `SFDX_ORG_CREATE_ARGS` -Extra arguments passed to `sfdx force:org:create`. Can be used to pass -key-value pairs. +Extra arguments passed to `sf org create scratch`. diff --git a/docs/get-started.md b/docs/get-started.md index 545f22d57a..d3b702d581 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -180,12 +180,12 @@ To set up Salesforce DX: Org](https://developer.salesforce.com/docs/atlas.en-us.228.0.sfdx_dev.meta/sfdx_dev/sfdx_setup_enable_devhub.htm) 3. [Connect SFDX to Your Dev Hub Org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm) - - Be sure to use the `--setdefaultdevhubusername` option! + Be sure to use the `--set-default-dev-hub` option! -If you have the `sfdx` command installed, are connected to your Dev Hub, -and set the `defaultdevhubusername` config setting (use -`sfdx force:config:list` to verify), you're now ready to use `cci` with -`sfdx` to build scratch orgs. +If you have the `sf` command installed, are connected to your Dev Hub, +and set the `target-dev-hub` config setting (use +`sf config list` to verify), you're now ready to use `cci` with +`sf` to build scratch orgs. ```{important} SFDX supports multiple Dev Hubs, so CumulusCI uses the one set as @@ -464,7 +464,7 @@ package namespace matches the namespace you entered when running command to extract your package metadata. ```console -$ sfdx force:source:retrieve -n package_name /path/to/project/ +$ sf project retrieve start -n package_name /path/to/project/ ``` That's it! You now have all of the metadata you care about in a single diff --git a/docs/github-actions.md b/docs/github-actions.md index f6950f6e70..08945a268d 100644 --- a/docs/github-actions.md +++ b/docs/github-actions.md @@ -181,15 +181,15 @@ The Cumulus Suite Actions **require CumulusCI 3.61.1 or greater** for any operat All Actions that interact with persistent orgs (such as a packaging org or Dev Hub) authorize those orgs using SFDX Auth URLs. These URLs are obtained via by first authorizing an org to the CLI: -`sfdx auth:web:login -a packaging` +`sf org login web -a packaging` and then retrieving the auth URL from the JSON output of the command -`sfdx force:org:display --json --verbose` +`sf org display --json --verbose` under the key `sfdxAuthUrl` under `result`. -If you have `jq` installed, you can do `sfdx force:org:display -u packaging-gh --json --verbose | jq -r .result.sfdxAuthUrl`. +If you have `jq` installed, you can do `sf org display -u packaging-gh --json --verbose | jq -r .result.sfdxAuthUrl`. First-generation package projects will have two auth-URL secrets, for the packaging org and for the Dev Hub. Second-generation and Unlocked package projects will have at least one auth-URL secret, for the Dev Hub, and may have diff --git a/docs/headless.md b/docs/headless.md index ae43464008..78fb913152 100644 --- a/docs/headless.md +++ b/docs/headless.md @@ -121,7 +121,7 @@ and then use it directly from CumulusCI. To do so, follow these steps. 1. Retrieve your auth URL. -1. Authorize the org using `sfdx auth:sfdxurl:store`. +1. Authorize the org using `sf org login sfdx-url`. 1. Run `cci org import `. ### JWT Flow Authorization diff --git a/docs/managed-2gp.md b/docs/managed-2gp.md index 840de68506..83b77f70df 100644 --- a/docs/managed-2gp.md +++ b/docs/managed-2gp.md @@ -170,7 +170,7 @@ the GitHub release operations: $ cci task run promote_package_version --version_id 04t000000000000 --promote_dependencies True ``` -Alternatively, you can use the `sfdx force:package:version:promote` +Alternatively, you can use the `sf package version promote` command to promote a 2GP package. Note that using this command will also not perform any release operations in GitHub. diff --git a/docs/scratch-orgs.md b/docs/scratch-orgs.md index 93e46f1203..83b5c90fa5 100644 --- a/docs/scratch-orgs.md +++ b/docs/scratch-orgs.md @@ -115,7 +115,7 @@ Scratch org limits are based on your Dev Hub's edition and your Salesforce contract. To review limits and consumption, run the command: ```console -$ sfdx force:limits:api:display -u +$ sf org list limits --target-org ``` `` is your Dev Hub username. The limit names are