Skip to content

Latest commit

 

History

History
107 lines (73 loc) · 8.6 KB

File metadata and controls

107 lines (73 loc) · 8.6 KB

App Modernization Workshop

The following sections guide you through the process of modernizing the sample Java application asset-manager to Azure using GitHub Copilot app modernization.

Table of Contents

Prerequisites

Note: If you're using Gradle, only the Gradle wrapper version 5+ is supported. The Kotlin Domain Specific Language (DSL) isn't supported.

The function My Tasks isn't supported yet for IntelliJ IDEA.

Clone the Repository

git clone https://github.com/copilot-dev-days/appmod-workshop-java.git
cd appmod-workshop-java

Install GitHub Copilot app modernization

In VSCode, open the Extensions view from the Activity Bar, search for the GitHub Copilot app modernization extension in the marketplace. Click the Install button for the extension. After installation completes, you should see a notification in the bottom-right corner of VSCode confirming success.

Alternative: IntelliJ IDEA Alternatively, you can use IntelliJ IDEA. Open File > Settings (or IntelliJ IDEA > Preferences on macOS), navigate to Plugins > Marketplace, search for GitHub Copilot app modernization, and click Install. Restart IntelliJ IDEA if prompted.

Assess Your Java Application

The first step is to assess the sample Java application asset-manager. The assessment provides insights into the application's readiness for migration to Azure.

  1. Open VS Code with all the prerequisites installed for the asset manager by changing the directory to the asset-manager directory and running code . in that directory.

  2. In the Activity sidebar, open the GitHub Copilot app modernization extension pane.

  3. In the QUICKSTART section, click Start Assessment to trigger the app assessment.

    Trigger Assessment

  4. Wait for the assessment to be completed. This step could take several minutes.

  5. Upon completion, an Assessment Report tab opens. This report provides a categorized view of cloud readiness issues and recommended solutions. Select the Issues tab to view proposed solutions and proceed with migration steps.

Upgrade Runtime & Frameworks

  1. In the Java Upgrade table at the bottom of the Issues tab, click the Run Task button of the first entry Java Version Upgrade.

    Java Upgrade

  2. After clicking the Run Task button, the Copilot Chat panel will open with Agent Mode. The agent will check out a new branch and start upgrading the JDK version and Spring/Spring Boot framework. Click Allow for any requests from the agent.

Note: The upgrading tool also supports upgrading to JDK 25 (the latest LTS version). To do this, click on the generated chat message, edit the target Java version to 25, and then click Send to apply the change.

Expose health endpoints using Custom Skills

In this section, you will use custom skills to expose health endpoints for your applications instead of writing code yourself. The following steps demonstrate how to create a custom skill with references and proper prompts.

Note: Custom skills (My Skills) are not supported for the IntelliJ IDEA plugin. If you are using IntelliJ IDEA, you can skip this section.

  1. In the Activity sidebar, open the GitHub Copilot app modernization extension pane. Hover over the TASKS section, and then select Create a Custom Skill.

    Create Custom Skill

  2. A Create a Skill form opens with the following fields. Fill them in as shown below:

    • Skill Name: expose-health-endpoint
    • Skill Description: This skill helps add Spring Boot Actuator health endpoints for Azure Container Apps deployment readiness.
    • Skill Content: You are a Spring Boot developer assistant, follow the Spring Boot Actuator documentation to add basic health endpoints for Azure Container Apps deployment.
  3. Click Add Resources to add the Spring Boot Actuator official documentation as a resource. Paste the following link: https://docs.spring.io/spring-boot/reference/actuator/endpoints.html.

    Create a Skill form

  4. Click Save to create the skill. Your custom skill now appears in the TASKS > My Skills section.

  5. Click Run to execute it.

  6. The Copilot chat window opens in Agent Mode and automatically generates the migration plan, checks out a new branch, performs code changes, and runs the validation and fix iteration loop. Click Allow for any tool call requests from the agent.

  7. Review the proposed code changes and click Keep to apply them.

Containerize Applications

Now that you have completed the upgrade and health endpoint steps, the next step is to prepare your application for cloud deployment by containerizing both the web and worker modules. In this section, you will use Containerization Tasks to containerize your applications.

  1. In the Activity sidebar, open the GitHub Copilot app modernization extension pane. In the TASKS section, expand Common Tasks > Containerize Tasks and click the run button for Containerize Application.

    Run Containerize Application task

  2. A predefined prompt will be populated in the Copilot Chat panel with Agent Mode. Copilot Agent will start to analyze the workspace and to create a containerization-plan.copiotmd with the containerization plan.

    Containerization prompt and plan

  3. View the plan and collaborate with Copilot Agent as it follows the Execution Steps in the plan by clicking Continue/Allow in pop-up chat notifications to run commands. Some of the execution steps leverage agentic tools of Container Assist.

  4. Copilot Agent will help generate Dockerfile, build Docker images and fix build errors if there are any. Click Keep to apply the generated code.