Dear Community!
I am looking for a way to %include code from a github repository (several autocall macros). I can do so with a public repository, but what about a private repository?
We have had several discussions here on accessing git repositories directly and reading data from it (both data and code or just macro code). But all these approaches require a public repository to have the links to the data/code code working (equivalent to the raw file button in github). In this posting @ChrisHemedinger has sketched out what I actually want to achive (first code fragment) ... and what I would like to avoid (second code fragment using the gitfn_*).
The problem is ... that the link to the raw file in a private repository gets an oauth token appended, but that changes over time. And private access tokens cannot be used in the same fashion (at least by the looks of it). Instead the wise internet suggest the use of a header ("Authentication: token TOKEN") for a similar access problem using curl. In curl there is a nice option to do this ... but how to do this in SAS?
Just another piece of information: I am limited to the use of GitHub Enterprise and non public repositories. It could very well be that I am barking up the wrong tree ... maybe ssl authentication is the way to go. So, to cut it short:
Does anybody have any experience with accessing non public github repositories under SAS and using %include to source in autocall macros? (and is willing to share his expertise of course 😃)
Regards
fja
What version of SAS (Studio/EG/Viya)?
Are you looking at connecting to your repository overall or rather just at startup?
Hello Reya!
Thank you very much for your reply.
SAS 9.4 EG 8.2, but using %include should be independant of the EG version.
It is just a punctual connect i am looking at just for establishing a connection via filename ... to a single file in a repository or a directory.
The first shall be used for sourcing in a single file ... the latter would be used to set up the autosas option.
Cheers
Fja
@Reeza wrote:
Yes, but git functions are smart enough to only update files as needed.
Good point. So presumably you could wrap Chris's code from the other thread in an autocall macro. So user could run %gitinclude(repo=,file=) and it would use SAS git functions to update the local repo, then %include the specified .sas file. I suppose if you wanted to, the local repo could even be put in the WORK dir.
NOTE: libgit2.so not found in the system location, trying the extension path.
NOTE: libgit2.so not found in the system location, trying the install path.
ERROR: libgit2.so not found.
ERROR: Unable to load libgit2 module.
Lovely! So I need to check with the admins first ... It might not be a wandering star I was born under ... but it is not a good one by the looks of it. 🙂
Current version: 9.04.01M7P080520
i.e. yes. 😀
Ok, admins say they need a concept for using git and "if and how" git could be integrated with SAS. I read that as "go away". 😃
Question: Does anybody know, if SAS brings its own git (i.e. the shared objects) or does it rely on the OS to provide these? I was under the impression that the first case held true.
@fja wrote:
Ok, admins say they need a concept for using git and "if and how" git could be integrated with SAS. I read that as "go away". 😃
Question: Does anybody know, if SAS brings its own git (i.e. the shared objects) or does it rely on the OS to provide these? I was under the impression that the first case held true.
I *think* you are correct that SAS brings its own git. Pretty sure you can use EG or Studio to connect to git, and also use the git functions in SAS code, without ever installing git on the OS.
But in my limited experience, I think it would be hard to use git without having it also available on the OS so you can use non-SAS git interfaces/clients. We store our SAS code on a linux server, and have central git repos on a Windows server somewhere. I tried playing with git, but the admins weren't interested in investing time to get the authentication working between our linux SAS box and the windows box with the git repo. I don't think I could have done it from within SAS even if I had tried. I have played with some ugly workarounds running git locally on windows, so I can connect to the central git repos from windows, and accessing the linux files via samba....
@Quentin wrote:
[...]but the admins weren't interested in investing time to get the authentication working between our linux SAS box and the windows box with the git repo. [...]
Oh this sounds ever so familiar! 😐
Thank's for the reply!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.