/** * Look back as far as needed to find a valid BuildData. BuildData * may not be recorded if an exception occurs in the plugin logic. * * @param build build. * @param clone is clone. * @return the last recorded build data */ public BuildData getBuildData(Run build, boolean clone) { BuildData buildData = null; while (build != null) { buildData = build.getAction(BuildData.class); if (buildData != null) { break; } build = build.getPreviousBuild(); } if (buildData == null) { return clone ? new BuildData() : null; } if (clone) { return buildData.clone(); } else { return buildData; } }
/** * Look back as far as needed to find a valid BuildData. BuildData * may not be recorded if an exception occurs in the plugin logic. * * @param build build. * @param clone is clone. * @return the last recorded build data */ public BuildData getBuildData(Run build, boolean clone) { BuildData buildData = null; while (build != null) { buildData = build.getAction(BuildData.class); if (buildData != null) { break; } build = build.getPreviousBuild(); } if (buildData == null) { return clone ? new BuildData() : null; } if (clone) { return buildData.clone(); } else { return buildData; } }
/** * Like {@link #getBuildData(Run)}, but copy the data into a new object, * which is used as the first step for updating the data for the next build. * @param build run whose BuildData is returned * @return copy of build data for build */ public BuildData copyBuildData(Run build) { BuildData base = getBuildData(build); if (base==null) return new BuildData(getScmName(), getUserRemoteConfigs()); else { BuildData buildData = base.clone(); buildData.setScmName(getScmName()); return buildData; } }