How to Publish SAS Decisions to Git: Publishing Destination
- Article History
- RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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:
- SAS Viya URL.
- SAS user and password.
- Publishing destination name and description.
- Credential domain name and description.
- Git Repository URL.
- Git Repository branch.
- GitHub user.
- Private Access Token (PAT), specific to GitHub.
- GitHub account user email.
- Local SAS Viya repository location.
- 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:
- Authorize the SAS Viya CLI by logging in (the operation get an authorisation token).
- 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.