@Exported(name="status",visibility=9) // because stapler notices suffix 's' and remove it public Status getStatus() { if (skipped) { return Status.SKIPPED; } FlakyCaseResult pr = getPreviousResult(); if(pr==null) { return isPassed() ? Status.PASSED : Status.FAILED; } if(pr.isPassed()) { return isPassed() ? Status.PASSED : Status.REGRESSION; } else { return isPassed() ? Status.FIXED : Status.FAILED; } }
/** * Returns {@code true} if and only if a one click deployment is valid. In other words * {@link #isOneClickDeployPossible()} says there are artifacts for deployment. {@link #isOneClickDeployValid()} * says the configured one click deploy is fully defined and {@link #isOneClickDeploy()} says that the user * has enabled one click deploy for the project. * * @return {@code true} if and only if a one click deployment is valid. */ @SuppressWarnings("unused") // used by stapler @Exported(name = "oneClickDeployValid", visibility = 2) public boolean isOneClickDeployValid() { if (owner != null && owner.hasPermission(DEPLOY)) { DeployNowJobProperty property = owner.getProperty(DeployNowJobProperty.class); if (property != null) { if (property.isOneClickDeploy()) { if (owner.hasPermission(OWN_AUTH) && DeployHost.isValid(property.getHosts(), owner, Hudson.getAuthentication())) { return true; } if (owner.hasPermission(JOB_AUTH) && DeployHost.isValid(property.getHosts(), owner, ACL.SYSTEM)) { return true; } } } } return false; }
@Exported(name = "oneClickDeployValid", visibility = 2) public boolean isOneClickDeployValid() { if (owner != null && owner.getParent().hasPermission(DEPLOY)) { DeployNowJobProperty property = owner.getParent().getProperty(DeployNowJobProperty.class); if (property != null) { if (property.isOneClickDeploy()) { List<? extends DeployHost<?, ?>> sets = property.getHosts(); if (owner.getParent().hasPermission(OWN_AUTH) && DeployHost .isValid(sets, owner, Hudson.getAuthentication())) { return true; } if (owner.getParent().hasPermission(JOB_AUTH) && DeployHost.isValid(sets, owner, ACL.SYSTEM)) { return true; } } } } return false; }
@Exported public List<String> getChoices() { String def = defaultValue; try { AbstractProject project = CurrentProject.getCurrentProject(this); AbstractBuild build = (successfulOnly ? (AbstractBuild)project.getLastSuccessfulBuild() : project.getLastBuild()); def = build.getBuildVariables().get(getName()).toString(); } catch(Exception ex) { } if(def != null && choices.indexOf(def) != 0) { List<String> c = new ArrayList<String>(choices); c.remove(def); c.add(0, def); return c; } return choices; }
@Override @Exported public Executor getExecutor() { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { return null; } for (final Computer computer : jenkins.getComputers()) { for (final Executor executor : computer.getExecutors()) { if (isCurrent(executor)) { return executor; } } } return null; }
@Exported public Iterable<Map> getAxisList() { final Iterable<Combination> layoutList = this.build.getLayouter().list(); final Iterable<Map> subBuildInfo = Iterables.transform(layoutList, new Function<Combination, Map>() { @Override public Map apply(@Nullable final Combination combination) { final HashMap subBuild = new HashMap(); subBuild.putAll(combination); final hudson.model.Build run = ProcessedBuild.this.build.getRun(combination); subBuild.putAll(getSubBuildInfo((DbBackedBuild) run)); return subBuild; } }); final ArrayList<Map> subBuilds = Iterables.size(layoutList) > 1 ? Lists.newArrayList(subBuildInfo) : new ArrayList<>(); subBuilds.add(getMainBuildInfo(this.build)); return subBuilds; }
@Exported public Session getSession() { if (sessionId == null || sessionId.isEmpty() || run == null) { return null; } BuildWrapperItem<BrowserStackBuildWrapper> wrapperItem = BrowserStackBuildWrapper.findBrowserStackBuildWrapper(run.getParent()); if (wrapperItem == null || wrapperItem.buildWrapper == null) { return null; } BrowserStackCredentials credentials = BrowserStackCredentials.getCredentials(wrapperItem.buildItem, wrapperItem.buildWrapper.getCredentialsId()); if (credentials == null) { return null; } AutomateClient automateClient = new AutomateClient(credentials.getUsername(), credentials.getDecryptedAccesskey()); Session activeSession = null; try { activeSession = automateClient.getSession(this.sessionId); Analytics.trackIframeRequest(); } catch (AutomateException aex) { lastException = aex; return null; } catch (SessionNotFound snfEx) { lastException = snfEx; return null; } return activeSession; }
@Exported public String getAccessToken() { MaidsafeJenkinsBuilder.DescriptorImpl descriptor; descriptor = (MaidsafeJenkinsBuilder.DescriptorImpl) Jenkins.getInstance().getDescriptor( MaidsafeJenkinsBuilder.class); return descriptor.getGithubToken(); }
@Exported(visibility = 999) public Hashtable<String, RangeSet> getUsages() { Hashtable<String, RangeSet> res = new Hashtable<String, RangeSet>(fingerprint.getUsages().size()); for (Map.Entry<String, Fingerprint.RangeSet> set : fingerprint.getUsages().entrySet()) { res.put(set.getKey(), new RangeSet(set.getValue())); } return res; }
@Exported public synchronized @Nonnull List<DockerAPIReport> records() { if (containerIDs == null) { return Collections.emptyList(); } final List<DockerAPIReport> res = new ArrayList<DockerAPIReport>(containerIDs.size()); for (String containerId : containerIDs) { DockerAPIReport apiReport = DockerAPIReport.forContainer(containerId); if (apiReport != null) { res.add(apiReport); } } return res; }
/** * The stderr of this test. * * @see #getStdout() * @since 1.294 */ @Exported public String getStderr() { if(stderr!=null) return stderr; FlakySuiteResult sr = getSuiteResult(); if (sr==null) return ""; return getSuiteResult().getStderr(); }
@Exported(visibility = 999) public String getName() { int idx = className.lastIndexOf('.'); if (idx < 0) { return className; } else { return className.substring(idx + 1); } }
@Exported(visibility=999) @Override public int getFailCount() { if(failedTests==null) return 0; else return failedTests.size(); }
/** * Returns the last successful build, if any. Otherwise null. A successful build would include * either {@link Result#SUCCESS} or {@link Result#UNSTABLE}. * * @return the build or null * @see #getLastStableBuild() */ @SuppressWarnings(UNUSED) @CheckForNull @Exported public Run getLastSuccessfulBuild() { Run retVal = null; for (Job job : getAllJobs()) { retVal = takeLast(retVal, job.getLastSuccessfulBuild()); } return retVal; }
/** * Returns the last build that was anything but stable, if any. Otherwise null. * * @return the build or null * @see #getLastSuccessfulBuild */ @SuppressWarnings(UNUSED) @CheckForNull @Exported public Run getLastUnsuccessfulBuild() { Run retVal = null; for (Job job : getAllJobs()) { retVal = takeLast(retVal, job.getLastUnsuccessfulBuild()); } return retVal; }
/** * Returns the last unstable build, if any. Otherwise null. * * @return the build or null * @see #getLastSuccessfulBuild */ @SuppressWarnings(UNUSED) @CheckForNull @Exported public Run getLastUnstableBuild() { Run retVal = null; for (Job job : getAllJobs()) { retVal = takeLast(retVal, job.getLastUnstableBuild()); } return retVal; }
/** * Returns the last completed build, if any. Otherwise null. * * @return the build or null */ @SuppressWarnings(UNUSED) @CheckForNull @Exported public Run getLastCompletedBuild() { Run retVal = null; for (Job job : getAllJobs()) { retVal = takeLast(retVal, job.getLastCompletedBuild()); } return retVal; }
@Exported public String getAvatarUrl() { if (this.avatarUrl == null) { if (this.committerEmail == null) return null; final byte[] md5 = DigestUtils.md5(this.committerEmail); final String emailDigest = new BigInteger(1, md5).toString(16); return "https://secure.gravatar.com/avatar/" + emailDigest + ".png?"; } return this.avatarUrl; }
@Exported(name="totalFindings") public int getFindings() { int findings = 0; for(CodeDxGroupStatistics it : statistics) { findings += it.getFindings(); } return findings; }
@Exported public List<JobMetric> getMetrics() { final StaplerRequest req = Stapler.getCurrent().getCurrentRequest(); final String branchTab = req.getParameter("branchTab"); final String buildCount = req.getParameter("count"); return JobMetric.getApplicableJobMetrics(this.dynamicProject, branchTab, Integer.parseInt(buildCount)); }
@Exported @NonNull public final BranchSCMRevision getOrigin() { return origin; }
@Exported public String getRunFile(){ return runFile; }
@Exported public int getVersion() { return version; }
@Exported public URL getURL() { return url; }
@Override @Exported public String getMsg() { return new String(""); }
@Exported public String getSecretKey() { return secretKey; }
@Exported public java.util.Map warning_types(){ return BanditPublisher.warning_types; }
@Exported public String getUsername() { return username; }
@Exported public Secret getAccesskey() { return accesskey; }
@NonNull @Exported public String getDescription() { return description; }
@NonNull @Exported public String getId() { return id; }
@Exported public String getLastError() { return (lastException != null) ? lastException.getMessage() : null; }
@Exported public AbstractCloudDeployment getDeployment() { return deployment; }
/** * The type of cloud deployment the user wants to deploy for the scope of the build. */ @Exported public AbstractCloudDeployment getDeployment() { return deployment; }
@Exported public HashMap<String, Object> getCheckoutSummary() { return checkoutSummary; }
@Exported public String getProjectName() { return project.getName(); }
@Exported public String getOrgName() { return getValueFromConfig("orgName"); }
@Exported public String getSuperProjectName() { return getValueFromConfig("superProjectName"); }
@Exported public String getDefaultBaseBranch() { return getValueFromConfig("defaultBaseBranch"); }
@Exported public HashMap<String, Object> getGithubCheckoutAction() { return getSummary(); }