Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iac 778 backup on clean environment throws exception #155

Merged

Conversation

mtopchieva
Copy link
Contributor

@mtopchieva mtopchieva commented Aug 3, 2023

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added relevant error handling and logging messages to help troubleshooting
  • I have added necessary documentation (if appropriate)
  • I have updated CHANGELOG.md with a short summary of the changes introduced
  • I have tested against live environment, if applicable
  • My changes have been rebased and squashed to the minimal number of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixed #XXX - or Closed #XXX - prefix to auto-close the issue
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant usage information (As-built)
  • Any structure and/or content vRA-NG improvements are synchronized with vra-ng and ts-vra-ng archetypes
  • Every new or updated Installer property is documented in docs/archive/doc/markdown/use-bundle-installer.md
  • Dependencies in pom.xml are up-to-date

Testing

Testing was done through a regular import of packages through the installer, with a flag in the 'environment.properties' file: 'vro_enable_backup=true'
Tests were performed by having a different set of packages and versions in the local VMware Aria Orchestrator instance, in order to validate that the highest available version per package name is backed up (in the 'vro' folder), or that if no versions are found for the package in vRO to back up, a message is logged that the back up for this package is skipped.

@mtopchieva mtopchieva requested a review from a team as a code owner August 3, 2023 15:14
@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@mtopchieva mtopchieva force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch from e56e332 to 3cbcf1d Compare August 3, 2023 15:17
@vmware vmware deleted a comment from vmwclabot Aug 3, 2023
@mtopchieva mtopchieva self-assigned this Aug 3, 2023
@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@mtopchieva mtopchieva force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch from 3552fc1 to 030921a Compare August 8, 2023 09:27
Copy link
Collaborator

@ivo-kotev ivo-kotev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to re-evaluate the reason behind backing up only the last version

@@ -178,8 +178,26 @@ public final List<Package> importAllPackages(final List<Package> vroPackages, fi
String backupFilePath = this.createBackupFilePath(pkg, currentDateTimeString, backupFilesDirectory);

try {
pkg.setFilesystemPath(backupFilePath);
restClient.exportPackage(pkg, dryrun, exportConfigAttributeValues, exportConfigSecureStringValues);
System.out.println("Package for back up: " + pkg.getFQName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please user the logger object to send information instead of system.out?

restClient.exportPackage(highestVersionPac, dryrun, exportConfigAttributeValues, exportConfigSecureStringValues);

} else {
System.out.println("Package with name: " + pkg.getName() + " does not exist in vRO and backup is skipped.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please user the logger object to send information instead of system.out?

} else {
System.out.println("Package with name: " + pkg.getName() + " does not exist in vRO and backup is skipped.");

}
} catch (Exception ex) {
String exceptionMessage = ex.getMessage();
System.out.println("ExceptionMessage: " + exceptionMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please user the logger object to send information instead of system.out?

}
}

System.out.println("Highest version package to backup: " + highestVersionPac.getFQName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please user the logger object to send information instead of system.out?

* @param packages the collection of packages differring by version
* @return the package with highest version
*/
private Package getHighestVersion(List<Package> packages) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to have only the latest versions backed up? We should be receiving backup of all versions, as Build Tools for VMware Aria - might have the cleanup flag enabled and delete some of the versions that we did not backed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the discussion in the jira issue, this is what was finally agreed.

@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@mtopchieva mtopchieva force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch from 60412c2 to 506aa52 Compare September 1, 2023 16:07
@mtopchieva
Copy link
Contributor Author

This issue IAC-778 has been assigned with new scope (to backup all versions of a package, not just the highest one). It must be added before merging the PR.

@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

1 similar comment
@vmwclabot
Copy link
Member

@mtopchieva, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@akumanov-vmw akumanov-vmw force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch from 28bbb22 to a34ccc1 Compare November 15, 2023 09:58
@akumanov-vmw akumanov-vmw force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch 2 times, most recently from fa8d894 to a01bb08 Compare November 15, 2023 14:30
Signed-off-by: Aleksandar Kumanov <[email protected]>
@akumanov-vmw akumanov-vmw force-pushed the IAC-778-backup-on-clean-environment-throws-exception branch from a01bb08 to 8f3c697 Compare November 15, 2023 14:49
@akumanov-vmw akumanov-vmw changed the base branch from main to IAC-799-Wrong-unix-file-path-separators-when-creating-backup-path November 17, 2023 12:59
@akumanov-vmw akumanov-vmw changed the base branch from IAC-799-Wrong-unix-file-path-separators-when-creating-backup-path to main November 17, 2023 12:59
…re-aria into IAC-778-backup-on-clean-environment-throws-exception

Signed-off-by: Aleksandar Kumanov <[email protected]>
Signed-off-by: Aleksandar Kumanov <[email protected]>
Signed-off-by: Aleksandar Kumanov <[email protected]>
}

if (!samePackagesInDest.isEmpty()) {
List<Package> allCurrentPkgVersions = this.getPackages();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that going to retrieve all packages available in vRO (including the system packages) or just the packages matching the one we try to import?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is going to retrieve all packages and all of their versions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we need to update this - it needs to get all package versions, but only for the packages that we are trying to import (if existing packages are present on the env).

as example if we want to import com.vmware.pscoe.templates.buildtoolsforvmwareariasamples.xml-1.0.11-SNAPSHOT.package, then we should be exporting any package that starts with com.vmware.pscoe.templates.buildtoolsforvmwareariasamples.xml

PS: Keep in mind that in the package name we CAN have dash. (so we first remove any -SNAPSHOT text, then get the last dash in the string and extract the package name based on this)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, my bad I mixed up the context with another ticket. It is backing up all versions (existing in the environment) of the packages we are about to import including the dependencies as well.

Signed-off-by: Aleksandar Kumanov <[email protected]>
Signed-off-by: Aleksandar Kumanov <[email protected]>
@vmware vmware deleted a comment from mtopchieva Nov 24, 2023
@akumanov-vmw akumanov-vmw merged commit e3bea21 into main Nov 24, 2023
11 checks passed
@VenelinBakalov VenelinBakalov deleted the IAC-778-backup-on-clean-environment-throws-exception branch November 1, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants