Skip to content

Commit 78c06b8

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 70fedab + d4c5c2c commit 78c06b8

File tree

23 files changed

+777
-32
lines changed

23 files changed

+777
-32
lines changed

.devcontainer/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Codespaces Configuration
2+
3+
This directory contains the GitHub Codespaces dev container configuration.
4+
5+
## Port Visibility
6+
7+
Port 8080 may show as **private** in the PORTS panel, but this is usually not an issue - you can still access Jenkins using the forwarded URL.
8+
9+
**Note:** The port visibility label in the UI can be misleading. Even when marked as "private", the Jenkins URL provided in the welcome message will work in your browser. Only change visibility to "public" if you need to share the URL with others.
10+
11+
### Manual Steps (if needed for sharing):
12+
1. Open the **PORTS** panel at the bottom of VS Code (next to TERMINAL)
13+
2. Find port **8080** in the list
14+
3. **Right-click** on port 8080
15+
4. Select **Port Visibility****Public**
16+
17+
### Technical Details
18+
19+
The `devcontainer.json` includes `"visibility": "public"` for port 8080, but GitHub Codespaces may not always apply this setting automatically. The setup script attempts to set visibility using the GitHub CLI, but this is optional since Codespaces authentication allows private port access.
20+
21+
## Files
22+
23+
- **devcontainer.json** - Dev container specification
24+
- **setup.sh** - Initialization script (installs yq, configures URLs, creates welcome message)
25+
- **welcome.txt** - Generated welcome message (not in git, created at runtime)
26+
- **README.md** - This file
27+
28+
## Accessing Jenkins
29+
30+
After starting a tutorial with `docker compose --profile <name> up -d`:
31+
- Jenkins URL: `https://<codespace>-8080.<domain>` (shown in PORTS panel)
32+
- Default credentials: admin/admin
33+
34+
**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.
35+
36+
## Troubleshooting
37+
38+
**Port 8080 refuses connection:**
39+
- Verify Jenkins is running: `docker compose ps`
40+
- Check logs: `docker compose logs jenkins_controller`
41+
- Wait 1-2 minutes for Jenkins to fully start
42+
- Port visibility (private/public) should not affect access for the Codespace owner
43+
44+
**Welcome message not showing:**
45+
- Run: `source ~/.bashrc` in your terminal
46+
- Or open a new terminal window
47+
48+
**yq not found:**
49+
- Run: `bash .devcontainer/setup.sh` manually

.devcontainer/devcontainer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "Jenkins Quickstart Tutorials",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
4+
5+
"features": {
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
7+
"version": "28.5",
8+
"dockerDashComposeVersion": "v2"
9+
},
10+
"ghcr.io/devcontainers/features/github-cli:1": {
11+
"version": "2.82.1"
12+
}
13+
},
14+
15+
"onCreateCommand": "bash .devcontainer/setup.sh",
16+
"postStartCommand": "cat .devcontainer/welcome.txt 2>/dev/null || echo 'Run: .devcontainer/setup.sh for tutorial instructions'",
17+
18+
"forwardPorts": [8080, 3000, 5000],
19+
20+
"portsAttributes": {
21+
"8080": {
22+
"label": "Jenkins Controller",
23+
"onAutoForward": "openBrowser",
24+
"protocol": "http",
25+
"visibility": "public"
26+
},
27+
"3000": {
28+
"label": "Application Port (Node/Android/Go)",
29+
"onAutoForward": "notify",
30+
"protocol": "http"
31+
},
32+
"5000": {
33+
"label": "Application Port (Multi/.NET)",
34+
"onAutoForward": "notify",
35+
"protocol": "http"
36+
}
37+
},
38+
39+
"customizations": {
40+
"vscode": {
41+
"extensions": [
42+
"ms-azuretools.vscode-docker",
43+
"redhat.vscode-yaml"
44+
],
45+
"settings": {
46+
"terminal.integrated.defaultProfile.linux": "bash"
47+
}
48+
}
49+
},
50+
51+
"remoteUser": "vscode",
52+
53+
"updateContentCommand": "echo 'Container updated successfully'"
54+
}

