Search in sources :

Example 96 with Repository

use of io.fabric8.agent.model.Repository in project fabric8 by fabric8io.

the class DevOpsConnectors method createDevOpsConnector.

/**
 * Returns a DevOpsConnector for the given project repository
 */
public static DevOpsConnector createDevOpsConnector(ProjectRepository project) {
    DevOpsConnector connector = new DevOpsConnector();
    connector.setGitUrl(project.getGitUrl());
    String repoName = project.getRepoName();
    connector.setRepoName(repoName);
    String username = project.getUser();
    connector.setUsername(username);
    String buildName = ProjectRepositories.createBuildName(username, repoName);
    if (project.isGitHubProject()) {
        // lets default the issue tracker
        String url = project.getUrl();
        if (Strings.isNotBlank(url)) {
            connector.setIssueTrackerUrl(URLUtils.pathJoin(url, "issues"));
            connector.setTeamUrl(URLUtils.pathJoin(url, "graphs/contributors"));
            connector.setReleasesUrl(URLUtils.pathJoin(url, "tags"));
            connector.setRepositoryBrowseLink(url);
        }
        ProjectConfig config = ProjectConfigs.loadFromUrl(URLUtils.pathJoin(url, "blob/master/fabric8.yml"));
        if (config == null) {
            config = new ProjectConfig();
            // lets add a dummy build so we can at least build snapshots on demand in OpenShift
            config.setPipeline("maven/Deploy.groovy");
        }
        config.setBuildName(buildName);
        connector.setProjectConfig(config);
        connector.setRegisterWebHooks(false);
        System.out.println("Created config " + config.getBuildName() + " with flow " + config.getPipeline());
    }
    return connector;
}
Also used : ProjectConfig(io.fabric8.devops.ProjectConfig)

Example 97 with Repository

use of io.fabric8.agent.model.Repository in project fabric8 by fabric8io.

the class BuildConfigHelper method createAndApplyBuildConfig.

/**
 * Returns the created BuildConfig for the given project name and git repository
 */
public static BuildConfig createAndApplyBuildConfig(KubernetesClient kubernetesClient, String namespace, String projectName, String cloneUrl, Map<String, String> annotations) {
    BuildConfig buildConfig = createBuildConfig(kubernetesClient, namespace, projectName, cloneUrl, annotations);
    Controller controller = new Controller(kubernetesClient);
    controller.setNamespace(namespace);
    controller.applyBuildConfig(buildConfig, "from project " + projectName);
    return buildConfig;
}
Also used : BuildConfig(io.fabric8.openshift.api.model.BuildConfig) Controller(io.fabric8.kubernetes.api.Controller)

Aggregations

File (java.io.File)49 Test (org.junit.Test)32 Git (org.eclipse.jgit.api.Git)30 GitPatchRepository (io.fabric8.patch.management.impl.GitPatchRepository)27 IOException (java.io.IOException)24 GitPatchManagementServiceImpl (io.fabric8.patch.management.impl.GitPatchManagementServiceImpl)20 HashMap (java.util.HashMap)15 ObjectId (org.eclipse.jgit.lib.ObjectId)13 MalformedURLException (java.net.MalformedURLException)11 Map (java.util.Map)11 ArrayList (java.util.ArrayList)10 PatchException (io.fabric8.patch.management.PatchException)9 RevCommit (org.eclipse.jgit.revwalk.RevCommit)8 Bundle (org.osgi.framework.Bundle)8 Version (org.osgi.framework.Version)8 MavenResolver (io.fabric8.maven.MavenResolver)7 HashSet (java.util.HashSet)7 Repository (io.fabric8.agent.model.Repository)6 BundleContext (org.osgi.framework.BundleContext)6 Feature (io.fabric8.agent.model.Feature)5