A golang cli implementation of useful filehandling features between local filesystem and netsuite filecabinet
π Works only for mac and linux and netsuite accounts on 2018.1 with the 2018.1 sdfcli
- Download release for linux or mac
- For convenience - add binary to directory included in
$PATH
- Initialize dependencies
./suitesync -v init
- Go to Setup > Company > Setup Tasks > Enable Features.
- Click the SuiteCloud subtab.
- Scroll down to the SuiteScript section, and check the following boxes:
- Client SuiteScript.
- Server SuiteScript. Click I Agree on the SuiteCloud Terms of Service page.
- Scroll to SuiteCloud Development Framework section and check
SUITECLOUD DEVELOPMENT FRAMEWORK
- Click Save.
π¨ The cli setup process currently only works for linux and mac
Download suitesync release and issue a token to be used for authentication.
# add to .env file in suitesync dir if needed multiple times
export NSCONF_EMAIL=foo@bar.com # email of the issuing user
export NSCONF_ACCOUNT=123456 # account id
export NSCONF_REALM=system.netsuite.com #url of the account
suitesync issuetoken [password]
Take output of command and add it to the environment variable NSCONF_CLITOKEN
for use in automated processes.
βοΈ Add the environment variables for local use in
.env
file in directory ofsuitesync
cli or in circle-ci context
π‘ If you are on a windows machine use this method
- Create application
- Go to Setup > Integration > Integration Management > Manage Integrations > New
- Enter a name for your application.
- Enter a description, if desired.
- The application State is Enabled by default. (the other option available for selection is blocked.)
- Enter a note, if desired.
- Check the token-based authentication box on the authentication subtab
- Take note of the
consumer key
andconsumer secret
- Create access token
- Go to
Manage Access Tokens
link in you dashboard (settings portlet) - Click create access token
- Choose name of application you create beforehand
- Take note of
token id
andtoken secret
- Go to
Add following variables to the environment for use in automated processes:
export NSCONF_CONSUMER_KEY=consumer key
export NSCONF_CONSUMER_SECRET=consumer secret
export NSCONF_TOKEN_ID=token id
export NSCONF_TOKEN_SECRET=token secret
βοΈ Add the environment variables for local use in
.env
file in directory ofsuitesync
cli or in circle-ci context
suitesync -v init # verbose mode - much more logging
suitesync -V init # show version
Initializes the sdfcli and downloads needed dependencies.
suitesync init # i
Issue netsuite cli token
suitesync issuetoken # it
Sync local directory to remote filecabinet directory. Uses hashfile to keep directories in sync.
suitesync sync [src] [dest] # s
Download remote filecabinet directories and or files to local directory.
suitesync download [src...] [dest] # d
Upload local directories and/or files to remote filecabinet directory.
suitesync upload [src...] [dest] # u
Delete remote filecabinet directories and or files
suitesync delete [paths...] # del
Use ci/circleci-example.yml
as .circleci/config.yml
file in repository. For standard sync of one local directory to filecabinet directory this configuration file does not have to be changed.
Setup circle-ci context
You will need to set following variables in the circle-ci context (! not in the config.yml
file)
########################
####### REQUIRED #######
########################
# Netsuite account
export NSCONF_ACCOUNT=123456
# E-mail of the user that generated the credentials
export NSCONF_EMAIL=mail@foobar.com
# Automatically generated credentials
export NSCONF_CLITOKEN=cli_token
#### OR ####
# Manually generated credentials
export NSCONF_CONSUMER_KEY=consumer_key
export NSCONF_CONSUMER_SECRET=consumer_secret
export NSCONF_TOKEN_ID=token_id
export NSCONF_TOKEN_SECRET=token_secret
# Specify the realm of the account to be used
export NSCONF_REALM=system.netsuite.com
# Specify the relative src directory in the filesystem
export RELATIVE_SRC=./
# Specify the absolute destination directory in the ns filecabinet
export ABSOLUTE_DST=/SuiteScripts
########################
####### OPTIONAL #######
########################
# Specify the version of the go-suitesync release to be used
export RELEASE=0.0.3 # defaults to 0.0.3 (current release)
# Specify name of hashfile
export NSCONF_HASHFILE=foobar.json # defaults to "hashes.json"
# Specify role of user
export NSCONF_ROLE=3 # defaults to "3"
# ONLY USE IF ABSOLUTELY NECESSARY
# Specify password of user (if golang GenerateToken function is used)
export NSCONF_PASSWORD=?foo!
π‘ Refer to (Automatically generate credentials or Manually generate credentials) for how to generate auth credentials
- Push
config.yml
to remote repository - Add project to circle-ci
- Trigger initial build
If you need to set up different branches to deploy to different accounts you can use following workflow:
π You can find the script that is used to set the environment variables according to the branch here
To start building another branch the branch name has to be added to config.yml
. At the end of the script the new branch name has to be added to every occurence of:
---
filters:
branches:
only:
- master
- new-branch-name
To add different variable names for different accounts to the circle-ci context use following syntax (prefix the standard variable names with the branch name and concatenate them with "_"). Every environment variable can be altered in that way
π¨ If no branch environment variable is found the fallback is the standard variable (for foo_NSCONF_ACCOUNT = NSCONF_ACCOUNT)
# account is used for master branch
master_NSCONF_ACCOUNT=master-account
# clitoken is used for development branch
development_NSCONF_CLITOKEN=clitoken-development-branch
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Tests
- Create docker image
- Enable use on windows
- Migrate
sdfcli
calls to SuiteTalk implementation