.devcontainer/setup.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env bash
2+
# GitHub Codespaces setup script for Jenkins Quickstart Tutorials
3+
# This script configures the Codespace environment and prepares Jenkins URL configuration
4+
5+
set -Eeuo pipefail # Exit on error, undefined variables, pipe failures
6+
7+
echo "================================"
8+
echo "Setting up Jenkins Tutorials Environment"
9+
echo "================================"
10+
11+
# Install yq (YAML processor) - required for JCasc configuration
12+
echo "📦 Installing yq YAML processor..."
13+
YQ_VERSION="${YQ_VERSION:-v4.48.1}"
14+
YQ_URL="https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"
15+
16+
# Try wget first, fall back to curl if unavailable
17+
if command -v wget &> /dev/null; then
18+
sudo wget -qO /usr/local/bin/yq "${YQ_URL}"
19+
elif command -v curl &> /dev/null; then
20+
sudo curl -fsSL -o /usr/local/bin/yq "${YQ_URL}"
21+
else
22+
echo "❌ Error: Neither wget nor curl found. Cannot download yq."
23+
exit 1
24+
fi
25+
26+
sudo chmod a+x /usr/local/bin/yq
27+
yq --version
28+
29+
# Verify Docker is available
30+
echo "🐳 Verifying Docker installation..."
31+
docker --version
32+
docker compose version
33+
34+
# Create secrets directory if it doesn't exist
35+
echo "📁 Creating secrets directory..."
36+
mkdir -p ./secrets
37+
38+
# Run Codespaces URL configuration script
39+
if [ -f "./dockerfiles/codespacesURL.sh" ]; then
40+
echo "🔧 Configuring Jenkins URLs for Codespaces..."
41+
chmod +x ./dockerfiles/codespacesURL.sh
42+
./dockerfiles/codespacesURL.sh
43+
else
44+
echo "⚠️ Warning: codespacesURL.sh not found, skipping URL configuration"
45+
fi
46+
47+
# Create welcome message for future terminal sessions
48+
WELCOME_FILE=".devcontainer/welcome.txt"
49+
cat > "$WELCOME_FILE" << 'WELCOME_EOF'
50+
51+
================================
52+
🚀 Jenkins Quickstart Tutorials
53+
================================
54+
55+
Available tutorial profiles:
56+
• default : Basic Jenkins with SSH agent
57+
• maven : Jenkins + Maven build environment
58+
• python : Jenkins + Python development
59+
• node : Jenkins + Node.js/npm
60+
• multi : Multibranch pipeline example
61+
• android : Android development
62+
• golang : Go development
63+
• cpp : C++ development
64+
• dotnet : .NET development
65+
• wizard : Jenkins setup wizard (learning)
66+
67+
Quick Start:
68+
docker compose --profile <profile-name> up -d
69+
70+
Examples:
71+
docker compose --profile maven up -d
72+
docker compose --profile node up -d
73+
74+
To build locally:
75+
docker compose -f build-docker-compose.yaml --profile <profile-name> up -d
76+
77+
WELCOME_EOF
78+
79+
# Add Jenkins URL based on environment
80+
if [ -n "${CODESPACE_NAME:-}" ] && [ -n "${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-}" ]; then
81+
echo "Jenkins will be accessible at:" >> "${WELCOME_FILE}"
82+
echo " https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" >> "${WELCOME_FILE}"
83+
else
84+
echo "Jenkins will be accessible at:" >> "${WELCOME_FILE}"
85+
echo " http://localhost:8080" >> "${WELCOME_FILE}"
86+
fi
87+
88+
echo "" >> "${WELCOME_FILE}"
89+
echo "Default credentials: admin/admin" >> "${WELCOME_FILE}"
90+
echo "================================" >> "${WELCOME_FILE}"
91+
echo "" >> "${WELCOME_FILE}"
92+
93+
# Display the welcome message
94+
cat "${WELCOME_FILE}"
95+
96+
echo "✅ Setup Complete! Welcome message saved to ${WELCOME_FILE}"
97+
echo ""
98+
99+
# Add welcome message to .bashrc so it shows on every new terminal
100+
# Use git rev-parse to find repo root dynamically instead of hardcoding path
101+
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
102+
WELCOME_PATH="${REPO_ROOT}/.devcontainer/welcome.txt"
103+
104+
if ! grep -q "Jenkins Quickstart Tutorials Welcome" ~/.bashrc; then
105+
echo "" >> ~/.bashrc
106+
echo "# Jenkins Quickstart Tutorials Welcome" >> ~/.bashrc
107+
echo "if [ -f \"${WELCOME_PATH}\" ]; then" >> ~/.bashrc
108+
echo " cat \"${WELCOME_PATH}\"" >> ~/.bashrc
109+
echo "fi" >> ~/.bashrc
110+
fi
111+
112+
# Set port 8080 visibility to public using gh CLI (if in Codespaces)
113+
if [ -n "${CODESPACE_NAME:-}" ]; then
114+
echo "🔓 Setting port 8080 visibility to public..."
115+
# Check if gh CLI is authenticated before attempting to set port visibility
116+
if gh auth status &>/dev/null; then
117+
gh codespace ports visibility 8080:public -c "${CODESPACE_NAME}" 2>/dev/null || echo "⚠️ Could not set port visibility automatically. Please set port 8080 to public manually in the PORTS panel."
118+
else
119+
echo "⚠️ gh CLI not authenticated. Please set port 8080 to public manually in the PORTS panel."
120+
fi
121+
fi

