Skip to contentSkip to conversation

fetch2: add GitHub Codespaces support

PATCH Superseded Oliver Kästner 2 participants 8 messages Oct 6, 2024 – Oct 12, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: add GitHub Codespaces support

GitHub Codespaces use a Git credential helper that provides access to authorized private GitHub repos. To do this, it requires access to the GITHUB_TOKEN env var, so add it to FETCH_EXPORT_VARS.

---
 lib/bb/fetch2/__init__.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch2/__init__.py +1 -0
index 33a8086f2..06687b018 100644
@@ -878,6 +878,7 @@ FETCH_EXPORT_VARS = ['HOME', 'PATH',
                      'AWS_SESSION_TOKEN',
                      'GIT_CACHE_PATH',
                      'REMOTE_CONTAINERS_IPC',
+                     'GITHUB_TOKEN',
                      'SSL_CERT_DIR']
 
 def get_fetcher_environment(d):
Signature · 1 line
2.43.0
#1 lore raw
Quoted 4 lines · Oliver Kästner via lists.openembedded.org

GitHub Codespaces use a Git credential helper that provides access to authorized private GitHub repos. To do this, it requires access to the GITHUB_TOKEN env var, so add it to FETCH_EXPORT_VARS.

Which fetcher would be using this environment variable? Presumably it would be picked up by some external executable run by one of the fetchers, which one is that?

Alex

#2 lore raw
Quoted 8 lines · Alexander Kanavin
Quoted 3 lines · Oliver Kästner via lists.openembedded.org

GitHub Codespaces use a Git credential helper that provides access to authorized private GitHub repos. To do this, it requires access to the GITHUB_TOKEN env var, so add it to FETCH_EXPORT_VARS.

Quoted 5 lines

Which fetcher would be using this environment variable? Presumably it would be picked up by some external executable run by one of the fetchers, which one is that?

Alex

You're right, it's the git fetcher calling the host system's git executable, which uses the configured credential.helper=/.codespaces/bin/gitcredential_github.sh. This script only contains:

#!/bin/sh
echo protocol=https
echo host=github.com
echo path=
echo username=PersonalAccessToken
echo password=$GITHUB_TOKEN

That's why we need to retain the GITHUB_TOKEN env var.

Oliver

#3 lore raw
Quoted 12 lines · Oliver Kästner via lists.openembedded.org

GitHub Codespaces use a Git credential helper that provides access to authorized private GitHub repos. To do this, it requires access to the GITHUB_TOKEN env var, so add it to FETCH_EXPORT_VARS.

Which fetcher would be using this environment variable? Presumably it would be picked up by some external executable run by one of the fetchers, which one is that?

Alex

You're right, it's the git fetcher calling the host system's git executable, which uses the configured credential.helper=/.codespaces/bin/gitcredential_github.sh. This script only contains:

Quoted 8 lines

#!/bin/sh
echo protocol=https
echo host=github.com
echo path=
echo username=PersonalAccessToken
echo password=$GITHUB_TOKEN

That's why we need to retain the GITHUB_TOKEN env var.

Thanks, where is this gitcredential_github.sh coming from though? Is it an official script maintained by github? Where? I don't see it in I don't see it in https://git-scm.com/doc/credential-helpers

If you can find the link, and place it into the commit message and/or comment in the code, then we'd be able to track down actual usage of the variable in the future when needed.

Alex

#4 lore raw
Quoted 26 lines · Alexander Kanavin
Quoted 12 lines · Oliver Kästner via lists.openembedded.org

GitHub Codespaces use a Git credential helper that provides access to authorized private GitHub repos. To do this, it requires access to the GITHUB_TOKEN env var, so add it to FETCH_EXPORT_VARS.

Which fetcher would be using this environment variable? Presumably it would be picked up by some external executable run by one of the fetchers, which one is that?

Alex

You're right, it's the git fetcher calling the host system's git executable, which uses the configured credential.helper=/.codespaces/bin/gitcredential_github.sh. This script only contains:

Quoted 8 lines

#!/bin/sh
echo protocol=https
echo host=github.com
echo path=
echo username=PersonalAccessToken
echo password=$GITHUB_TOKEN

That's why we need to retain the GITHUB_TOKEN env var.

Thanks, where is this gitcredential_github.sh coming from though? Is it an official script maintained by github? Where? I don't see it in I don't see it in https://git-scm.com/doc/credential-helpers

Quoted 5 lines

If you can find the link, and place it into the commit message and/or comment in the code, then we'd be able to track down actual usage of the variable in the future when needed.

Alex

I couldn't find a source for this script. I assume it is injected into the Codespaces container at creation time. However, the script is mentioned in the GitHub docs: https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-gpg-verification-for-github-codespaces#checking-for-conflicting-configuration

Please let me know if you think that this reference should be part of the commit.

Oliver

#5 lore raw
Quoted 3 lines · Oliver Kästner via lists.openembedded.org

I couldn't find a source for this script. I assume it is injected into the Codespaces container at creation time. However, the script is mentioned in the GitHub docs: https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-gpg-verification-for-github-codespaces#checking-for-conflicting-configuration

Please let me know if you think that this reference should be part of the commit.

How is this environment set up in the first place? Is it on your local machine, or is it something that github magically creates and lets you access remotely?

Alex

#6 lore raw
Quoted 16 lines · Alexander Kanavin
Quoted 3 lines · Oliver Kästner via lists.openembedded.org

I couldn't find a source for this script. I assume it is injected into the Codespaces container at creation time. However, the script is mentioned in the GitHub docs: https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-gpg-verification-for-github-codespaces#checking-for-conflicting-configuration

Please let me know if you think that this reference should be part of the commit.

How is this environment set up in the first place? Is it on your local machine, or is it something that github magically creates and lets you access remotely?

Alex

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16674): https://lists.openembedded.org/g/bitbake-devel/message/16674
Mute This Topic: https://lists.openembedded.org/mt/108858120/9002280
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Simply put, GitHub Codespaces are Docker containers with a VS Code server that run on GitHub's infrastructure. You can launch a Codespace directly from the GitHub web UI and use VS Code in the browser or connect to it with a VS Code instance running locally. It checks out the selected repo and lets you work inside the container as you like. You can use an own container image (e.g. crops/poky) and thus get a pre-configured development system that you can use from any client system, even Chromebooks.
In the free tier, users have free 120 "CPU hours" each month, and enterprise users on a pay-as-you-go basis.

Oliver

#7 lore raw
Quoted 10 lines · Oliver Kästner

Simply put, GitHub Codespaces are Docker containers with a VS Code server that run on GitHub's infrastructure. You can launch a Codespace directly from the GitHub web UI and use VS Code in the browser or connect to it with a VS Code instance running locally. It checks out the selected repo and lets you work inside the container as you like. You can use an own container image (e.g. crops/poky) and thus get a pre-configured development system that you can use from any client system, even Chromebooks.
In the free tier, users have free 120 "CPU hours" each month, and enterprise users on a pay-as-you-go basis.

Thank you, now I understand what it's for. Please put any relevant links and additional information (e.g. location and content of the script helper) into the commit message and resend.

Alex