Skip to content

Conversation

@gounthar
Copy link
Collaborator

Summary

Migrates the primary cloud development environment from GitPod to GitHub Codespaces as GitPod's free tier has sunset (now 10h/month vs Codespaces' 60h/month).

Changes

Core Migration

  • Add comprehensive .devcontainer/ configuration with Docker-in-Docker and GitHub CLI
  • Automated setup script with environment detection and URL configuration
  • Dynamic Jenkins URL configuration for Codespaces port forwarding
  • Welcome message with tutorial profiles and commands

Code Quality Improvements

  • Pin all dependency versions (yq v4.44.3, Docker 27.0, GitHub CLI 2.62)
  • Enhanced shell safety with set -Eeuo pipefail
  • Dynamic path resolution using git rev-parse
  • Proper variable quoting and error handling throughout
  • Replace echo with printf for ANSI escape sequences (portability)

Automated Dependency Tracking

  • Add UpdateCLI manifest to automatically track and update:
    • yq releases
    • Docker versions
    • GitHub CLI versions
  • UpdateCLI creates PRs when new versions are available

Documentation

  • Updated README with Codespaces quick start
  • Mark GitPod as legacy platform
  • Troubleshooting guide for common issues
  • Disabled Dependabot for GitPod updates

Backward Compatibility

  • Maintains GitPod configuration during transition
  • Set default empty values for GITPOD_WORKSPACE_URL to suppress warnings

Testing

  • ✅ Tested in live Codespaces environment
  • ✅ All CI checks passing (Hadolint, Docker builds, UpdateCLI)
  • ✅ UpdateCLI manifest validated locally
  • ✅ Port forwarding and Jenkins access confirmed working

Benefits

  • Better free tier: 60h/month (6x more than GitPod)
  • More accessible: Integrated into GitHub UI
  • Automated updates: UpdateCLI tracks dependency versions
  • Better shell safety: Modern bash best practices
  • Reproducible: All versions pinned

Migration Status

  • Primary environment: ✅ Codespaces
  • Legacy environment: GitPod (still functional, monitoring disabled)
  • Dual support maintained during transition period

Add comprehensive GitHub Codespaces configuration to replace GitPod
as the primary cloud development environment (GitPod free tier has sunset).

Changes:
- Add .devcontainer/devcontainer.json with Docker-in-Docker and GitHub CLI
- Add .devcontainer/setup.sh for automated environment setup
- Add dockerfiles/codespacesURL.sh for Codespaces URL configuration
- Add CODESPACES_MIGRATION_PLAN.md with detailed migration strategy
- Update README.md with Codespaces quick start and instructions
- Update .gitignore for local development files
- Set default empty values for GITPOD_WORKSPACE_URL to suppress warnings

Features:
- Automatic yq installation for YAML processing
- Port forwarding for Jenkins (8080) with public visibility
- Environment-aware URL configuration using CODESPACE_NAME
- Maintains backward compatibility with GitPod configuration
- 60 hours/month free tier (sufficient for all tutorials)
- Welcome message displayed on every terminal session

The migration maintains dual support for both Codespaces and GitPod
during the transition period, allowing users to choose their preferred
environment.
Configure setup script to append welcome message to .bashrc so it
displays automatically on every new terminal session in Codespaces.

This is more reliable than postStartCommand which doesn't always
show output in the terminal.
Add gh CLI command to automatically set port 8080 to public during setup.
Create .devcontainer/README.md with manual steps for port visibility.

The devcontainer.json visibility setting doesn't reliably work, so we now:
1. Attempt automatic setting via gh CLI in setup.sh
2. Provide clear manual steps in README if automation fails

This addresses the persistent issue where ports default to private
even with visibility: public in devcontainer.json.
Change onAutoForward from 'openPreview' to 'openBrowser' to avoid
preview pane issues with Jenkins security headers.

The VS Code preview shows 'Please reopen the preview' due to Jenkins
X-Frame-Options headers. Opening in a regular browser tab works fine.

Updated README to clarify this behavior.
Add note that GitPod is legacy (free tier sunset) and we've migrated
to GitHub Codespaces. Disable Dependabot monitoring of GitPod image
updates by setting open-pull-requests-limit to 0.

