BookmarkSubscribeRSS Feed

How to Publish SAS Decisions to Git: Required Configuration

Started ‎01-27-2022 by
Modified ‎03-09-2022 by
Views 4,534

Read this post to find out what items you need to configure in SAS Viya and in GitHub, before you can create a Git publishing destination in SAS Viya.

 

The previous post, How to Integrate SAS Intelligent Decisioning with Git, highlighted the process and the high-level steps. This post will discuss the needed configuration.

 

Configure SAS Viya

 

The SAS Viya "sas-model-publish-pod" is responsible for publishing to Git. The pod is a group of one or more containers with shared storage and resources.

 

This pod requires a Persistent Volume Claim called "Git". The Persistent Volume Claim (PVC) is a request for storage, that a pod can consume.

 

The video will guide you through the required configuration:

 

 

SAS® Viya® Administration documentation talks more about this configuration.

 

In the video above, SAS Viya was deployed on Azure. If you need to replicate the configuration in another environment, you will require:

  • Two yaml files: storage.yaml and kustomization.yaml These are, by default, located in $deploy/sas-bases/examples/sas-model-publish/git directory, where you downloaded your deployment files.
  • A script to change the storage.yaml and make changes to the base kustomization.yaml file.
  • #!/bin/bash
    
    echo "INIT variables"
    MYFOLDER=This-is-your-main-deployment-folder
    ROOTDIR=$HOME/$MYFOLDER PROJECT=gelazure echo "Start Git patch BT " #************************************************************* #* Configure Git Mount on Azure for SAS Viya 2021.1.1 and later * #************************************************************* # These steps apply BEFORE a NEW SAS Viya deployment echo "Check Kubernetes contexts" PRJ=${ROOTDIR}/scripts/projects/${PROJECT} echo $PRJ printf "\e[1;33m\nYOUR CURRENT KUBERNETES VIYA DEPLOYMENT NAMESPACE IS: \e[1;31m${PROJECT}\n\n\e[0m" # Follow the instructions in the new README file located at $deploy/sas-bases/examples/sas-model-publish/git/README.md # 1. Using the files in the `$PRJ/sas-config/sas-model-publish/git` directory cd ~ echo "create git folder in $PRJ/site-config/sas-model-publish/" mkdir -p $PRJ/site-config/sas-model-publish/git echo "git folder permissions" chmod -R 755 $PRJ/site-config/sas-model-publish/git echo "List folders in $PRJ/site-config/sas-model-publish/git directory" ls -lrt $PRJ/site-config/sas-model-publish/git # 2. Modify the parameters in storage-git.yaml. For more information about PersistentVolume Claims (PVCs), see [Persistent Volume Claims on Kubernetes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims). # * Replace {{ STORAGE-CAPACITY }} with the amount of storage required. # * Replace {{ STORAGE-CLASS-NAME }} with the appropriate storage class from the cloud provider that supports ReadWriteMany access mode. # Azure storage: 1Gi should be enough # storageClassName: sas-azurefile ## You can find out the Azure storage class by checking other PVCs e.g. kubectl get pvc -n ${current_namespace} -o wide | { head -1; grep "cas"; } echo "Update storage.yaml" cd ~ cd $PRJ/site-config/sas-model-publish/git/ echo "Update the Azure storage capacity '{{ STORAGE-CAPACITY }}'" sed -i 's/{{ STORAGE-CAPACITY }}/1Gi/' ./storage.yaml echo "Update the storage class name" sed -i 's/{{ STORAGE-CLASS-NAME }}/sas-aks/' ./storage.yaml echo "List changes in storage.yaml" cat storage.yaml cd ~ # 3. Make the following changes to the base kustomization.yaml file in the $deploy directory. echo "Remove readme.md file" cd ~ cd $PRJ/site-config/sas-model-publish/git/ rm -Rf *.md echo "Backup kustomization.yaml first" cd ~ cd $PRJ cp kustomization_template.yaml kustomization_template_before_git.yaml # * Add sas-bases/overlays/sas-model-publish/git/git-transformer.yaml to the transformers block. # ```yaml # transformers: # - sas-bases/overlays/sas-model-publish/git/git-transformer.yaml # ``` echo "Add Git to resources" cd ~ printf " - command: update path: resources[+] value: site-config/sas-model-publish/git # 2021.1.1 Git mount patch " | yq -I 4 w -i -s - $PRJ/kustomization_template.yaml # * Add sas-bases/overlays/sas-model-publish/git/git-transformer.yaml to the transformers block. # ```yaml # transformers: # - sas-bases/overlays/sas-model-publish/git/git-transformer.yaml # ``` echo "Add Git to transformers" cd ~ printf " - command: update path: transformers[+] value: sas-bases/overlays/sas-model-publish/git/git-transformer.yaml # 2021.1.1 Patch for git transformer " | yq -I 4 w -i -s - $PRJ/kustomization_template.yaml cd ~ echo "Git patch BT end" #### end Git patch BT ####

 

Configure the Git Repository

 

To publish from SAS Viya to Git, you will need a Git repository. You could use GitLab, GitHub or any other Git flavor. The following example is using a GitHub repository. From your GitHub account, you will need a:

 

  1. Git Repository URL.
  2. Git Repository branch.
  3. GitHub user.
  4. GitHub account user email.
  5. Personal Access Token (PAT), which acts as a password to access a GitHub repository.

Watch the following video to understand how to create a PAT in GitHub:

 

 

 

Tip: From a security perspective, SAS Viya can work with a private GitHub repository. Private repositories are only accessible to you, or to people you explicitly share access with.

 

Conclusions

 

Before you define the Git publishing destination in SAS Viya, you have to configure the storage for one of the pods. If you are using a GitHub repository as your destination, you must obtain a Personal Access Token first.

 

Thank you for your time reading this post. If you liked the post, give it a thumbs up!

 

Read the next post in the series, How to create a Git publishing destination in SAS Viya.

 

 

Resources

 

You could consult the following related resources:

If you wish to get more information, or share your experience on this particular topic, please leave a comment.

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎03-09-2022 10:27 PM
Updated by:
Contributors

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started