Skip to content

Commit 4eac18f

Browse files
brunoborgesCopilot
andcommitted
Add workshop-cli variant with GitHub Copilot CLI approach
Replace IDE-based instructions with Copilot CLI equivalents: - 00-overview: Updated for terminal-based CLI workflow - 01-prerequisites: Replaced IDE/extension prereqs with Copilot CLI, Node.js 22+, npm 10+ - 02-assess: Replaced assessment UI step with starting Copilot CLI and adding the app-modernization MCP server - 03-upgrade: Replace UI task button with natural language prompt in CLI - 04-health-endpoints: Replace custom skill UI flow with natural language prompt in CLI - 05-containerize: Replace Tasks panel UI flow with natural language prompt in CLI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f818278 commit 4eac18f

6 files changed

Lines changed: 287 additions & 0 deletions

File tree

workshop-cli/00-overview.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# App Modernization Workshop (Copilot CLI)
2+
3+
## Overview
4+
5+
This workshop will walk you through the process of modernizing a Java application using **GitHub Copilot app modernization via the Copilot CLI**. You'll transform the `asset-manager` project from legacy technologies to a modern, cloud-ready solution — entirely from your terminal, with no IDE required.
6+
7+
**What the Modernization Process Will Do:**
8+
9+
The modernization will transform your application from outdated technologies to a modern solution. This includes:
10+
- Upgrading from **Java 8 to Java 21**
11+
- Migrating from **Spring Boot 2.x to 3.x**
12+
- Adding **health check endpoints**
13+
- **Containerizing** the applications
14+
15+
## Time Estimates
16+
17+
The complete workshop takes approximately **35 minutes** to complete:
18+
19+
| Step | Duration |
20+
|------|----------|
21+
| Prerequisites & Setup | ~5 min |
22+
| Start Copilot CLI & Add MCP Server | ~5 min |
23+
| Upgrade Runtime & Frameworks | ~10 min |
24+
| Expose Health Endpoints | ~10 min |
25+
| Containerize Applications | ~5 min |
26+
27+
## Workshop Steps
28+
29+
| Step | Title | Description |
30+
|------|-------|-------------|
31+
| 01 | [Prerequisites & Setup](01-prerequisites.md) | Install tools and clone the repository |
32+
| 02 | [Start Copilot CLI](02-assess.md) | Launch Copilot CLI and add the modernization MCP server |
33+
| 03 | [Upgrade Runtime & Frameworks](03-upgrade.md) | Upgrade Java and Spring Boot versions |
34+
| 04 | [Health Endpoints](04-health-endpoints.md) | Expose health endpoints using a natural language prompt |
35+
| 05 | [Containerize Applications](05-containerize.md) | Prepare your app for cloud deployment |
36+
37+
## What You'll Learn
38+
39+
- How to use **GitHub Copilot CLI** to modernize legacy Java applications from the terminal
40+
- How to configure the **GitHub Copilot modernization MCP server**
41+
- How to upgrade Java versions and Spring Boot frameworks with AI assistance using natural language prompts
42+
- How to containerize Java applications for cloud deployment

workshop-cli/01-prerequisites.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Step 1: Prerequisites & Setup
2+
3+
## Prerequisites
4+
5+
- A GitHub account with [GitHub Copilot](https://github.com/features/copilot) enabled. A Pro, Pro+, Business, or Enterprise plan is required.
6+
7+
> [!NOTE]
8+
> If you receive Copilot through an organization, the Copilot CLI policy must be enabled in the organization's settings.
9+
10+
- [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli) installed and authenticated.
11+
- [Node.js](https://nodejs.org/) version 22 or later.
12+
- [npm](https://www.npmjs.com/get-npm) version 10 or later.
13+
- [Java JDK](https://learn.microsoft.com/java/openjdk/download) for both the source and target JDK versions.
14+
- [Maven](https://maven.apache.org/download.cgi) or [Gradle](https://gradle.org/install/) to build Java projects.
15+
- A Git-managed Java project using Maven or Gradle.
16+
- For Maven-based projects: access to the public Maven Central repository.
17+
18+
> [!NOTE]
19+
> If you're using Gradle, only the Gradle wrapper version 5+ is supported. The Kotlin Domain Specific Language (DSL) isn't supported.
20+
21+
## Clone the Repository
22+
23+
```bash
24+
git clone https://github.com/copilot-dev-days/appmod-workshop-java.git
25+
cd appmod-workshop-java
26+
```
27+
28+
## Install GitHub Copilot CLI
29+
30+
Follow the official instructions to install and authenticate the GitHub Copilot CLI:
31+
32+
1. Install the CLI by following [Install GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli).
33+
2. Authenticate with your GitHub account by running:
34+
```bash
35+
gh auth login
36+
```
37+
3. Verify the CLI is working:
38+
```bash
39+
copilot --version
40+
```
41+
42+
## ✅ Checkpoint
43+
44+
- [ ] GitHub Copilot CLI installed and authenticated
45+
- [ ] Node.js 22+ and npm 10+ installed
46+
- [ ] Repository cloned locally
47+
- [ ] Java JDK and Maven installed

workshop-cli/02-assess.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Step 2: Start Copilot CLI
2+
3+
## 🎯 Goal
4+
5+
Launch the GitHub Copilot CLI from the project directory and add the GitHub Copilot modernization MCP server so you can run modernization tasks using natural language.
6+
7+
## Start Copilot CLI
8+
9+
1. In your terminal, navigate to the root of the cloned repository:
10+
11+
```bash
12+
cd appmod-workshop-java
13+
```
14+
15+
2. Start the Copilot CLI:
16+
17+
```bash
18+
copilot
19+
```
20+
21+
3. Copilot asks you to confirm that you trust the files in this folder. Choose one of the following:
22+
- **Yes, proceed** — Copilot can work with files in this location for this session only.
23+
- **Yes, and remember this folder for future sessions** — Trust this folder for this and all future sessions.
24+
- **No, exit (Esc)** — End the session.
25+
26+
For this workshop, select **Yes, proceed**.
27+
28+
## Add the Modernization MCP Server
29+
30+
4. Add the GitHub Copilot modernization MCP server by running the following command inside Copilot CLI:
31+
32+
```
33+
/mcp add app-modernization
34+
```
35+
36+
This installs and registers the `@microsoft/github-copilot-app-modernization-mcp-server` package.
37+
38+
> [!TIP]
39+
> Alternatively, you can manually add the server by editing `~/copilot/mcp-config.json`:
40+
> ```json
41+
> {
42+
> "mcpServers": {
43+
> "app-modernization": {
44+
> "type": "local",
45+
> "command": "npx",
46+
> "tools": ["*"],
47+
> "args": ["-y", "@microsoft/github-copilot-app-modernization-mcp-server"]
48+
> }
49+
> }
50+
> }
51+
> ```
52+
53+
5. Verify the MCP server is correctly configured:
54+
55+
```
56+
/mcp show
57+
```
58+
59+
You should see `app-modernization` listed as an active MCP server.
60+
61+
## ✅ Checkpoint
62+
63+
- [ ] Copilot CLI started from the repository root
64+
- [ ] Folder trust confirmed
65+
- [ ] `app-modernization` MCP server added with `/mcp add`
66+
- [ ] MCP server verified with `/mcp show`

workshop-cli/03-upgrade.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Step 3: Upgrade Runtime & Frameworks
2+
3+
## 🎯 Goal
4+
5+
Upgrade the application from Java 8 to Java 21 and from Spring Boot 2.x to 3.x by running a natural language prompt in the Copilot CLI.
6+
7+
## Run the Java Upgrade
8+
9+
1. Inside the running Copilot CLI session, enter the following prompt:
10+
11+
```
12+
Upgrade this project to JDK 21 and Spring Boot 3.2
13+
```
14+
15+
2. Copilot will begin the upgrade process. This includes:
16+
- Generating an upgrade plan
17+
- Performing code remediation
18+
- Building the project
19+
- Checking for vulnerabilities
20+
21+
Allow Copilot to proceed through each step. The task runs end-to-end and displays progress in the terminal.
22+
23+
3. When the task completes, an upgrade summary is displayed showing everything that was changed.
24+
25+
## What the Upgrade Does
26+
27+
The automated upgrade will:
28+
- Update the Java version in `pom.xml` from 8 to 21
29+
- Upgrade Spring Boot dependencies from 2.x to 3.x
30+
- Update incompatible APIs (e.g., `javax.*``jakarta.*` namespace changes)
31+
- Fix deprecated method calls and patterns
32+
- Update Maven plugin versions as needed
33+
34+
> [!NOTE]
35+
> You can target a different Java version by adjusting the prompt. For example: `Upgrade this project to JDK 25 and Spring Boot 3.x`.
36+
37+
## Review the Changes
38+
39+
After the upgrade completes:
40+
1. Review the git diff to see all changes made
41+
2. Verify that `pom.xml` reflects the new Java and Spring Boot versions
42+
3. Check that namespace changes (`javax``jakarta`) have been applied
43+
44+
## ✅ Checkpoint
45+
46+
- [ ] Upgrade prompt executed in Copilot CLI
47+
- [ ] Upgrade task completed successfully
48+
- [ ] Java version updated to 21 in `pom.xml`
49+
- [ ] Spring Boot upgraded to 3.x
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Step 4: Expose Health Endpoints
2+
3+
## 🎯 Goal
4+
5+
Use a natural language prompt in Copilot CLI to add Spring Boot Actuator health endpoints to your application.
6+
7+
## Run the Health Endpoint Task
8+
9+
1. Inside the running Copilot CLI session, enter the following prompt:
10+
11+
```
12+
Add Spring Boot Actuator health endpoints to this project for Azure Container Apps deployment readiness. Follow the Spring Boot Actuator documentation at https://docs.spring.io/spring-boot/reference/actuator/endpoints.html
13+
```
14+
15+
2. Copilot will analyze the project and perform the necessary changes. Allow Copilot to proceed through each step.
16+
17+
3. When the task completes, review the changes in the terminal output.
18+
19+
## What This Does
20+
21+
The task will:
22+
- Add the Spring Boot Actuator dependency to `pom.xml`
23+
- Configure health endpoints in `application.properties` or `application.yml`
24+
- Expose `/actuator/health` endpoint for Azure Container Apps health probes
25+
- This is essential for cloud deployment where the platform needs to check if your app is healthy
26+
27+
> [!TIP]
28+
> You can customize the prompt further. For example, you can ask Copilot to expose additional actuator endpoints such as `/actuator/info` or `/actuator/metrics`.
29+
30+
## ✅ Checkpoint
31+
32+
- [ ] Health endpoint prompt executed in Copilot CLI
33+
- [ ] Spring Boot Actuator dependency added to `pom.xml`
34+
- [ ] Health endpoint configured in `application.properties` or `application.yml`
35+
- [ ] `/actuator/health` endpoint will be available when the app runs

workshop-cli/05-containerize.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Step 5: Containerize Applications
2+
3+
## 🎯 Goal
4+
5+
Prepare your modernized application for cloud deployment by containerizing both the web and worker modules using a natural language prompt in Copilot CLI.
6+
7+
## Run the Containerization Task
8+
9+
1. Inside the running Copilot CLI session, enter the following prompt:
10+
11+
```
12+
Containerize this application. Generate optimized Dockerfiles for each module with multi-stage builds, build the Docker images, and fix any build errors.
13+
```
14+
15+
2. Copilot will analyze the workspace and generate a containerization plan. Allow Copilot to proceed through each step, including running commands to build Docker images.
16+
17+
3. When the task completes, review the generated `Dockerfile` files for both the `web` and `worker` modules.
18+
19+
## What This Does
20+
21+
The containerization process will:
22+
- Analyze the project structure (web module + worker module)
23+
- Generate optimized `Dockerfile` for each module
24+
- Configure multi-stage builds for smaller image sizes
25+
- Set up proper Java runtime configurations
26+
- Build and test the Docker images locally
27+
28+
## ✅ Checkpoint
29+
30+
- [ ] Containerization prompt executed in Copilot CLI
31+
- [ ] Dockerfiles generated for both web and worker modules
32+
- [ ] Docker images built successfully
33+
34+
## 🎉 Congratulations!
35+
36+
You've completed the App Modernization workshop using the Copilot CLI! Here's what you accomplished:
37+
38+
-**Set up** Copilot CLI with the modernization MCP server
39+
-**Upgraded** from Java 8 → 21 and Spring Boot 2.x → 3.x
40+
-**Added health endpoints** using Spring Boot Actuator
41+
-**Containerized** the application for cloud deployment
42+
43+
### What's Next?
44+
45+
- Deploy your containerized app to **Azure Container Apps** — try the prompt: `Deploy this application to Azure`
46+
- Explore more [GitHub Copilot app modernization via CLI](https://learn.microsoft.com/en-us/azure/developer/java/migration/github-copilot-app-modernization-for-java-copilot-cli) features
47+
- Check out the [Copilot Prompts Guide](../PROMPTS.md) for additional prompts used during development
48+
- Visit the other [Copilot Dev Days workshops](https://github.com/copilot-dev-days)

0 commit comments

Comments
 (0)