Codespaces uses devcontainer.json which cannot be monitored by
Dependabot (not a Dockerfile). Manual updates as needed.
- Pin yq version to v4.44.3 with curl fallback
- Pin devcontainer features (Docker 27.0, gh CLI 2.62)
- Add shell safety flags (set -Eeuo pipefail)
- Replace hardcoded paths with git rev-parse
- Improve variable quoting throughout scripts
- Add validation checks (yq exists, gh authenticated)
- Enhance error handling in all scripts

Addresses all valid suggestions from AI reviewers (CodeRabbitAI and Gemini).
- Add updatecli manifest for yq, Docker, and GitHub CLI versions
- Update dependabot.yml to reference UpdateCLI for Codespaces deps
- Clarify port visibility is not blocking access in README
- Document that private ports work for Codespace owners

UpdateCLI will now automatically create PRs when new versions
of devcontainer dependencies are available.
The dockerhub-image-exists condition was missing the required
sourceid attribute, causing UpdateCLI validation to fail.

Tested locally with updatecli diff - manifest now works correctly
and detects available updates:
- yq: v4.44.3 → v4.48.1
- Docker: 27.0 → 28.5
- GitHub CLI: 2.62 → 2.81.0

The manifest will run successfully once this PR is merged to main.
Fixed three pattern matching issues:
1. yq pattern: Added missing closing brace '}' before final quote
2. Docker pattern: Simplified to match line-by-line with search filter
3. GitHub CLI pattern: Simplified to match line-by-line with search filter

Tested locally - all targets now detect updates correctly:
- ⚠ [yq-setup-script] v4.44.3 → v4.48.1
- ⚠ [docker-feature-version] 27.0 → 28.5
- ⚠ [github-cli-feature-version] 2.62 → 2.81.0
Replaced echo with printf for lines containing ANSI color codes
to improve portability across different shells.

Fixes Codacy warnings:
- Line 44: echo → printf for color formatting
- Line 45: echo → printf with proper format string
- Line 51: echo → printf in loop with format placeholders

The echo command's handling of escape sequences is not
standardized across shells. printf is the portable solution
and is recommended by POSIX for formatted output.
@github-actions github-actions bot added the repo label Oct 15, 2025
@gounthar gounthar requested a review from Copilot October 15, 2025 16:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the primary cloud development environment from GitPod to GitHub Codespaces due to GitPod's free tier reduction (10h/month vs Codespaces' 60h/month). The migration introduces comprehensive devcontainer configuration, automated dependency tracking via UpdateCLI, and improved shell scripting practices while maintaining backward compatibility with GitPod during the transition period.

Key changes:

  • Complete Codespaces configuration with Docker-in-Docker, automated setup, and dynamic Jenkins URL configuration
  • UpdateCLI manifest for automatic dependency version tracking (yq, Docker, GitHub CLI)
  • Enhanced shell safety with modern bash practices and pinned dependency versions

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
updatecli/updatecli.d/codespaces.yaml Automated dependency tracking configuration for devcontainer dependencies
dockerfiles/codespacesURL.sh Dynamic Jenkins URL configuration script for Codespaces environment
docker-compose.yaml Set default empty values for GITPOD_WORKSPACE_URL to suppress warnings
README.md Updated documentation with Codespaces quick start and marked GitPod as legacy
CODESPACES_MIGRATION_PLAN.md Comprehensive migration plan and implementation guide
.github/dependabot.yml Disabled Dependabot for legacy GitPod Dockerfile updates
.devcontainer/setup.sh Codespaces initialization script with yq installation and environment setup
.devcontainer/devcontainer.json Dev container specification with Docker-in-Docker and port forwarding
.devcontainer/README.md Codespaces-specific documentation and troubleshooting guide

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


# Build the profiles list message
for target in "${targets[@]}"; do
message+="\033[36m${target}\033[0m, "
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using echo with ANSI escape sequences on line 47 (printf \"%b\\n\" \"${message}\") is correct, but building the message string with escape sequences using += can be error-prone. Consider building an array and using printf directly in the loop for better maintainability and consistency with the other printf statements in the script.

Copilot uses AI. Check for mistakes.
Replace string concatenation with direct printf calls for building
the profiles list message. This is more maintainable and consistent
with other printf statements in the script.

Benefits:
- Avoids error-prone string building with ANSI escape sequences
- More consistent with the rest of the script
- Cleaner and easier to maintain
- No temporary variables needed

Addresses Copilot AI code review suggestion.
@gounthar gounthar merged commit 20db694 into jenkins-docs:main Oct 15, 2025
7 of 8 checks passed
@gounthar gounthar deleted the feature/codespaces-migration branch October 15, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant