Skip to content

Conversation

@JimSuplizio
Copy link
Contributor

@JimSuplizio JimSuplizio commented Oct 22, 2024

All I'm doing here is refactoring some of the code that was in PackageProps, specifically around Yaml loading and processing, hoisting it out to be common and usable outside of that class. Specifically, I'm going to be using the yaml loading and processing for the Get-AllPackageInfoFromRepo I'm implementing for Java.

The changes are as follows:

  1. LoadAndCompatibleConvertFrom-Yaml (this was renamed to LoadFrom-Yaml as per feedback) - this was originally part of the PackageProps::ParseYmlForArtifact function. I moved the Test-Path verification of the yml file and try/catch surrounding the call to CompatibleConvertFrom-Yaml into a common function. That way anyone using the CompatibleConvertFrom-Yaml doesn't have to dupe the checks or the try catch.
  2. GetValueSafelyFrom-Yaml - this was originally PackageProps::GetValueSafely and hidden. I could have changed the class to unhide and make the function static but it seemed better to be hoisted out and sit alongside the rest of the functions in Package-Helpers. The one thing I changed in this function was that if the key isn't found or the value is null, it writes the key and the full path into the output. In theory this could have thrown but there are scenarios where we can look for something that might not exist in a yml file. An example of this would Java's AdditionalModules which may or may not exist.

For testing, to ensure I was running the code path our pipelines run, I just executed /eng/common/scripts/Save-Package-Properties.ps1 locally against my Java repo to create the PackageInfo json files for various service directories. I pulled the PackageInfo directories directly from their respective pipelines and used Beyond Compare to verify the output. The differences were that the json files from the pipelines had Namespaces and this was expected. In a Java pipeline, the PackageInfo files are created before the build and Namespaces are added to them after the build.

@JimSuplizio JimSuplizio added the Central-EngSys This issue is owned by the Engineering System team. label Oct 22, 2024
@JimSuplizio JimSuplizio self-assigned this Oct 22, 2024
@JimSuplizio JimSuplizio requested a review from a team as a code owner October 22, 2024 20:37
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

Copy link
Member

@scbedd scbedd left a comment

Choose a reason for hiding this comment

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

Gave some feedback, but I don't think anything that would block.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@JimSuplizio
Copy link
Contributor Author

Gave some feedback, but I don't think anything that would block.

Yup. I made changes for all your feedback. Everything made sense and the changes were trivial.

@JimSuplizio JimSuplizio enabled auto-merge (squash) October 24, 2024 15:57
azure-sdk added a commit to Azure/azure-sdk-for-js that referenced this pull request Oct 24, 2024
@JimSuplizio JimSuplizio merged commit 8b2d384 into Azure:main Oct 24, 2024
@JimSuplizio JimSuplizio deleted the RefactorYmlFunctions branch October 24, 2024 16:00
scbedd added a commit to Azure/azure-sdk-for-rust that referenced this pull request Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants