indy-repository-manager/src/main/java/org/jboss/pnc/indyrepositorymanager/RepositoryManagerDriver.java
@Override
    public RepositorySession createBuildRepository(BuildExecution buildExecution,
                                                   String accessToken,
                                                   String serviceAccountToken,
                                                   RepositoryType repositoryType,
                                                   Map<String, String> genericParameters) throws RepositoryManagerException {
        Indy indy = init(accessToken);
        Indy serviceAccountIndy = init(serviceAccountToken);
        String packageType = getIndyPackageTypeKey(repositoryType);

        String buildId = buildExecution.getBuildContentId();
        try {
            setupBuildRepos(buildExecution, packageType, serviceAccountIndy, genericParameters);
        } catch (IndyClientException e) {
            throw new RepositoryManagerException("Failed to setup repository or repository group for this build: %s", e,
                    e.getMessage());
        }

        // since we're setting up a group/hosted repo per build, we can pin the tracking ID to the build repo ID.
        String url;
        String deployUrl;

        try {
            // manually initialize the tracking record, just in case (somehow) nothing gets downloaded/uploaded.
            indy.module(IndyFoloAdminClientModule.class).initReport(buildId);

            StoreKey groupKey = new StoreKey(packageType, StoreType.group, buildId);
            url = indy.module(IndyFoloContentClientModule.class).trackingUrl(buildId, groupKey);

            StoreKey hostedKey = new StoreKey(packageType, StoreType.hosted, buildId);
            deployUrl = indy.module(IndyFoloContentClientModule.class).trackingUrl(buildId, hostedKey);

            logger.info("Using '{}' for {} repository access in build: {}", url, packageType, buildId);
        } catch (IndyClientException e) {
            throw new RepositoryManagerException("Failed to retrieve Indy client module for the artifact tracker: %s", e,
                    e.getMessage());
        }

        boolean tempBuild = buildExecution.isTempBuild();
        String buildPromotionGroup = tempBuild ? TEMP_BUILD_PROMOTION_GROUP : BUILD_PROMOTION_TARGET;
        return new IndyRepositorySession(indy, serviceAccountIndy, buildId, packageType,
                new IndyRepositoryConnectionInfo(url, deployUrl),
                internalRepoPatterns, ignoredPathSuffixes, buildPromotionGroup, tempBuild);
    }
@Override
    public RepositorySession createBuildRepository(BuildExecution buildExecution,
                                                   String accessToken,
                                                   String serviceAccountToken,
                                                   RepositoryType repositoryType,
                                                   Map<String, String> genericParameters) throws RepositoryManagerException {
        Indy indy = init(accessToken);
        Indy serviceAccountIndy = init(serviceAccountToken);
        String packageType = getIndyPackageTypeKey(repositoryType);

        String buildId = buildExecution.getBuildContentId();
        try {
            setupBuildRepos(buildExecution, packageType, serviceAccountIndy, genericParameters);
        } catch (IndyClientException e) {
            throw new RepositoryManagerException("Failed to setup repository or repository group for this build: %s", e,
                    e.getMessage());
        }

        // since we're setting up a group/hosted repo per build, we can pin the tracking ID to the build repo ID.
        String url;
        String deployUrl;

        try {
            // manually initialize the tracking record, just in case (somehow) nothing gets downloaded/uploaded.
            indy.module(IndyFoloAdminClientModule.class).initReport(buildId);

            StoreKey groupKey = new StoreKey(packageType, StoreType.group, buildId);
            url = indy.module(IndyFoloContentClientModule.class).trackingUrl(buildId, groupKey);

            StoreKey hostedKey = new StoreKey(packageType, StoreType.hosted, buildId);
            deployUrl = indy.module(IndyFoloContentClientModule.class).trackingUrl(buildId, hostedKey);

            logger.info("Using '{}' for {} repository access in build: {}", url, packageType, buildId);
        } catch (IndyClientException e) {
            throw new RepositoryManagerException("Failed to retrieve Indy client module for the artifact tracker: %s", e,
                    e.getMessage());
        }

        boolean tempBuild = buildExecution.isTempBuild();
        String buildPromotionGroup = tempBuild ? TEMP_BUILD_PROMOTION_GROUP : BUILD_PROMOTION_TARGET;
        return new IndyRepositorySession(indy, serviceAccountIndy, buildId, packageType,
                new IndyRepositoryConnectionInfo(url, deployUrl),
                internalRepoPatterns, ignoredPathSuffixes, buildPromotionGroup, tempBuild);
    }
Use the Indy client API to setup global and build-set level repos and groups, then setup the repo/group needed for this
build. Calculate the URL to use for resolving artifacts using the Indy Folo API (Folo is an artifact activity-tracker).
Return a new session ({@link IndyRepositorySession}) containing this information.

@throws RepositoryManagerException In the event one or more repositories or groups can't be created to support the build
(or product, or shared-releases).