-
Notifications
You must be signed in to change notification settings - Fork 1
feat: migrate from GitPod to GitHub Codespaces #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
918d1c3
9f31d77
d416832
ebb0e82
b9ffb0d
aad8386
2075a93
04fbd74
56e49d5
2cf48cd
3f985ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Codespaces Configuration | ||
|
|
||
| This directory contains the GitHub Codespaces dev container configuration. | ||
|
|
||
| ## Port Visibility Issue | ||
|
|
||
| If port 8080 shows as **private** after creating a Codespace, you need to manually change it to **public**: | ||
|
|
||
| ### Manual Steps: | ||
| 1. Open the **PORTS** panel at the bottom of VS Code (next to TERMINAL) | ||
| 2. Find port **8080** in the list | ||
| 3. **Right-click** on port 8080 | ||
| 4. Select **Port Visibility** → **Public** | ||
| 5. Refresh your browser and access Jenkins | ||
|
|
||
| ### Why is this needed? | ||
|
|
||
| The `devcontainer.json` includes `"visibility": "public"` for port 8080, but GitHub Codespaces may not always apply this setting automatically, especially: | ||
| - On the first Codespace creation | ||
| - If there's an organization policy | ||
| - If the port is forwarded before the container is fully started | ||
|
|
||
| The setup script attempts to set the port visibility automatically using the GitHub CLI, but if that fails, manual intervention is required. | ||
|
|
||
| ## Files | ||
|
|
||
| - **devcontainer.json** - Dev container specification | ||
| - **setup.sh** - Initialization script (installs yq, configures URLs, creates welcome message) | ||
| - **welcome.txt** - Generated welcome message (not in git, created at runtime) | ||
| - **README.md** - This file | ||
|
|
||
| ## Accessing Jenkins | ||
|
|
||
| After starting a tutorial with `docker compose --profile <name> up -d`: | ||
| - Jenkins URL: `https://<codespace>-8080.<domain>` (shown in PORTS panel) | ||
| - Default credentials: admin/admin | ||
|
|
||
| **Important:** Open Jenkins in a regular browser tab, not the VS Code preview pane. The preview may show "Please reopen the preview" due to Jenkins security headers. Click the globe icon 🌐 in the PORTS panel or copy the URL to your browser. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **Port 8080 refuses connection:** | ||
| - Ensure port visibility is set to **public** (see steps above) | ||
| - Verify Jenkins is running: `docker compose ps` | ||
| - Check logs: `docker compose logs jenkins_controller` | ||
|
|
||
| **Welcome message not showing:** | ||
| - Run: `source ~/.bashrc` in your terminal | ||
| - Or open a new terminal window | ||
|
|
||
| **yq not found:** | ||
| - Run: `bash .devcontainer/setup.sh` manually |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "name": "Jenkins Quickstart Tutorials", | ||
| "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04", | ||
|
|
||
| "features": { | ||
| "ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
| "version": "latest", | ||
| "dockerDashComposeVersion": "v2" | ||
| }, | ||
| "ghcr.io/devcontainers/features/github-cli:1": { | ||
| "version": "latest" | ||
| } | ||
| }, | ||
|
|
||
| "onCreateCommand": "bash .devcontainer/setup.sh", | ||
| "postStartCommand": "cat .devcontainer/welcome.txt 2>/dev/null || echo 'Run: .devcontainer/setup.sh for tutorial instructions'", | ||
|
|
||
| "forwardPorts": [8080, 3000, 5000], | ||
|
|
||
| "portsAttributes": { | ||
| "8080": { | ||
| "label": "Jenkins Controller", | ||
| "onAutoForward": "openBrowser", | ||
| "protocol": "http", | ||
| "visibility": "public" | ||
| }, | ||
| "3000": { | ||
| "label": "Application Port (Node/Android/Go)", | ||
| "onAutoForward": "notify", | ||
| "protocol": "http" | ||
| }, | ||
| "5000": { | ||
| "label": "Application Port (Multi/.NET)", | ||
| "onAutoForward": "notify", | ||
| "protocol": "http" | ||
| } | ||
| }, | ||
|
|
||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-azuretools.vscode-docker", | ||
| "redhat.vscode-yaml" | ||
| ], | ||
| "settings": { | ||
| "terminal.integrated.defaultProfile.linux": "bash" | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "remoteUser": "vscode", | ||
|
|
||
| "updateContentCommand": "echo 'Container updated successfully'" | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,100 @@ | ||||||||||
| #!/bin/bash | ||||||||||
| # GitHub Codespaces setup script for Jenkins Quickstart Tutorials | ||||||||||
| # This script configures the Codespace environment and prepares Jenkins URL configuration | ||||||||||
|
|
||||||||||
| set -e # Exit on error | ||||||||||
|
|
||||||||||
| echo "================================" | ||||||||||
| echo "Setting up Jenkins Tutorials Environment" | ||||||||||
| echo "================================" | ||||||||||
|
|
||||||||||
| # Install yq (YAML processor) - required for JCasc configuration | ||||||||||
| echo "📦 Installing yq YAML processor..." | ||||||||||
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | ||||||||||
|
||||||||||
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.44.2/yq_linux_amd64 |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding the workspace path, it's more robust to use the $GITHUB_WORKSPACE environment variable, which is provided by GitHub Codespaces. This makes the script more portable. Using single quotes for the echo commands will ensure the variable is written to .bashrc literally and expanded upon sourcing the file.
| echo "if [ -f /workspaces/quickstart-tutorials/.devcontainer/welcome.txt ]; then" >> ~/.bashrc | |
| echo " cat /workspaces/quickstart-tutorials/.devcontainer/welcome.txt" >> ~/.bashrc | |
| echo 'if [ -f "$GITHUB_WORKSPACE/.devcontainer/welcome.txt" ]; then' >> ~/.bashrc | |
| echo ' cat "$GITHUB_WORKSPACE/.devcontainer/welcome.txt"' >> ~/.bashrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better reproducibility and to avoid unexpected breaking changes from automatic updates, it's a best practice to pin the versions of dev container features instead of using
latest. You can find the latest stable versions on the respective feature's GitHub page.