h:5em

DevOps with SASjs

Allan Bowe

h:5em

The SASjs approach

h:5em

Why Choose SASjs?

  • Open Source (MIT)
  • Cross Platform (Base SAS, SAS 9, Viya)
  • Active Development & Support
h:5em

Why Use SASjs?

  • Git-Native SAS Projects
    • compile & build locally
    • deploy & execute remotely
  • Self-Documenting
  • Test Driven Development
h:5em

Where to use SASjs?

  • VS Code / local IDE
  • Jenkins / scheduling systems
  • Bitbucket / Gitlab Pipelines, Github Actions
  • GIT Hooks
  • Web Apps
  • Data Engineering / Data Science projects
h:5em

SASjs Framework

h:5em

SASjs Core

  • ~170 macros geared towards Application Development
  • Functions, Procedures, Metadata, Viya, Lua, FCMP
  • npm install @sasjs/core
h:5em

SASjs Adapter

  • Authentication
  • Bidirectional communication with SAS
  • npm install @sasjs/adapter
h:5em

SASjs CLI

  • Opinionated Project Setup
  • DevOps, Documentation & Testing
  • npm install --global @sasjs/cli
h:5em

SASjs SAS Files

  • Primary (deployed)
    • Jobs
    • Services
    • Tests
  • Supporting (compiled into Primary)
    • Macros
    • Includes
h:5em

SASjs Lingo

  • AppLoc
    • "App Location"
    • Root folder in SAS Drive or Metadata
  • Target
    • "The place you deploy your app"
    • encompasses ALL attributes, eg serverUrl, appLoc, serverType
h:5em

sasjs create

  • Prepare a SAS project with an opinionated structure
  • Structure is documented within sasjsconfig.json
  • Templates:
    • sasjs create myapp -t jobs
    • sasjs create myapp -t minimal
    • sasjs create myapp -t react
    • sasjs create myapp -t angular
h:5em

Project Structure

h:5em

sasjs add

  • Define a Target
  • Client / Secret
  • App Location (appLoc)
h:5em

sasjs run

  • sasjs run code.sas
h:5em

sasjs doc

h:5em

Data Lineage

h:5em

Doxygen Headers

h:5em

sasjsconfig.json

  • Project configuration
    • docConfig
    • testConfig
    • jobConfig
    • deployConfig
    • macroFolders
    • ...
  • root / target level
h:5em

sasjs compile

  • One file per Job / Service / Test
  • Init + Term programs
  • Macro Variables
h:5em

sasjsbuild directory

h:5em

sasjs build

  • Many files to 1 (or 2)
    • SAS program (SAS 9 + Viya)
      • Generated by default
    • JSON file (Viya only)
      • if deployServicePack:true
h:5em

sasjs deploy

  • Loads JSON if deployServicePack:true and serverType:"SASVIYA
  • Executes deployScripts:
    • SAS Programs remotely
    • Everything else, locally
  • Compile, build & deploy in one step: sasjs cbd
h:5em

Execution

Command Description
job Manage & Execute SAS Jobs
flow SAS job scheduler that takes a JSON file as input, and submit all the jobs sequentially, logging the results to an output CSV file
request Execute SASjs web services from the commandline
test Execute SAS unit tests and collect results in json/csv formats together with logs
h:5em

sasjs test

  • filename.test[.integer].sas
  • Coverage shown on sasjs compile
  • Execute all with sasjs test
  • Execute some with sasjs test someFilterString
  • Assertion macros in @sasjs/core
  • Click URL to re-run a single test
  • Supported output formats: CSV, JSON, XML
h:5em

sasjs lint

  • Catch common coding issues
  • Add as git pre-commit hook
  • Use in VS Code extension
h:3em

Sample DevOps Workflow

  • git clone / git checkout -b branchname
  • make changes
  • sasjs cbd -t myPersonalTarget
  • sasjs test
  • git add / git commit - sasjs lint runs automatically
  • git push - backend pipeline builds & runs tests
  • PR is reviewed & merged. Backend pipeline deploys and generates docs.
    • sasjs cbd -t sharedTarget && sasjs doc
h:6em

Other commands

Command Description
context List, export, create, edit, and delete SAS Compute contexts
folder Management of logical SAS folders
servicepack The SASjs Service Pack is a collection of services and folder objects. The servicepack command lets you deploy them easily
h:6em

Coming Soon

  • CLI support for remote commands on SAS 9
    • sasjs run / deploy / job execute / request / test
  • Desktop (Base) SAS support for web apps
h:6em

Products & Services

  • Data Controller for SAS
  • SAS 9 Health
  • Zabbix Performance Monitoring
  • SAS 9 API
  • Bespoke App Development
  • SASjs Framework Support & Extensions
h:6em

Allan Bowe, Head of SAS Apps