-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 526e71a
Showing
5 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Codespaces in Codespaces | ||
|
||
[<img title="Run in Codespace in one click" src="https://cdn.jsdelivr.net/gh/bookish-potato/codespaces-in-codespaces@f097ccddfc401ab6b09d233dc47c3efa3f9513f6/images/badge.svg">](https://github.com/features/codespaces) | ||
|
||
Bootstrap script to run Codespaces Workbench in a GitHub Codespace. | ||
|
||
### Use | ||
|
||
Please follow instructions on the [vscs wiki page](https://github.com/microsoft/vssaas-planning/wiki/Codespaces-Workbench-in-a-GitHub-Codespace). Don't have access? Join the [vscode-vssaas team](https://repos.opensource.microsoft.com/microsoft/teams/vscode-vssaas) on [opensource.microsoft.com](https://repos.opensource.microsoft.com/microsoft/teams/vscode-vssaas). | ||
|
||
### Issues/Feedback | ||
|
||
- Feedback appreciated, create issues on [vscs planning](https://github.com/microsoft/vssaas-planning) repo if anything 🤗 | ||
- Ping [@legomushroom](https://github.com/legomushroom) if cannot get desired support in the GitHub issues (`olsolomk` if inside Microsoft) 🏓 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- add the `--pristine` option that will reset to the GitHub main branch | ||
- VSCode UI shows too many git updates/changes | ||
- improve docs on local DNS setup | ||
- explore if we can have DNS/proxy inside the codespace | ||
- don't use PAT in remote name | ||
- connect to GH Codespace from VSC Desktop docs: https://docs.github.com/en/github/developing-online-with-codespaces/connecting-to-your-codespace-from-visual-studio-code |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
#!/bin/bash | ||
|
||
clear | ||
|
||
source ~/.bashrc | ||
|
||
if [ -f ~/.cs-envirnment ]; then | ||
source ~/.cs-envirnment | ||
fi | ||
|
||
GREETINGS=("Bonjour" "Hello" "Salam" "Привет" "Вітаю" "Hola" "Zdravo" "Ciao" "Salut" "Hallo" "Nǐ hǎo" "Xin chào" "Yeoboseyo" "Aloha" "Namaskaram" "Wannakam" "Dzień dobry") | ||
GREETING=${GREETINGS[$RANDOM % ${#GREETINGS[@]} ]} | ||
|
||
echo -e $PALETTE_WHITE"\n | ||
~+ | ||
* + | ||
' | | ||
+ .-.,=\"\`\`\"=. - o - | ||
'=/_ \ | | ||
* | '=._ | | ||
\ \`=./\`, ' | ||
. '=.__.=' \`=' * | ||
+ + | ||
O * ' . | ||
"$PALETTE_RESET | ||
|
||
echo -e $PALETTE_GREEN"\n\n 🖖 👽 $GREETING, Codespacer 👽 🖖\n"$PALETTE_RESET | ||
|
||
sleep 1s | ||
|
||
echo -e $PALETTE_PURPLE"\n🏃 Lets setup the Codespace"$PALETTE_RESET | ||
|
||
sleep 0.25s | ||
|
||
unset AZ_DO_USERNAME_SUFFIX; | ||
if [ -z "$AZ_DO_USERNAME" ]; then | ||
AZ_DO_USERNAME_SUFFIX="" | ||
else | ||
AZ_DO_USERNAME_SUFFIX=$PALETTE_CYAN"(➥ to reuse *$AZ_DO_USERNAME*)"$PALETTE_RESET | ||
fi | ||
|
||
echo -e $PALETTE_CYAN"\n- Please provide your AzDO username\n"$PALETTE_RESET | ||
|
||
printf " ↳ AzDO Username$AZ_DO_USERNAME_SUFFIX: $PALETTE_PURPLE" | ||
|
||
read AZ_DO_USERNAME_INPUT | ||
|
||
echo -e " $PALETTE_RESET" | ||
|
||
if [ -z "$AZ_DO_USERNAME_INPUT" ]; then | ||
if [ -z "$AZ_DO_USERNAME" ]; then | ||
echo -e $PALETTE_RED" 🗿 No name - no fame"$PALETTE_RESET | ||
exit 1 | ||
else | ||
AZ_DO_USERNAME_INPUT=$AZ_DO_USERNAME | ||
echo -e $PALETTE_DIM" * reusing *$AZ_DO_USERNAME_INPUT* as AzDO username.\n"$PALETTE_RESET | ||
fi | ||
fi | ||
|
||
IFS=@ read -r username domain <<< "$AZ_DO_USERNAME_INPUT" | ||
if [ ! -z "$domain" ]; then | ||
AZ_DO_USERNAME_INPUT="$username" | ||
echo -e $PALETTE_DIM" * using *$AZ_DO_USERNAME_INPUT* as AzDO username.\n"$PALETTE_RESET | ||
fi | ||
|
||
if [ "$AZ_DO_USERNAME" != "$AZ_DO_USERNAME_INPUT" ]; then | ||
export AZ_DO_USERNAME=$AZ_DO_USERNAME_INPUT | ||
|
||
echo "export AZ_DO_USERNAME=$AZ_DO_USERNAME" >> ~/.bashrc | ||
fi | ||
|
||
echo -e $PALETTE_CYAN"- Thanks, *$AZ_DO_USERNAME*! Please provide your AzDO PAT\n"$PALETTE_RESET | ||
|
||
unset AZ_DO_PASSWORD_SUFFIX; | ||
if [ -z "$AZ_DO_PAT" ]; then | ||
AZ_DO_PASSWORD_SUFFIX="" | ||
else | ||
AZ_DO_PASSWORD_SUFFIX=$PALETTE_CYAN"(➥ to reuse old PAT)"$PALETTE_RESET | ||
fi | ||
|
||
# reading the PAT | ||
unset CHARCOUNT | ||
unset AZ_DO_PAT_INPUT | ||
PROMPT=" ↳ PAT code[R/W] + packaging[R]$AZ_DO_PASSWORD_SUFFIX: $PALETTE_PURPLE" | ||
|
||
stty -echo | ||
|
||
CHARCOUNT=0 | ||
while IFS= read -p "$PROMPT" -r -s -n 1 CHAR | ||
do | ||
# Enter - accept password | ||
if [[ $CHAR == $'\0' ]] ; then | ||
break | ||
fi | ||
|
||
# Backspace | ||
if [[ $CHAR == $'\177' ]] ; then | ||
if [ $CHARCOUNT -gt 0 ] ; then | ||
CHARCOUNT=$((CHARCOUNT-1)) | ||
PROMPT=$'\b \b' | ||
AZ_DO_PAT_INPUT="${PASSWORD%?}" | ||
else | ||
PROMPT='' | ||
fi | ||
else | ||
CHARCOUNT=$((CHARCOUNT+1)) | ||
PROMPT='*' | ||
AZ_DO_PAT_INPUT+="$CHAR" | ||
fi | ||
done | ||
|
||
stty echo | ||
echo -e " "$PALETTE_RESET | ||
|
||
# check if PAT set | ||
if [ -z ${AZ_DO_PAT_INPUT} ]; then | ||
if [ -z "$AZ_DO_PAT" ]; then | ||
echo -e $PALETTE_RED"\n 🐢 No PAT - Zero FLOPS per watt\n"$PALETTE_RESET | ||
exit 1 | ||
else | ||
AZ_DO_PAT_INPUT=$AZ_DO_PAT | ||
echo -e $PALETTE_DIM"\n * reusing the old PAT."$PALETTE_RESET | ||
fi | ||
fi | ||
|
||
git remote remove azdo | ||
git remote add azdo https://$AZ_DO_USERNAME:$AZ_DO_PAT_INPUT@devdiv.visualstudio.com/OnlineServices/_git/vsclk-core | ||
|
||
echo -e $PALETTE_LIGHT_YELLOW"\n ⌬ Fetching the repo\n"$PALETTE_RESET | ||
|
||
git reset --hard | ||
git checkout main | ||
|
||
git branch --track github-main | ||
|
||
# clone the AzDO repo | ||
git pull azdo master:main --force --no-tags | ||
|
||
if [ "$AZ_DO_PAT" != "$AZ_DO_PAT_INPUT" ]; then | ||
export AZ_DO_PAT=$AZ_DO_PAT_INPUT | ||
AZ_DO_PAT_BASE64=$(echo -n $AZ_DO_PAT | base64) | ||
# replace env variable reference in the .npmrc | ||
sed -i -E "s/_password=.+$/_password=$AZ_DO_PAT_BASE64/g" ~/.npmrc | ||
# write the token to the env file | ||
echo -e "export AZ_DO_PAT=$AZ_DO_PAT" >> ~/.cs-envirnment | ||
fi | ||
|
||
if [ ! -d $CSCLIENT ]; then | ||
echo -e $PALETTE_RED"\n ❗ Could not clone the \`vsclk-core\` repo, are the credentials correct?\n"$PALETTE_RESET | ||
exit 1 | ||
fi | ||
|
||
# setup NuGet feeds | ||
FEED_NAME="vssaas-sdk" | ||
dotnet nuget remove source $FEED_NAME | ||
dotnet nuget add source "https://devdiv.pkgs.visualstudio.com/_packaging/vssaas-sdk/nuget/v3/index.json" -n $FEED_NAME -u "devdiv" -p "$AZ_DO_PAT" --store-password-in-clear-text | ||
|
||
FEED_NAME="Cascade" | ||
dotnet nuget remove source $FEED_NAME | ||
dotnet nuget add source "https://devdiv.pkgs.visualstudio.com/_packaging/Cascade/nuget/v3/index.json" -n $FEED_NAME -u "devdiv" -p "$AZ_DO_PAT" --store-password-in-clear-text | ||
|
||
# go to `Website` | ||
cd $CSCLIENT | ||
# initialize the codespace | ||
yarn setup:codespace | ||
# go to `Website` | ||
cd $CSCLIENT | ||
|
||
exec bash |