amtrack / force-dev-tool

[DEPRECATED] Command line tool supporting the Force.com development lifecycle
MIT License
108 stars 37 forks source link

how to pass the sfdc username, passwd and url in the deploy command #92

Closed okram999 closed 7 years ago

okram999 commented 7 years ago

Using force-dev-tool in a build script, can you please elaborate this section? how do i pass the credential info in the test / deploy task?

amtrack commented 7 years ago

Hi @okram999

thanks for letting me know that this section is unclear. What do you think about putting the following in a wiki page and referencing the page in that README section?

1) In a simple scenario you can inject the credentials for a default remote using the following environment variables

$ export SFDC_USERNAME=jdoe@universal-containers.com.mydev
$ export SFDC_PASSWORD=passwordWithSecurityToken
$ export SFDC_SERVER_URL=https://test.salesforce.com

listing your remotes then leads to

$ force-dev-tool remote -v
env (default): jdoe@universal-containers.com.mydev passwordWithSecurityToken https://test.salesforce.com

That means you can either pass the remote name env to a test/deploy command or even leave it out as it is the default remote and therefore optional for most of the commands (e.g. Usage: force-dev-tool test [options] [<remote>]):

$ force-dev-tool test
$ force-dev-tool test env

2) In a more complex scenario, let's say you want to retrieve metadata from one sandbox and deploy it to another one, you could also inject multiple credentials using environment variables following the schema SFDC_XXX_USERNAME, SFDC_XXX_PASSWORD, SFDC_XXX_SERVER_URL:

$ export SFDC_source_USERNAME=jdoe@universal-containers.com.mydev
$ export SFDC_source_PASSWORD=passwordWithSecurityToken
$ export SFDC_source_SERVER_URL=https://test.salesforce.com
$ export SFDC_target_USERNAME=jdoe@universal-containers.com.qa
$ export SFDC_target_PASSWORD=password2WithSecurityToken2
$ export SFDC_target_SERVER_URL=https://test.salesforce.com

listing your remote environments then leads to

$ force-dev-tool remote -v
source: jdoe@universal-containers.com.mydev passwordWithSecurityToken https://test.salesforce.com
target: jdoe@universal-containers.com.qa password2WithSecurityToken2 https://test.salesforce.com

retrieving from source and deploying to target

$ force-dev-tool retrieve source
$ force-dev-tool deploy target