Issue vrbt vrealize:clean for vra packages
Description
We recently upgraded from 2.43.0 to 4.5.0. Executing the lifecycle event vrealize:clean now gives an error: content.yaml file is not found or not readable at /azp/_work/1/s/content.yaml in our pipeline.
Looking around, I'd think this code might be related to the issue:
https://github.com/vmware/build-tools-for-vmware-aria/blob/e3becb6eda78268b9f34b2a447b5d6f4e7255b37/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrang/VraNgPackageAdapter.java#L51-L52
It looks at the parentDir when resolving the content.yaml. But maybe it should look at packagePath instead?
If you need more details or a demo, you know how to reach me :) If this is the intended behavior, we'll rewrite our pipeline.
Steps to Reproduce
- Create a mixed package with the following structure:
package/
├─ typescript/
│ ├─ src/
│ │ ├─ *.ts
│ ├─ pom.xml (typescript-project-all) myCatalogItem.typescript
│ ├─ tsconfig.json
├─ vra/
│ ├─ src/main/resources/
│ │ ├─ catalog-items/
│ │ │ ├─ *.json
│ │ ├─ content-sources/
│ │ │ ├─ *.json
│ ├─ content.yaml
│ ├─ pom.xml (vra-ng-package) myCatalogItem (with a dependency on `.typescript`)
├─ pom.xml (base-package) myCatalogItem-all
- Create a portal pom which will install packages to a tenant like:
portals/
└── portal-acc-region/
├── content.yaml
└── pom.xml
portals/portal-acc-region/pom.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vmware.pscoe.vra-ng</groupId>
<artifactId>vra-ng-package</artifactId>
<version>4.5.0</version>
</parent>
<groupId>com.example.test</groupId>
<artifactId>portal-acc-region</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>vra-ng</packaging>
<dependencies>
<dependency>
<groupId>com.example.test</groupId>
<artifactId>myCatalogItem</artifactId>
<version>1.0.1</version>
<type>vrang</type>
</dependency>
</dependencies>
</project>
- Create a pipeline step like:
- task: Maven@4
displayName: Cleanup old package versions on $(vRealizeEnvironment)
inputs:
mavenPomFile: portals/$(portal)/pom.xml
goals: vrealize:clean
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: true
sonarQubeRunAnalysis: false
options: '-U -Djavax.net.ssl.trustStore=cert/cacerts --global-settings $(settings.secureFilePath) -DcleanUpLastVersion=false -DcleanUpOldVersions=true -DincludeDependencies=true -PaccRegion -ntp'
Preconditions: The file structure
Expected behavior: The vrealize:clean goal to execute successfully. I'd expect it to look at the content.yaml of the dependency, not of the current pom.xml.
Actual behavior: Throws an error content.yaml file is not found or not readable at /azp/_work/1/s/content.yaml
Reproduces how often: 100%
Component/s: "common/artifact-manager"
Affects Build/s: 2.44.0 and up (since commit 83d3b49402c5a9a31b0ae39fcd6d95328208cb30)
Environment
Server
- vRealize Automation Version:
8.18.1 - vRealize Orchestrator Version:
8.18.1
Failure Logs
[ERROR] Failed to execute goal com.vmware.pscoe.maven.plugins:vrealize-package-maven-plugin:4.5.0:clean (default-cli) on project infraportal-acceptance: Execution default-cli of goal com.vmware.pscoe.maven.plugins:vrealize-package-maven-plugin:4.5.0:clean failed: Unable to get descriptor for package com.example.test.myCatalogItem-1.0.1: content.yaml file is not found or not readable at /azp/_work/1/s/content.yaml -> [Help 1]
Related issues and PRs
#319 #436