### Configure Maven Dependencies Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-custom-boot-starter.html Example XML configuration for adding a custom starter dependency to a project's pom.xml file. ```xml com.acme.boot acme-boot-starter 1.0.0 ``` -------------------------------- ### Application Advisor CLI Commands for Bitbucket Integration Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-bitbucket.html These commands are used to get build configurations and apply upgrade plans with Application Advisor. They are intended to be part of a script for Bitbucket integration, as Bitbucket does not directly support the `--push` option. ```bash advisor build-config get ``` ```bash advisor upgrade-plan apply --push ``` -------------------------------- ### Generate and Apply Upgrade Plans with Spring Application Advisor Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Commands to generate and apply upgrade plans for Spring applications. The 'get' command displays the plan, while 'apply' incrementally applies it to the source code. Options allow for squashing steps, forcing upgrades, and accepting non-aligned dependencies. ```bash advisor upgrade-plan get advisor upgrade-plan get –squash=3 advisor upgrade-plan get –force advisor upgrade-plan get –accept-no-alignment advisor upgrade-plan apply advisor upgrade-plan apply –push advisor upgrade-plan apply –push –from-yml advisor upgrade-plan apply –force advisor upgrade-plan apply –accept-no-alignment advisor upgrade-plan apply –squash=3 ``` -------------------------------- ### Run GitLab Runner Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html This command starts the GitLab runner service, making it available to pick up jobs from the GitLab instance. Replace `NAME-OF-THE-RUNNER` with the actual name assigned to your runner. ```bash sudo gitlab-runner run NAME-OF-THE-RUNNER ``` -------------------------------- ### Download and Extract Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/run-app-advisor-cli.html Commands to download the Application Advisor CLI tarball from the Spring Enterprise repository using an Artifactory token and extract the contents. Requires an active ARTIFACTORY_TOKEN environment variable. ```bash # Linux curl -L -H "Authorization: Bearer $ARTIFACTORY_TOKEN" -o advisor-cli.tar -X GET https://packages.broadcom.com/artifactory/spring-enterprise/com/vmware/tanzu/spring/application-advisor-cli-linux/1.5.6/application-advisor-cli-linux-1.5.6.tar tar -xf advisor-cli.tar --strip-components=1 --exclude=./META-INF ``` ```bash # Windows curl -L -H "Authorization: Bearer $ARTIFACTORY_TOKEN" -o advisor-cli.tar -X GET https://packages.broadcom.com/artifactory/spring-enterprise/com/vmware/tanzu/spring/application-advisor-cli-windows/1.5.6/application-advisor-cli-windows-1.5.6.tar tar -xf advisor-cli.tar --strip-components=1 --exclude=./META-INF ``` ```bash # MacOS Intel curl -L -H "Authorization: Bearer $ARTIFACTORY_TOKEN" -o advisor-cli.tar -X GET https://packages.broadcom.com/artifactory/spring-enterprise/com/vmware/tanzu/spring/application-advisor-cli-macos/1.5.6/application-advisor-cli-macos-1.5.6.tar tar -xf advisor-cli.tar --strip-components=1 --exclude=./META-INF ``` ```bash # MacOS ARM64 curl -L -H "Authorization: Bearer $ARTIFACTORY_TOKEN" -o advisor-cli.tar -X GET https://packages.broadcom.com/artifactory/spring-enterprise/com/vmware/tanzu/spring/application-advisor-cli-macos-arm64/1.5.6/application-advisor-cli-macos-arm64-1.5.6.tar tar -xf advisor-cli.tar --strip-components=1 --exclude=./META-INF ``` -------------------------------- ### Application Advisor CLI Execution Script for GitLab Runner Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html This bash script is used by the custom GitLab runner to execute the Application Advisor CLI. It copies the Maven settings, sets a Git token environment variable, and then runs the 'advisor build-config get' and 'advisor upgrade-plan apply' commands. ```bash #!/bin/bash readonly SCRIPT="$1" readonly ACTION="$2" cp /home/gitlab/.m2/settings.xml /root/.m2/settings.xml export GIT_TOKEN_FOR_PRS="${GIT_TOKEN_FOR_PRS:-undefined}" run_advisor() { echo "Project downloaded from git at: $CUSTOM_ENV_CI_PROJECT_DIR" echo "Running Application Advisor CLI" /home/gitlab/advisor build-config get /home/gitlab/advisor upgrade-plan apply --push --from-yml } case "${ACTION}" in "cleanup_file_variables") run_advisor ;; * . "$SCRIPT" "$ACTION" ;; esac ``` -------------------------------- ### Upload and Set Permissions for Tanzu cf CLI Script Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html This command uploads the `advisor_exec.sh` script to the GitLab runner's home directory for use with the Tanzu cf CLI. The `chmod +x` command then makes the script executable. It assumes the `cf` binary and `repo` plugin are already installed on the runner. ```bash gcloud compute scp LOCAL-DIRECTORY/advisor_exec.sh root@"MACHINE-NAME":/home/gitlab --zone "us-central1-a" --project "app-advisor" sudo chmod +x /home/gitlab/advisor_exec.sh ``` -------------------------------- ### Clone and Build Custom Starter Artifacts Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-custom-boot-starter.html Commands to clone the application and starter repositories, and build specific versions of the starter locally using Maven to populate the local repository. ```shell git clone https://github.com/Broadcom/acme-bookings-app git clone https://github.com/Broadcom/acme-boot-starter git checkout 1.0.0 ./mvnw install git checkout 2.0.0 ./mvnw install ``` -------------------------------- ### Generate Build Configuration and Upgrade Plans Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-custom-boot-starter.html Commands to retrieve build configurations and upgrade plans using either the Application Advisor CLI or the Tanzu cf CLI. ```shell # Application Advisor CLI advisor build-config get advisor upgrade-plan get # Tanzu cf CLI cf repo build-sbom cf repo upgrade-plan ``` -------------------------------- ### Apply Upgrade Plans via CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Uses Application Advisor or Tanzu cf CLI to regenerate build configurations and apply automated upgrade plans for Java or Spring Boot migrations. ```bash advisor build-config get && advisor upgrade-plan apply ``` ```bash cf repo build-sbom && cf repo apply-upgrade-plan ``` -------------------------------- ### List Advice Command for Spring Application Advisor Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Prints recommendations for following Tanzu Spring best practices. This command is equivalent to `cf repo advice`. ```bash advisor advice list advisor advice list -h ``` -------------------------------- ### Tanzu cf CLI Execution Script for GitLab Runner Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html This bash script is used by the custom GitLab runner to execute Tanzu cf CLI commands. It copies Maven settings, sets a Git token, and then runs 'cf repo build-sbom' and 'cf repo apply-upgrade-plan'. This script assumes 'cf' and the 'repo' plugin are installed on the runner. ```bash #!/bin/bash readonly SCRIPT="$1" readonly ACTION="$2" cp /home/gitlab/.m2/settings.xml /root/.m2/settings.xml export GIT_TOKEN_FOR_PRS="${GIT_TOKEN_FOR_PRS:-undefined}" run_advisor() { echo "Project downloaded from git at: $CUSTOM_ENV_CI_PROJECT_DIR" echo "Running Application Advisor CLI" cf repo build-sbom cf repo apply-upgrade-plan --push --from-yml } case "${ACTION}" in "cleanup_file_variables") run_advisor ;; * . "$SCRIPT" "$ACTION" ;; esac ``` -------------------------------- ### Set up Script Execution for Spring Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/other-saas-ci-cd-tools.html This section details the essential CLI commands to set up the Spring Application Advisor. It includes downloading and extracting the CLI, configuring a Git access token for pull requests, and applying upgrade plans. The `GIT_TOKEN_FOR_PRS` environment variable is crucial for enabling automatic pull requests for dependency upgrades. ```bash # ...download and extract the advisor CLI... export GIT_TOKEN_FOR_PRS="**WRITE_GIT_ACCESS_TOKEN**" advisor build-config get advisor upgrade-plan apply --push --from-yml ``` -------------------------------- ### Update javax to jakarta Imports in Spring Controller (Java) Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html This snippet demonstrates the refactoring of a Spring controller to replace 'javax.validation.Valid' imports with 'jakarta.validation.Valid'. This change is necessary for Spring Framework 6 and later versions, which have moved validation annotations to the Jakarta EE namespace. The code also updates GET and POST mappings to include a trailing slash, addressing a deprecated configuration option. ```java package org.springframework.samples.petclinic.owner; import java.util.List; import java.util.Map; import jakarta.validation.Valid; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; /** * @author Juergen Hoeller * @author Ken Krebs * @author Arjen Poutsma * @author Michael Isvy */ @Controller class OwnerController { private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm"; private final OwnerRepository owners; public OwnerController(OwnerRepository owners) { this.owners = owners; } @InitBinder public void setAllowedFields(WebDataBinder dataBinder) { // Disallow unknown fields dataBinder.setDisallowedFields("id"); } @GetMapping({"/owners/new", "/owners/new/"}) public String initCreationForm(Map model) { Owner owner = new Owner(); model.put("owner", owner); return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } @PostMapping({"/owners/new", "/owners/new/"}) public String processCreationForm(@Valid Owner owner, BindingResult result) { if (result.hasErrors()) { return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } else { this.owners.save(owner); return "redirect:/owners/" + owner.getId(); } } @GetMapping("/owners/find") public String initFindForm(Map model) { model.put("owner", new Owner()); return "owners/findOwners"; } @GetMapping("/owners") public String processFindForm(Owner owner, BindingResult result, Pageable pageable) { // Datuk: pageable is created with default value in this line Pageable pageable_default = PageRequest.of(0, 5); // Datuk: if we pass pageable, it will be used. if (owner.getLastName() == null) { owner.setLastName(""); // empty string signifies broadest possible search } // also search by last name String lastName = owner.getLastName(); // replace by stream Set to List Page owners = getOwnerRepository().findByLastName(lastName, pageable_default); if (owners.isEmpty()) { result.rejectValue("lastName", "notFound", "not found"); return "owners/findOwners"; } else if (owners.getTotalElements() == 1) { // 1 owner found owner.setId(owners.getContent().get(0).getId()); return "redirect:/owners/" + owner.getId(); } else { // multiple owners found return "owners/ownerList"; } } @GetMapping({"/owners/{ownerId}/edit", "/owners/{ownerId}/edit/"}) public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, ModelMap model) { Owner owner = this.owners.findById(ownerId); model.put("owner", owner); return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } @PostMapping({"/owners/{ownerId}/edit", "/owners/{ownerId}/edit/"}) public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result, @PathVariable("ownerId") int ownerId) { if (result.hasErrors()) { return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } else { owner.setId(ownerId); this.owners.save(owner); return "redirect:/owners/{ownerId}"; } } /** * Custom handler for displaying an owner. * @param ownerId the ID of the owner to display * @return a ModelMap with the model attributes - owner found - or a null string indicating owner not found */ @GetMapping({"/owners/{ownerId}", "/owners/{ownerId}/"}) public String showOwner(@PathVariable("ownerId") int ownerId, ModelMap model) { //petclinic uses previous version Owner owner = this.owners.findById(ownerId); model.addAttribute(owner); return "owners/ownerDetails"; } private OwnerRepository getOwnerRepository() { return this.owners; } } ``` -------------------------------- ### Generate SBOM and Apply Upgrade Plan with Tanzu CF CLI (Bash) Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html This snippet demonstrates how to generate a Software Bill of Materials (SBOM) for a repository and then apply an upgrade plan using the Tanzu Cloud Foundry (CF) CLI. This is typically used in a CI/CD pipeline to ensure that application dependencies are up-to-date and compliant. ```bash cf repo build-sbom && cf repo apply-upgrade-plan ``` -------------------------------- ### Automate JSON Upgrade Mapping Updates with Bash and jq Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-from-1.html This bash script automates the process of updating JSON upgrade mapping files when migrating from Application Advisor 1.3.x to 1.4.x. It requires the 'jq' tool to be installed on a Linux machine. The script iterates through JSON files in a specified directory, modifies the 'nextRewrite' field within the 'rewrite' section to conform to the new schema, and creates backup files for safety. ```bash #!/bin/bash set -euo pipefail function main () { if [ -z "$1" ]; then echo "Usage: $0 " exit 1 fi DIRECTORY="$1" if [ ! -d "$DIRECTORY" ]; then echo "Error: the folder $DIRECTORY doesn't exist" exit 1 fi FIELD="nextRewrite" for file in "$DIRECTORY"/*.json; do echo "Processing $file..." jq --arg key "$FIELD" ' .projects |= map( .rewrite |= with_entries( if(.value.nextRewrite | type == "string") then .value.nextRewrite = { version: .value.nextRewrite } else . end ) ) ' "$file" > "${file}.tmp" cp "$file" "${file}.bak" mv "${file}.tmp" "$file" done echo "Process finished. Each original mapping has been moved to a backup file." } main "$@" ``` -------------------------------- ### Generate application upgrade plan Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Analyzes the project and generates a step-by-step upgrade plan for dependencies based on the previously generated build configuration. ```Application Advisor CLI advisor upgrade-plan get ``` ```Tanzu cf CLI cf repo upgrade-plan ``` -------------------------------- ### Apply upgrade plan step Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Applies the next incremental step of the generated upgrade plan to the application source code. ```Application Advisor CLI advisor upgrade-plan apply ``` ```Tanzu cf CLI cf repo apply-upgrade-plan ``` -------------------------------- ### Create Custom Upgrade Mapping Files Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-custom-boot-starter.html Commands to generate a custom upgrade mapping file for a repository, useful for defining how dependencies should be upgraded when versions are not automatically detected. ```shell # Application Advisor CLI advisor mapping build -r https://github.com/Broadcom/acme-boot-starter --offline # Tanzu cf CLI cf repo build-mapping --repository-url=https://github.com/Broadcom/acme-boot-starter --offline ``` -------------------------------- ### Produce Build Configuration with Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-spring-app.html Generates a build configuration, including the dependency tree (CycloneDX format), required Java version, and build tool versions. This command outputs a JSON file to the .advisor/build-config.json path. ```bash advisor build-config get ``` -------------------------------- ### Review applied changes Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Uses git to inspect the changes made to the project files after applying an upgrade step. ```git git diff ``` -------------------------------- ### Tanzu cf CLI Commands for Bitbucket Integration Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-bitbucket.html These Tanzu cf CLI commands are used to build an SBOM and apply an upgrade plan. They are part of the integration process with Bitbucket, where custom scripting is required due to Bitbucket's limitations with direct push operations. ```bash cf repo build-sbom ``` ```bash cf repo apply-upgrade-plan --push ``` -------------------------------- ### Create Application Advisor Execution Scripts Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-github.html Bash scripts for automating build configurations and upgrade plans using either the Application Advisor CLI or Tanzu cf CLI. ```bash #!/bin/bash # This script assumes that advisor CLI is in the $PATH export GIT_TOKEN_FOR_PRS=**WRITE_GIT_ACCESS_TOKEN** # Check that the $HOME/.m2/settings is using the Spring Commercial repository advisor build-config get advisor upgrade-plan apply –push –from-yml ``` ```bash #!/bin/bash # This script assumes that Tanzu cf CLI is in the $PATH export GIT_TOKEN_FOR_PRS=**WRITE_GIT_ACCESS_TOKEN** # Check that the $HOME/.m2/settings is using the Spring Commercial repository cf repo build-sbom cf repo apply-upgrade-plan --push --from-yml ``` -------------------------------- ### List and Apply Advice via Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/recommendations.html Commands to interact with the standalone Application Advisor CLI. Use these to list available best-practice recommendations and apply specific advice by its unique identifier. ```bash advisor advice list ``` ```bash advisor advice apply --name=[adviceId] ``` -------------------------------- ### Produce Build Configuration with Tanzu cf CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-spring-app.html Generates a build configuration, including the dependency tree (CycloneDX format), required Java version, and build tool versions. This command outputs a JSON file to the .advisor/build-config.json path. ```bash cf repo build-sbom ``` -------------------------------- ### Retrieve Upgrade Plan Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Prints an incremental upgrade plan for the repository, identifying Spring-related upgrades that can be performed in isolation. ```bash advisor upgrade-plan get [-dfh][--accept-no-alignment][--remove-excluded-artifacts][--squash=][-p=] ``` -------------------------------- ### Create and Set Permissions for GitLab Runner Directories Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html These commands create the necessary directories for builds and cache on the GitLab runner and set their permissions to allow read/write access for all users. This ensures the runner can store build artifacts and cache data. ```bash sudo mkdir /home/gitlab/builds sudo chmod -R 777 /home/gitlab/builds sudo mkdir /home/gitlab/cache sudo chmod -R 777 /home/gitlab/cache ``` -------------------------------- ### Generate application build configuration Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Generates the build configuration including dependency tree, Java version, and build tool version. The output is saved to target/.advisor/build-config.json. ```Application Advisor CLI advisor build-config get ``` ```Tanzu cf CLI cf repo build-sbom ``` -------------------------------- ### Verify Java Application Build Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html Configures the Java environment using SDKMAN! and executes Maven tests to verify build integrity. This is used to ensure compatibility after version upgrades. ```bash sdk install java 11.0.25-tem sdk use java 11.0.25-tem ./mvnw test ``` ```bash sdk install java 17.0.13-tem sdk use java 17.0.13-tem ./mvnw test ``` -------------------------------- ### Apply Advice Command for Spring Application Advisor Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Applies selected recommendations to follow Tanzu Spring best practices for a repository. Supports specifying build tools and project names. ```bash advisor advice apply -n="spring-governance-starter" advisor advice apply --name="spring-governance-starter" -b=gradlew advisor advice apply -n="spring-governance-starter" --build-tool-jvm-args="-Xmx2g" --build-tool-options="--profile=dev" ``` -------------------------------- ### Publish Build Configuration Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Publishes the local build configuration to the Tanzu Platform. Requires the current commit to be pushed to the remote Git repository. ```bash advisor build-config publish [-h] [-p=] ``` -------------------------------- ### Generate Build Configuration Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Generates the project build configuration including compile-time dependencies and developer tools. It outputs a .advisor/build-config.json file in the project's build directory. ```bash advisor build-config get [-dh] [-b=] [-p=] ``` -------------------------------- ### Apply Spring Application Upgrade Plan using CLI (Bash) Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/how-to-guides-upgrade-boot.html This snippet shows the command to apply an upgrade plan for a Spring application using the Application Advisor CLI. It first retrieves the build configuration and then applies the upgrade plan. This is part of the automated upgrade process to ensure compatibility with newer Spring Boot versions. ```bash advisor build-config get && advisor upgrade-plan apply ``` -------------------------------- ### List and Apply Advice via Tanzu cf CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/recommendations.html Commands for the Tanzu cf CLI plugin to manage repository advice. This includes general advice listing and applying specific migrations, such as the Jakarta JAX-RS to Spring Boot migration. ```bash cf repo advice ``` ```bash cf repo apply-advice --name=[adviceId] ``` ```bash cf repo apply-advice --name=java-jakarta-jaxrs-import ``` -------------------------------- ### Configure Runner Environment Variables Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-github.html Instructions for setting the completion hook environment variable to trigger the Application Advisor script on a self-hosted runner. ```bash ACTIONS_RUNNER_HOOK_JOB_COMPLETED=/opt/runner/advisor_script.sh ``` -------------------------------- ### Build Configuration Commands for Spring Application Advisor Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/cli-reference.html Commands to generate or publish build dependencies and tools for Spring applications. Supports specifying build tools like Maven or Gradle and their options. ```bash advisor build-config advisor build-config -b=mvn advisor build-config --build-tool-options="-DskipTests" ``` -------------------------------- ### Publish Build Configuration with Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-spring-app.html Publishes the build configuration using the Application Advisor CLI. This action is typically performed within a CI/CD pipeline as part of enabling continuous and incremental upgrades. ```bash advisor build-config publish ``` -------------------------------- ### Upload and Set Permissions for Application Advisor CLI Files Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/integrate-gitlab.html These gcloud compute scp commands are used to copy the Application Advisor CLI script (`advisor_exec.sh`) and binary (`advisor`) to the GitLab runner's home directory. Subsequently, `chmod +x` commands are used to make them executable. ```bash gcloud compute scp LOCAL-DIRECTORY/advisor_exec.sh root@"MACHINE-NAME":/home/gitlab --zone "us-central1-a" --project "app-advisor" gcloud compute scp LOCAL-DIRECTORY/advisor root@"MACHINE-NAME":/home/gitlab --zone "us-central1-a" --project "app-advisor" sudo chmod +x /home/gitlab/advisor_exec.sh sudo chmod +x /home/gitlab/advisor ``` -------------------------------- ### Generate Upgrade Plan with Application Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-spring-app.html Generates a step-by-step upgrade plan for Spring projects, detailing which components need upgrading and to what versions. This command helps identify necessary updates for Spring Boot, Spring Framework, and Java. ```bash advisor upgrade-plan get ``` -------------------------------- ### Build Maven Repository Mappings with Advisor CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/custom-upgrades.html Builds Maven repository mappings using the Advisor CLI. Requires explicit Maven repository configuration. Deprecated in favor of `advisor mapping create`. ```bash advisor mapping build --repository=${REPO_URL} [--offline] [--maven-server-url=] ``` -------------------------------- ### Generate Upgrade Plan with Tanzu cf CLI Source: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/application-advisor/1-5/app-advisor/upgrade-spring-app.html Generates a step-by-step upgrade plan for Spring projects, detailing which components need upgrading and to what versions. This command helps identify necessary updates for Spring Boot, Spring Framework, and Java. ```bash cf repo upgrade-plan ```