.github/dependabot.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
33

44
version: 2
5+
# Note: GitPod support is legacy (free tier sunset). Migrated to GitHub Codespaces.
6+
# Codespaces uses devcontainer.json which Dependabot cannot monitor (not a Dockerfile).
7+
# Codespaces dependencies (yq, devcontainer features) are tracked by UpdateCLI.
8+
# See updatecli/updatecli.d/codespaces.yaml for automated updates.
9+
510
# Enable version updates for GitHub Actions workflows
611
updates:
712
- package-ecosystem: "github-actions"
@@ -62,4 +67,13 @@ updates:
6267
directory: "./dockerfiles/dotnet"
6368
schedule:
6469
interval: weekly
65-
open-pull-requests-limit: 10
70+
open-pull-requests-limit: 10
71+
72+
# GitPod (legacy) - disabled, not actively maintained
73+
- package-ecosystem: docker
74+
directory: "./.gitpod"
75+
schedule:
76+
interval: weekly
77+
open-pull-requests-limit: 0
78+
ignore:
79+
- dependency-name: "gitpod/workspace-full"

.github/workflows/anchore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: cd ./dockerfiles/ && docker build . --file Dockerfile --tag localbuild/testimage:latest
3939

4040
- name: Run the Anchore Grype scan action
41-
uses: anchore/scan-action@f6601287cdb1efc985d6b765bbf99cb4c0ac29d8
41+
uses: anchore/scan-action@a5605eb0943e46279cb4fbd9d44297355d3520ab
4242
id: scan
4343
with:
4444
path: "."

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ secrets/*
44
03_maven_tutorial/secrets/*
55
.tutorial_running.txt
66

7+
# Local development files
8+
CLAUDE.md
9+
CONTEXT.md
10+
.devcontainer/welcome.txt

.gitpod/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile is used to create a Gitpod workspace with GitHub CLI installed.
22

33
# We start from the Gitpod full workspace image which includes a broad range of development tools.
4-
FROM gitpod/workspace-full:2025-10-13-11-42-09
4+
FROM gitpod/workspace-full:2025-10-16-17-48-52
55

66
# The RUN command executes a series of commands in the new layer of the image and commits the results.
77
# The following commands are executed:

0 commit comments

Comments
 (0)