Package: ntscli-client
ntscli-clientRequirementspython 3.8 or later with matching pipNTS-CLI compatible SSL configurationArchitectureThe ntscli-client is combined with the ntscli-cloud-lib to build the nts command line tool.
The nts-cli-cloud lib is built separately from the ntscli-client and then updated by bumping the version
in the ntscli_client setup.py file.Buildingntscli-cloud-libIf you need to add a parameter to one of the automator messages, you will need to modify the cloud lib.To add the new parameter, you modify the file automator.proto. You add a comment and a line like this:
// Boolean. Use this to request a test plan that only has the list of calibration tests.
google.protobuf.BoolValue calibration = 2;To build, use:
tox -e protoThat will cause the automator.py file to be updated with the new proto.Finally, you can install it in your local environment. Just cd to the lib directory and do a
pip install . --userThat copies it to your local environment, which you can check with:
pip freeze | grep ntscli_cloud_libAfter that, the nts client will just pick up the library automatically.Once you are happy with the change, merge to master and then go here:https://nts.builds.test.netflix.net/job/PYPI-NTSSER-ntscli-cloud-libClick the Release Next Version button to create a new release version.To pick up the release in the client, bump the requirement version in ntscli_client setup.py:
'ntscli-cloud-lib==0.1.37'
and then you can test and release that similarly.This keeps people from picking up stray updates that might break you.ntscli-clientMake changes in a feature branch. The PRs will be built here:https://nts.builds.test.netflix.net/job/NTSSER-ntscli-client/Any commit you push will go into Jenkins and build and the spinnaker will run tests but nothing goes public.
You make a fork branch (feature-thing-rc1) if spinnaker passes and notices that there is an "rc" in the branch name,
it will go ahead and push it to release. You can bypass this and do it manually (if the script fails, for instance) by:merge to masterpython setup.py version --bump patch --commit --pushThis modifies a localversion.py file to match the correct version. This is important, as it tells the --version commands what to print.
Then it does the correct git tag/commit/push.This is provided by a library called setupmeta, which is written by Netflix employee Zoran S., who is on #python;
and is built in to newt.If step 2 fails, force it by modifying theversion.py file by hand, and tagging with a matching number:git tag v2.1.10002 (the v is important)git push / git push --tag as usualOnce you run the setup command, a new build will run here:https://nts.builds.test.netflix.net/job/NTSSER-ntscli-client-master/This build is responsible for releasing the client by pushing it to pypi. You can see all the versions of the client available on pypi by going here:https://pypi.org/search/?q=ntscli-clientPypiPypi is currently used to host the client and make it available to partners for download and install. The account credentials for pypi can be found here:https://secretbook.prod.security.netflix.net/group/103793/accessAccess is granted to the pax team.InstallInstalling on the OS python:Ubuntu only: You might need to install pip3 on Ubuntu if you haven't already:sudo apt install -y python3-pipThen this only requires python 3.8 or later, which is already installed on Ubuntu 18.04 and later, and macOS Catalina.pip3 install -U ntscli-clientUbuntu only: Ubuntu doesn't set up the user PATH to include the local user's python binary path.
You might have to do something like this if you can't findntsafter install:echo "export PATH=\"$(python3 -m site --user-base)/bin:$PATH\"" >> ~/.bashrc
source ~/.bashrcInstall your security certificateYou still need asecurity certificate, as documented here.
Once it's a decrypted zip file, you can now install it pretty easily with this tool:nts ssl install ~/Downloads/cloud.zipManually moving it to ~/.config/netflix/cloud/(files) still works as well.Update OftenUse the same pip3 command, but especially for the first little while there will probably be frequent updates.We suggest updating frequently anyway. For instance, for docker images or CI systems, you can install/update every time the image is
created or run. If a released update to the RAE requires matching client or client library updates, you would not require any additional
work to take the update.VersioningWe will be following standard python semantic versioning, so if you really want to pin versions, you can follow standard python practices:pip3installntscli-client<=3.0.0# don't accidentally pick up a new major version, which could include breaking changespip3installntscli-client==0.1.4# a specific older versionpip3installntscli-client>=0.1.5# anything after a specific versionEnjoynts --helpexportRAE=r3000334exportESN=$(ntsget-devices|jq-r'map(.esn)[0]')# actually just the first ESN I find# or for powershell:$env:RAE='r3000334'$env:ESN='NFANDROID2-PRV-SHIELDANDROIDTV-NVIDISHIELD=ANDROID=TV-15895-BB9C5AF4E97B69BC1A51654A94304D3AD88169C2BA2F1338192C20E940AE669E'ntsget-plan# prints to stdout# get a plan dynamicallyntsrun--namesAUDIO-001-TC1,ACT-004-TC11# get a plan and run it immediatelyntsget-plan|ntsrun--namesAUDIO-001-TC1,ACT-004-TC11# save the plan via shell redirectionntsget-plan>full_plan.json# save the plan with an arg insteadntsget-plan--save-tofull_plan.json# Choosing what to run## Just at run:ntsrun--namesAUDIO-001-TC1,ACT-004-TC11# gets the test plan first, then filtersntsrun--testplanfull_plan.json--namesAUDIO-001-TC1,ACT-004-TC11# saves you the 1-2 minutes getting the test plan if you already have one## using filesntsget-plan--save-tofull_plan.json
catfull_plan.json|jq-r'{target: .target, testplan: {branch: .testplan.branch, sdkVersion: .testplan.sdkVersion, testcases: [.testplan.testcases[] | select(.category | startswith("Config"))] }}'>filtered_plan.json
catfiltered_plan.json|ntsrun## built-in filtering commandntsget-plan--save-tofull_plan.json
ntsfilter--help
ntsfilter--namesAUDIO-001-TC1<full_plan.json>filtered_plan.json
ntsfilter--namesAUDIO-001-TC1--testplanfull_plan.json--save-tofiltered_plan.json
ntsfilter--names-re"AUDIO.*TC3"full_plan.json--save-tofiltered_plan.json
ntsget-plan|ntsfilter--eyepatch--tagsbatch|ntsrun## DIY Filtering using external tools, if you -really- want toCURRENT_EPOCH=$(date+%s)ntsget-plan|jq-r'{target: .target, testplan: {branch: .testplan.branch, sdkVersion: .testplan.sdkVersion, testcases: [.testplan.testcases[] | select(.category | startswith("Config"))] }}'|ntsrun2>${CURRENT_EPOCH}.stderr.txt>${CURRENT_EPOCH}.jsonFeaturesJSON goes to stdout, logging goes to stderr:nts get-devices > device_list.jsonTypical shell exit codes for commands, mean you can use shell checks such as:nts get-devices || echo FAILMulti-OS, multi-shell compatibleTab completion available (seents completion show --help)Available via PYPI, using standard versioningAlternative InstallsPre-release installs:pip3 install -U ntscli-client --preIf Netflix posts a pre-release that might include a bug fix specifically for you, you might be asked to try this.Install for any user of the OS (generally discouraged):sudo pip3 install -U ntscli-clientIf you are managing a server that might have lots of users that need the same install, this might be a good solution if you don't prefer
using an alternate abstraction such as a virtual environment, conda environment, etc.Installing in an isolation environmentPython is well known for isolation environments like virtualenv, conda, pyenv, etc. These all work, and you should have no trouble using these if you prefer.