Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tester bot and ci module #248

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -30,6 +30,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':network')
implementation project(':issuetracker')
@@ -21,6 +21,7 @@
* questions.
*/
module org.openjdk.skara.bot {
requires transitive org.openjdk.skara.ci;
requires transitive org.openjdk.skara.host;
requires transitive org.openjdk.skara.issuetracker;
requires transitive org.openjdk.skara.forge;
@@ -22,6 +22,7 @@
*/
package org.openjdk.skara.bot;

import org.openjdk.skara.ci.ContinuousIntegration;
import org.openjdk.skara.forge.HostedRepository;
import org.openjdk.skara.issuetracker.IssueProject;
import org.openjdk.skara.json.JSONObject;
@@ -49,6 +50,13 @@ public interface BotConfiguration {
*/
IssueProject issueProject(String name);

/**
* Configuration-specific name mapped to a ContinuousIntegration.
* @param name
* @return
*/
ContinuousIntegration continuousIntegration(String name);

/**
* Retrieves the ref name that optionally follows the configuration-specific repository name.
* If not configured, returns the name of the VCS default branch.
@@ -22,6 +22,7 @@
*/
package org.openjdk.skara.bot;

import org.openjdk.skara.ci.ContinuousIntegration;
import org.openjdk.skara.forge.*;
import org.openjdk.skara.host.Credential;
import org.openjdk.skara.issuetracker.*;
@@ -42,6 +43,7 @@ public class BotRunnerConfiguration {
private final JSONObject config;
private final Map<String, Forge> repositoryHosts;
private final Map<String, IssueTracker> issueHosts;
private final Map<String, ContinuousIntegration> continuousIntegrations;
private final Map<String, HostedRepository> repositories;

private BotRunnerConfiguration(JSONObject config, Path cwd) throws ConfigurationError {
@@ -50,6 +52,7 @@ private BotRunnerConfiguration(JSONObject config, Path cwd) throws Configuration

repositoryHosts = parseRepositoryHosts(config, cwd);
issueHosts = parseIssueHosts(config, cwd);
continuousIntegrations = parseContinuousIntegrations(config, cwd);
repositories = parseRepositories(config);
}

@@ -118,6 +121,26 @@ private Map<String, IssueTracker> parseIssueHosts(JSONObject config, Path cwd) t
return ret;
}

private Map<String, ContinuousIntegration> parseContinuousIntegrations(JSONObject config, Path cwd) throws ConfigurationError {
Map<String, ContinuousIntegration> ret = new HashMap<>();

if (!config.contains("ci")) {
return ret;
}

for (var entry : config.get("ci").fields()) {
var url = entry.value().get("url").asString();
var ci = ContinuousIntegration.from(URI.create(url), entry.value().asObject());
if (ci.isPresent()) {
ret.put(entry.name(), ci.get());
} else {
throw new ConfigurationError("No continuous integration named with url: " + url);
Copy link
Member

@rwestberg rwestberg Nov 11, 2019

Choose a reason for hiding this comment

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

Suggested change
throw new ConfigurationError("No continuous integration named with url: " + url);
throw new ConfigurationError("No continuous integration could be created from url: " + url);

}
}

return ret;
}

private Map<String, HostedRepository> parseRepositories(JSONObject config) throws ConfigurationError {
Map<String, HostedRepository> ret = new HashMap<>();

@@ -233,6 +256,14 @@ public IssueProject issueProject(String name) {
}
}

@Override
public ContinuousIntegration continuousIntegration(String name) {
if (continuousIntegrations.containsKey(name)) {
return continuousIntegrations.get(name);
}
throw new RuntimeException("Couldn't find continuous integration with name: " + name);
}

@Override
public String repositoryRef(String name) {
try {
@@ -32,6 +32,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':forge')
implementation project(':issuetracker')
@@ -44,8 +44,10 @@ dependencies {
implementation project(':bots:mlbridge')
implementation project(':bots:mirror')
implementation project(':bots:topological')
implementation project(':bots:tester')
implementation project(':bots:submit')
implementation project(':bots:forward')
implementation project(':ci')
implementation project(':vcs')
implementation project(':jcheck')
implementation project(':host')
@@ -74,6 +76,7 @@ images {
'org.openjdk.skara.bots.mlbridge',
'org.openjdk.skara.bots.mirror',
'org.openjdk.skara.bots.submit',
'org.openjdk.skara.bots.tester',
'org.openjdk.skara.bots.topological',
'org.openjdk.skara.bots.forward']
launchers = ['skara-bots': 'org.openjdk.skara.bots.cli/org.openjdk.skara.bots.cli.BotLauncher']
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':bot')
implementation project(':forge')
@@ -32,6 +32,7 @@ module {

dependencies {
implementation project(':bot')
implementation project(':ci')
implementation project(':vcs')
implementation project(':host')
implementation project(':forge')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':forge')
implementation project(':issuetracker')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':forge')
implementation project(':issuetracker')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':bot')
implementation project(':mailinglist')
implementation project(':host')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':host')
implementation project(':network')
implementation project(':bot')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':bot')
implementation project(':forge')
implementation project(':issuetracker')
@@ -31,6 +31,7 @@ module {
}

dependencies {
implementation project(':ci')
implementation project(':bot')
implementation project(':host')
implementation project(':forge')
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

module {
name = 'org.openjdk.skara.bots.tester'
test {
requires 'org.junit.jupiter.api'
requires 'org.openjdk.skara.test'
requires 'org.openjdk.skara.host'
opens 'org.openjdk.skara.bots.tester' to 'org.junit.platform.commons'
}
}

dependencies {
implementation project(':bot')
implementation project(':ci')
implementation project(':census')
implementation project(':forge')
implementation project(':host')
implementation project(':issuetracker')
implementation project(':json')
implementation project(':vcs')

testImplementation project(':test')
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
module org.openjdk.skara.bots.tester {
requires org.openjdk.skara.bot;
requires org.openjdk.skara.vcs;
requires org.openjdk.skara.ci;

requires java.logging;

provides org.openjdk.skara.bot.BotFactory with org.openjdk.skara.bots.tester.TestBotFactory;
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.skara.bots.tester;

enum Stage {
NA,
ERROR,
REQUESTED,
PENDING,
APPROVED,
STARTED,
CANCELLED,
FINISHED
}