private void setupBuildRepos ( BuildExecution execution , String packageType , Indy indy , Map < String , String > genericParameters ) throws IndyClientException { String buildContentId = execution . getBuildContentId ( ) ; int id = execution . getId ( ) ; // if the build-level group doesn't exist, create it. StoreKey groupKey = new StoreKey ( packageType , StoreType . group , buildContentId ) ; if ( ! indy . stores ( ) . exists ( groupKey ) ) { // if the product-level storage repo (for in-progress product builds) doesn't exist, create it. StoreKey hostedKey = new StoreKey ( packageType , StoreType . hosted , buildContentId ) ; boolean tempBuild = execution . isTempBuild ( ) ; if ( ! indy . stores ( ) . exists ( hostedKey ) ) { HostedRepository buildArtifacts = new HostedRepository ( packageType , buildContentId ) ; buildArtifacts . setAllowSnapshots ( tempBuild ) ; buildArtifacts . setAllowReleases ( true ) ; buildArtifacts . setDescription ( String . format ( "Build output for PNC %s build #%s" , packageType , id ) ) ; indy . stores ( ) . create ( buildArtifacts , "Creating hosted repository for " + packageType + " build: " + id + " (repo: " + buildContentId + ")" , HostedRepository . class ) ; } Group buildGroup = new Group ( packageType , buildContentId ) ; String adjective = tempBuild ? "temporary " : "" ; buildGroup . setDescription ( String . format ( "Aggregation group for PNC %sbuild #%s" , adjective , id ) ) ; // build-local artifacts buildGroup . addConstituent ( hostedKey ) ; // Global-level repos, for captured/shared artifacts and access to the outside world addGlobalConstituents ( packageType , buildGroup , tempBuild ) ; // add extra repositories removed from poms by the adjust process and set in BC by user List < ArtifactRepository > extraDependencyRepositories = extractExtraRepositoriesFromGenericParameters ( genericParameters ) ; if ( execution . getArtifactRepositories ( ) != null ) { extraDependencyRepositories . addAll ( execution . getArtifactRepositories ( ) ) ; } addExtraConstituents ( packageType , extraDependencyRepositories , id , buildContentId , indy , buildGroup ) ; indy . stores ( ) . create ( buildGroup , "Creating repository group for resolving artifacts in build: " + id + " (repo: " + buildContentId + ")" , Group . class ) ; } }
Create the hosted repository and group necessary to support a single build . The hosted repository holds artifacts uploaded from the build and the group coordinates access to this hosted repository along with content from the product - level content group with which this build is associated . The group also provides a tracking target so the repository manager can keep track of downloads and uploads for the build .