SAS Communities Library

We’re smarter together. Learn from this collection of community knowledge and add your expertise.
BookmarkSubscribeRSS Feed

How to Publish SAS Decisions to Git: Publishing Destination

Started ‎02-02-2022 by
Modified ‎01-24-2023 by
Views 6,646

The post will demonstrate how to define a Git publishing destination in SAS Viya.

 

The first post in the series, How to Integrate SAS Intelligent Decisioning with Git gave an overview of the process. The next post, How to Publish SAS Decisions to Git: Required Configuration, detailed the SAS Viya configuration and the elements required from Git. This post will help you create the publishing destination.

 

Create the Git Publishing Destination

 

See also the Configure a Git Destination SAS GitHub page for examples provided by SAS. The sas-viya models destination createGit SAS Viya CLI creates the destination and takes care of the credentials.

Variables

To create Git as a Publishing destination in SAS Viya, you will need these components:

  1. SAS Viya URL.
  2. SAS user and password.
  3. Publishing destination name and description.
  4. Credential domain name and description.
  5. Git Repository URL.
  6. Git Repository branch.
  7. GitHub user.
  8. Private Access Token (PAT), specific to GitHub.
  9. GitHub account user email.
  10. Local SAS Viya repository location.
  11. Code method: CAS or MAS.

For example:

# login with the sas-viya cli profile already created
cd ~
export SAS_CLI_PROFILE=${namespace}
export SSL_CERT_FILE=~/.certs/${namespace}_trustedcerts.pem
sas-viya auth login --user sasuser --password *******

# Use the CLI
sas-viya --profile ${SAS_CLI_PROFILE} models destination createGit --help

# override variables from the previous destination
DEST_NAME=GitHubCLI
DEST_DESC=GitHubCLI
DOMAIN_NAME=GitHubDomainCLIGamma
DOMAIN_DESC=GitHubDomainCLIGamma
INGRESS_FQDN='myviyadsn.server.com'

# list variables which will be used
printf "\n We need the following variables for the CLI \n "
echo "SAS Viya URL: https://$INGRESS_FQDN"
echo "SAS User Name: ${SASUSER}"
echo "SAS Domain Name: ${DOMAIN_NAME}"
echo "SAS Domain Description: $DOMAIN_DESC"
echo "Git User Name:  $GITHUB_USER"
echo "SAS Publishing Destination Name: $DEST_NAME"
echo "SAS Publishing Destination Description: $DEST_DESC"
echo "Git User Email: $GITHUB_EMAIL"
echo "Git Repository URL: $GITHUB_REPO_URL"
echo "Git Repository Branch:  $GITHUB_BRANCH"
echo "Code Generation Mode MAS or CAS: $CODE_GEN"
#echo "Git Personal Access Token: $GITHUB_PAT"
echo "Git Personal Access Token: well... it's secret..."

Create the Destination with the CLI

The main steps in the process are:

 

  1. Authorize the SAS Viya CLI by logging in (the operation get an authorisation token).
  2. Create the publishing destination:
# create the pub destination - one line and descriptions quoted

sas-viya --profile ${SAS_CLI_PROFILE} models destination createGit --name ${DEST_NAME} --description "${DEST_DESC}" --remoteRepoURL ${GITHUB_REPO_URL}  --userEmail ${GITHUB_EMAIL} --gitUserId ${GITHUB_USER} --gitBranch ${GITHUB_BRANCH} --gitAccessToken ${GITHUB_PAT} --codeGenerationMode ${CODE_GEN} --userName ${GITHUB_USER} --identityType user --identityId ${SASUSER} --credDomainID ${DOMAIN_NAME} --credDescription "${DOMAIN_DESC}" --localRepoLocation " /mmprojectpublic"

# list the destinations
sas-viya --profile ${SAS_CLI_PROFILE} models destination list

# clear the environment variables used - especially the PAT
unset GITHUB_USER && unset GITHUB_PAT && unset GITHUB_REPO_URL && unset GITHUB_EMAIL && unset GITHUB_BRANCH && unset CODE_GEN

 

Conclusions

 

The post guided you how to define a Git publishing destination in SAS Viya.

 

Findings: I chose the code method MAS for two rule sets. If you chose MAS, it seems the rule sets or decision can be deployed to CAS as well.

 

Related Resource

See the Configure a Git Destination SAS GitHub page for examples provided by SAS.

 

Thank you for your time reading this post.

 

Read the next post in the series, How to Publish SAS Decisions to Git: Publishing Result. The post details how a decision is published and what files are created in the GitHub repository.

 

If you liked the post, give it a thumbs up! Please comment and tell us what you think about post content. If you wish to get more information, please write me an email.

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎01-24-2023 03:32 AM
Updated by:
Contributors

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started