本文整理汇总了Java中hudson.scm.SCMRevisionState类的典型用法代码示例。如果您正苦于以下问题:Java SCMRevisionState类的具体用法?Java SCMRevisionState怎么用?Java SCMRevisionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SCMRevisionState类属于hudson.scm包,在下文中一共展示了SCMRevisionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* Method that is first called when a build is run. All dataset retrieval stems from here.
*
* @param launcher
* the machine that the files will be checked out
* @param workspaceFilePath
* a directory to check out the source code
* @param listener
* build listener
* @param changelogFile
* upon a successful return, this file should capture the changelog. When there's no change, this file should
* contain an empty entry
* @param baseline
* used for polling (this parameter is not used)
*
* @throws IOException
* @throws InterruptedException
*/
@Override
public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspaceFilePath, TaskListener listener,
File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException
{
boolean rtnValue = false;
try
{
validateParameters(launcher, listener, build.getParent());
PdsDownloader downloader = new PdsDownloader(this);
rtnValue = downloader.getSource(build, launcher, workspaceFilePath, listener, changelogFile);
if (!rtnValue)
{
throw new AbortException();
}
}
catch (IllegalArgumentException e)
{
listener.getLogger().println(e.getMessage());
throw new AbortException();
}
}
示例2: checkout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* Method that is first called when a build is run. All dataset retrieval stems from here.
*
* @param launcher
* the machine that the files will be checked out
* @param workspaceFilePath
* a directory to check out the source code
* @param listener
* build listener
* @param changelogFile
* upon a successful return, this file should capture the change log. When there's no change, this file should
* contain an empty entry
* @param baseline
* used for polling (we do not use this parameter)
*
* @throws IOException
* @throws InterruptedException
*/
@Override
public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspaceFilePath, TaskListener listener,
File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException
{
boolean rtnValue = false;
try
{
validateParameters(launcher, listener, build.getParent());
EndevorDownloader downloader = new EndevorDownloader(this);
rtnValue = downloader.getSource(build, launcher, workspaceFilePath, listener, changelogFile);
if (!rtnValue)
{
throw new AbortException();
}
}
catch (IllegalArgumentException e)
{
listener.getLogger().println(e.getMessage());
throw new AbortException();
}
}
示例3: checkout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* Method that is first called when a build is run. All dataset retrieval stems from here.
*
* @param launcher
* The machine that the files will be checked out.
* @param workspaceFilePath
* a directory to check out the source code.
* @param listener
* Build listener
* @param changelogFile
* Upon a successful return, this file should capture the changelog. When there's no change, this file should
* contain an empty entry
* @param baseline
* used for polling - this parameter is not used
*
* @throws IOException
* @throws InterruptedException
*/
@Override
public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspaceFilePath, TaskListener listener,
File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException
{
boolean rtnValue = false;
try
{
validateParameters(launcher, listener, build.getParent());
IspwDownloader downloader = new IspwDownloader(this);
rtnValue = downloader.getSource(build, launcher, workspaceFilePath, listener, changelogFile);
if (!rtnValue)
{
throw new AbortException();
}
}
catch (IllegalArgumentException e)
{
listener.getLogger().println(e.getMessage());
throw new AbortException();
}
}
示例4: calcRevisionsFromBuild
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> build,
FilePath workspace, Launcher launcher, TaskListener listener)
throws IOException, InterruptedException {
EnvVars env = build.getEnvironment(listener);
listener.getLogger().println(
String.format(MessageConstants.SCM_CALC, DISPLAY_NAME,
getImageStreamName(env), tag, getNamespace(env)));
String commitId = lastCommitId;
ImageStreamRevisionState currIMSState = null;
if (commitId != null) {
currIMSState = new ImageStreamRevisionState(commitId);
listener.getLogger().println(
String.format(MessageConstants.SCM_LAST_REV,
currIMSState.toString()));
} else {
currIMSState = new ImageStreamRevisionState("");
listener.getLogger().println(MessageConstants.SCM_NO_REV);
}
return currIMSState;
}
示例5: compareRemoteRevisionWith
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
protected PollingResult compareRemoteRevisionWith(
final AbstractProject<?, ?> project,
final Launcher launcher,
final FilePath filePath,
final TaskListener listener,
final SCMRevisionState revisionState)
throws IOException, InterruptedException {
final ActionTypeId actionTypeId = new ActionTypeId()
.withCategory(actionTypeCategory)
.withOwner(ActionOwner.Custom)
.withProvider(actionTypeProvider)
.withVersion(actionTypeVersion);
LoggingHelper.log(listener, "Polling for jobs for action type id: ["
+ "Owner: %s, Category: %s, Provider: %s, Version: %s, ProjectName: %s]",
actionTypeId.getOwner(),
actionTypeId.getCategory(),
actionTypeId.getProvider(),
actionTypeId.getVersion(),
projectName);
return pollForJobs(actionTypeId, listener);
}
示例6: checkout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
public void checkout(Run<?,?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException {
// If necessary, delete destination directory so we can install Drupal (unless Drupal root is workspace root).
File rootDir = new File(workspace.getRemote(), root);
FilePath rootPath = new FilePath(rootDir);
if (rootDir.exists() && !rootPath.getRemote().equals(workspace.getRemote())) {
listener.getLogger().println("[DRUPAL] Deleting destination directory "+rootDir.getAbsolutePath());
// Make sure drupal/sites/defaults is writable so we can delete its contents.
File defaultDir = new File(rootDir, "sites/default");
defaultDir.setWritable(true);
FileUtils.deleteDirectory(rootDir);
}
// Save Makefile into local file.
File makefileFile = new File(workspace.getRemote(), MAKEFILE_FILE);
listener.getLogger().println("[DRUPAL] Saving Makefile into "+makefileFile.getAbsolutePath());
FileUtils.writeStringToFile(makefileFile, makefile);
// Make Drupal.
DrushInvocation drush = new DrushInvocation(rootPath, workspace, launcher, listener, build.getEnvironment(listener));
drush.make(makefileFile);
}
示例7: getCurrentRevisionState
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* This method returns the current remote revision state.
*
* The technique being used is to parse the RSS feed that is provided by the
* fossil server.
*
* @return current remote revision state
* @throws IOException
* @throws InterruptedException
*/
private SCMRevisionState getCurrentRevisionState() throws IOException, InterruptedException {
StringBuffer rss = new StringBuffer(100000); // arbitrarily large initial buffer. Should a StringBuilder be used instead?
URL url = new URL(getAuthenticatedServerUrl() + "/timeline.rss?y=ci&n=0");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
rss.append(inputLine);
}
in.close();
return FossilRSSParser.parse(rss.toString());
}
示例8: onCheckout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
public void onCheckout(Run<?, ?> build, SCM scm, FilePath workspace, TaskListener listener, File changelogFile,
SCMRevisionState pollingBaseline) throws Exception {
try {
sendNotifications(build, listener);
} catch (IOException | InterruptedException e) {
e.printStackTrace(listener.error("Could not send notifications"));
}
}
示例9: calcRevisionsFromBuild
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* See documentation at top of class.
* This function will determine the state of the local files from the
* previous build
*/
@Override
public SCMRevisionState calcRevisionsFromBuild(AbstractBuild<?,?> build,
Launcher launcher, TaskListener listener)
throws IOException, InterruptedException
{
LOGGER.log(FINE, "Calculating revisions from build");
// First find the last build that had a version file
for (AbstractBuild<?,?> b=build; b!=null; b=b.getPreviousBuild())
{
if (getVersionsFile(b).exists())
{
build = b;
break;
}
}
File file = getVersionsFile(build);
ArtifactoryRevisionState revState = ArtifactoryRevisionState.BASE;
if (!file.exists())
{
// The file doesn't exist for the first build, return the base value
LOGGER.log(WARNING, "No previous build contained a versions file");
return revState;
}
else
{
revState = ArtifactoryRevisionState.fromFile(file);
}
return revState;
}
示例10: compareRemoteRevisionWith
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* See documentation top of class
* This function will determine the state of the artifactory server and compare it with the
* local state. If there is a condition where a build needs to be triggered, trigger a build
*/
@Override
public PollingResult compareRemoteRevisionWith(AbstractProject<?,?> project,
Launcher launcher, FilePath workspace, TaskListener listener,
SCMRevisionState baseline) throws IOException, InterruptedException
{
LOGGER.log(FINE, "Comparing remote revisions with baseline");
ArtifactoryRevisionState localState = (ArtifactoryRevisionState) baseline;
ArtifactoryAPI api = new ArtifactoryAPI(getDescriptor().getArtifactoryServer());
ArtifactoryRevisionState serverState = ArtifactoryRevisionState.fromServer(repo, groupID, artifactID, versionFilter, api);
//Compare server state to local state
nextArtifact = ArtifactoryRevisionState.compareRevisionStates(serverState, localState);
if (nextArtifact != null)
{
LOGGER.log(FINE, "Found new data for version: " + nextArtifact);
return PollingResult.BUILD_NOW;
}
// Compare local state to server state
nextArtifact = ArtifactoryRevisionState.compareRevisionStates(localState, serverState);
if (nextArtifact != null)
{
LOGGER.log(FINE, "Found new data for version: " + nextArtifact);
return PollingResult.BUILD_NOW;
}
return PollingResult.NO_CHANGES;
}
示例11: calcRevisionsFromBuild
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* Calculates any revisions from previous builds. Method required to support Pipeline. We handle file changes in the CLI.
*/
@Override
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener)
throws IOException, InterruptedException
{
return null;
}
示例12: calcRevisionsFromBuild
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
/**
* Calculates any revisions from previous builds. Method required to support Pipeline. We handle file changes in the CLI.
*/
@Override
public SCMRevisionState calcRevisionsFromBuild(Run<?, ?> build, FilePath workspace, Launcher launcher,
TaskListener listener) throws IOException, InterruptedException
{
return null;
}
示例13: checkout
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
public void checkout(Run<?, ?> build, Launcher launcher,
FilePath workspace, TaskListener listener, File changelogFile,
SCMRevisionState baseline) throws IOException, InterruptedException {
boolean chatty = Boolean.parseBoolean(verbose);
String bldName = null;
if (build != null)
bldName = build.getDisplayName();
if (chatty)
listener.getLogger().println(
"\n\nOpenShiftImageStreams checkout called for " + bldName);
EnvVars env = build.getEnvironment(listener);
lastCommitId = getCommitId(listener, env);
if (lastCommitId == null) {
String imageStream = getImageStreamName(env);
String tag = getTag(env);
listener.getLogger().println(
String.format(MessageConstants.SCM_IMAGESTREAM_NOT_FOUND,
imageStream, tag));
// We cannot yet throw an exception here because the calling code
// will be interrupted and the SCM action
// will not be added to the build job.
// Just setting the build result here. An exception will be thrown
// in the postCheckout method.
build.setResult(Result.FAILURE);
}
}
示例14: compareRemoteRevisionInternal
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
protected PollingResult compareRemoteRevisionInternal(EnvVars env,
Launcher launcher, TaskListener listener, SCMRevisionState baseline) {
listener.getLogger().println(
String.format(MessageConstants.SCM_COMP, DISPLAY_NAME,
getImageStreamName(env), tag, getNamespace(env)));
String commitId = this.getCommitId(listener, env);
ImageStreamRevisionState currIMSState = null;
if (commitId != null)
currIMSState = new ImageStreamRevisionState(commitId);
boolean chatty = Boolean.parseBoolean(verbose);
if (chatty)
listener.getLogger().println(
"\n\nOpenShiftImageStreams compareRemoteRevisionWith comparing baseline "
+ baseline + " with lastest " + currIMSState);
boolean changes = false;
if (baseline != null && baseline instanceof ImageStreamRevisionState
&& currIMSState != null)
changes = !currIMSState.equals(baseline);
if (baseline == null && currIMSState != null) {
changes = true;
}
if (changes) {
lastCommitId = commitId;
listener.getLogger().println(MessageConstants.SCM_CHANGE);
} else {
listener.getLogger().println(MessageConstants.SCM_NO_CHANGE);
}
return new PollingResult(baseline, currIMSState,
changes ? Change.SIGNIFICANT : Change.NONE);
}
示例15: compareRemoteRevisionWith
import hudson.scm.SCMRevisionState; //导入依赖的package包/类
@Override
public PollingResult compareRemoteRevisionWith(@Nonnull Job<?, ?> project,
@Nullable Launcher launcher, @Nullable FilePath workspace,
@Nonnull TaskListener listener, @Nonnull SCMRevisionState baseline)
throws IOException, InterruptedException {
return compareRemoteRevisionInternal(
project.getEnvironment(null, listener), launcher, listener,
baseline);
}