TS-47508 Accept a folder for the git-properties-jar option - #962
Merged
Conversation
The option only accepted a regular file so far. A folder was rejected with a warning and the option was dropped, so deployments that keep git.properties in a resources folder instead of inside the profiled archive got no commit auto-detection at all. The search itself already handles both shapes: GitPropertiesLocatorUtils.findGitPropertiesInFile branches into an archive or a folder search, and the folder branch is what the automatic detection uses for exploded class folders such as BOOT-INF/classes or the JBoss vfs temp folders. The only obstacles were the parser's isFile() check and the three call sites hardcoding isJarFile = true, which now derive the flag from isDirectory(). Folder semantics stay as they are: the folder tree is always walked for git.properties files, while search-git-properties-recursively only controls whether archives inside the folder are opened as well. Changing that would also change the automatic detection for exploded class folders, where git.properties usually sits in a subfolder. The option keeps its name for compatibility, so an option named "...-jar" now also takes a folder. Log messages and documentation state this. Also fixes the inconsistency warning in GitSingleProjectPropertiesLocator, which pointed users to teamscale-git-properties-jar. That option was replaced by git-properties-jar in 31.0.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
git-properties-jarnow also accepts a folder, which is searched forgit.propertiesfiles. Previously a folder was rejected with a warning and the option was dropped, so deployments that keepgit.propertiesin a resources folder (e.g./app/resourcesin a container image) instead of inside the profiled archive got no commit auto-detection at all.How
The search machinery already handled both shapes:
GitPropertiesLocatorUtils.findGitPropertiesInFilebranches into an archive or a folder search, and the folder branch is what the automatic detection already uses for exploded class folders (BOOT-INF/classes, JBoss vfs temp folders). The obstacles were only:!isFile()rejection inAgentOptionsParser.getGitPropertiesJarFile(nowgetGitPropertiesFileOrFolder), andAgentOptionshardcodingisJarFile = true, which now derive it fromisDirectory().ArtifactoryConfig.parseGitPropertiesgot the corresponding parameter.A non-existent path still logs a warning and lets the application continue.
Decisions
git.properties, whilesearch-git-properties-recursivelyonly controls whether archives inside the folder are opened too. Making the flag also gate subfolders would change the existing automatic detection for exploded class folders, wheregit.propertiesusually sits in a subfolder — a breaking change with no upside here....-jarnow also takes a folder. Documented in the KDoc, the log messages and the CHANGELOG.Drive-by fix
The inconsistency warning in
GitSingleProjectPropertiesLocatorpointed users atteamscale-git-properties-jar, which was replaced bygit-properties-jarin 31.0.0. It now references the current option constant. The Artifactory "found no git.properties" message likewise named the deprecatedartifactory-git-properties-jar.Tests
AgentOptionsTest.testGitPropertiesJarDoesNotAcceptFoldersreplaced bytestGitPropertiesJarAcceptsFolders.DelayedCommitDescriptorRetrievalTestnow covers both an archive and a folder search root.GitPropertiesLocatorTest.testReadingGitPropertiesInJarFileNestedInFolder../gradlew :agent:testpasses.Manual verification against a real Teamscale/Artifactory upload is still pending.
Out of scope
Testwise mode error messages list
git-properties-jaras a way to supply a commit, but no testwise code path readsgitPropertiesJar. That pre-existing gap is untouched.🤖 Generated with Claude Code