question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sugestion: add private repositories support in recipe engine

See original GitHub issue

The following use case: As a server developer, I would like to supply the Github OAuth token to allow for private GitHub repos to be downloaded as part of the recipe.

There is a way to do it today directly via the command line. To also have it be exposed in a recipe.

git pull https://$OAUTH_TOKEN:x-oauth-basic@github.com/name/repo.git master

It could be entered in the UI and stored as a tmp variable that then can be defined in the yaml?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tabarracommented, May 23, 2021

for it to show on the UI, you have to create a var for it, so the var could have the token, or the var could be empty and the user fills it manually

0reactions
varnem2commented, Jun 4, 2022

Digging up this issue, I’m going to share some thoughts here.

Background

As a review for the download_github task in the recipeEngine.js it seems as though it’s making 2 calls to github.com. (It seems this was refreshed from https://github.com/axios/axios over to https://github.com/sindresorhus/got between the time I’ve looked at this las.)

The first call occurs at https://github.com/tabarra/txAdmin/blob/63afc1048806d251669419fb6311ef506dbf672a/src/extras/recipeEngine.js#L113 where we get the default branch name for the repo to later use here https://github.com/tabarra/txAdmin/blob/63afc1048806d251669419fb6311ef506dbf672a/src/extras/recipeEngine.js#L122 .

Both of these calls would need authenticated through Github for the code to continue to work as it does today and expand it to a private repo.

Creating a personal access token in github as the instructions indicated here (We’ll define this token as GITHUB_PAT going forward.) allows a user to make both of these calls against an “internal” repo or a “private” repo. Upon further experimentation you’ll need to add a header to both of the indicated calls above following this object. { “key”: “Authorization”, “value”: Bearer ${GITHUB_PAT} }.

Passing in the header into the call where GITHUB_PAT equals an empty or a null value causes 401s to be returned from github.com regardless of the permission/visibility settings of the repo. The existence of the header does not limit the ability to download ‘public’ repos. The addition of this GITHUB_PAT token may cause tighter rate limiting than without any token at all, however that does still need to be experimented.

What I need help with is design and a few questions.

  • What do you want the scope of this GITHUB_PAT to be? Recipe 1 or Recipe 2? Recipe 1 is an example of a global scope. While Recipe 2 would be an example of the scope being limited to the task?

Recipe 1

$engine: 3
$onesync: on
name: QBCore Framework RedM
version: 0.1.0
author: The QBCore Family
description: An advanced RedM framework including jobs, gangs, housing & more!
github_personal_access_token: ADSFADSADF

tasks:
  # Download Base Files
  - action: download_github
    src: https://github.com/qbcore-redm-framework/txAdminRecipe
    ref: main
    dest: ./tmp/qbrcore

Recipe 2

$engine: 3
$onesync: on
name: QBCore Framework RedM
version: 0.1.0
author: The QBCore Family
description: An advanced RedM framework including jobs, gangs, housing & more!

tasks:
  # Download Base Files
  - action: download_github
    src: https://github.com/qbcore-redm-framework/txAdminRecipe
    ref: main
    dest: ./tmp/qbrcore
    github_personal_access_token: ADSFADSADF
  • Would we want to check the visibility of the repo to decide if we add the GITHUB_PAT token to the call? That would add a 3rd additional call to github.com for each github_download task.

  • Would you want to do an implicit Auth where txAdmin would create a GITHUB_PAT for the user as the user uses the UI?

  • Would you prefer a dark launch of the GITHUB_PAT in multiple PRs or just build out the whole thing?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to use pip to install a package from a private ...
I figured out a way to automagically 'pip install' a GitLab private repository that requires no password prompt. This approach uses GitLab "Deploy...
Read more >
Inviting collaborators to a personal repository - GitHub Docs
In the search field, start typing the name of person you want to invite, then click a name in the list of matches....
Read more >
Repository mirroring - GitLab Documentation
Changes you make to your GitLab repository are copied to the old location. Your GitLab instance is private, but you want to open-source...
Read more >
Repo documentation for recipe_engine - Google Git
Repo documentation for recipe_engine. Table of Contents. Recipe Modules. archive; assertions; buildbucket — API for interacting with the buildbucket service ...
Read more >
GitPi: a Private Git Server on Raspberry Pi - Instructables
1. First, setup a Raspberry Pi for ssh access and that it's on your home wifi network, which means that you can log...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found