Forum Discussion
integration with github is achieved via github rest api GitHub REST API - GitHub Docs
From design perspective this is how it works
Create a snaplogic pipeline that uses Meta Snaps - https://doc.snaplogic.com/wiki/display/SD/SnapLogic+Metadata+Snap+Pack get a list of SnapLogic assets (pipelines, tasks, files and accounts)
Invoke GitHub REST api (uses HTTP basic auth - https://doc.snaplogic.com/wiki/display/SD/Basic+Auth )
Read or Write to GitHub
Pipeline uses pipeline param to decouple runtime param from the actual implementation logic, so when you invoke these pipelines you can specify which Snaplogic projects to read, what assets to cin into GitHub, which repo to use on GitHub side and so on.
We have implemented bi-directional flow i.e. you can cin and cout source code from github
Attached SnapLogic project export has all the required files, please note that this is a custom solution, to use it you’ll need to keep your GitHub creds ready (repo name, uname and pwd), create a basic auth account in snaplogic and pass it on to the pipelines.
You may struggle a bit, but don’t give up, keep pounding and eventually you’ll crack it 🙂
Attached SnapLogic project export, please import it using these steps - https://doc.snaplogic.com/wiki/display/SD/How+to+Import+and+Export+Projects
Now for this
And that this can be further use to move code from one environment to another (code migration).
try this API
API Detail:
Syntax = https://elastic.snaplogic.com:443/api/1/rest/public/project/migrate/ORG/SPACE/PROJECT
Authorization Header = Basic Auth, pass on your Snaplogic uname/pwd
Body = application/json
Example:
https://elastic.snaplogic.com:443/api/1/rest/public/project/migrate/ConnectFasterInc/BK/DEV
{
"dest_path":"/tacobell/projects/bk",
"asset_types":["File","Job","Account","Pipeline"],
"async":"true",
"duplicate_check":"false"
}
Response:
{
“response_map”: {
“status_token”: “6e6600cd-2992-4423-95c3-ffb94293a3bd”,
“status_url”: “http://elastic.snaplogic.com/api/1/rest/public/project/migrate/6e6600cd-2992-4423-95c3-ffb94293a3bd”
},
“http_status_code”: 200
}
This runs as an async call and will migrate (copy) everything from ConnecFasterInc/BK/DEV to/tacobell/projects/bk, you can check status of the migration by visiting status_url
If a project already exists and duplicate_check set to false will create another project with the same name appended by (NUMBER) ex: if bk already exists inside /tacobell/projects then subsequent runs will add bk(1), bk(2) and so on, I wish we had an “overwrite” or “merge” parameter option but neverthless this is much easier than META snaps (IMO).
BK-Github Integration.zip (12.1 KB)
Hello @bhavin.patel I tried to using above attached slps but I keep on getting below error.
"REST API service endpoint returned error result: status code = 404, reason phrase = Not Found, refer to the error_entity field in the error view document for more details
“error_entity”:
"{“message”:“Not Found”,“documentation_url”:"Repositories - GitHub Docs
{
“error”:
“REST API service endpoint returned error result: status code = 404, reason phrase = Not Found”
Steps I followed below :
- created account in Github let say “subhashchandra” is my user
- created a repository under that let say “SL_poc” is my repository
- under SL_POC I made the same folder structure like in SnapLogic org I have
let say folder structure like this
SnapLogicOrgName/Projectspacename/Foldername - created the REST basic auth account in SnapLogic with github credential
- in SnapLogic REST GET snap selected the account and in url like below
- user-Agent as header and provided my github username.
Even from POST MAN app I also tried but no luck…
Appreciate your help here.
and tell me one more thing how differfent is if I want to do in gitlab instead github.
if you have any sample code for gitlab that will be very helpful for me.
- dmiller5 years agoFormer Employee
@subhash.a.chandra Bhavin is no longer in the Community. Hopefully someone else can assist you.
- subhash_a_chand5 years agoNew Contributor
Hello @dmiller I got the solution by myself and able to integrate Gitlab and Github both from SnapLogic.
Thanks for your info.
- jcampion5 years agoNew Contributor III
See also
Additional links -