Example #1
0
  /**
   * Builds up a set of variable names that contain sensitive values that should not be exposed. The
   * expection is that this set is populated with keys returned by {@link #getBuildVariables()} that
   * should have their values masked for display purposes.
   *
   * @since 1.378
   */
  public Set<String> getSensitiveBuildVariables() {
    Set<String> s = new HashSet<String>();

    ParametersAction parameters = getAction(ParametersAction.class);
    if (parameters != null) {
      for (ParameterValue p : parameters) {
        if (p.isSensitive()) {
          s.add(p.getName());
        }
      }
    }

    // Allow BuildWrappers to determine if any of their data is sensitive
    if (project instanceof BuildableItemWithBuildWrappers) {
      for (BuildWrapper bw : ((BuildableItemWithBuildWrappers) project).getBuildWrappersList()) {
        bw.makeSensitiveBuildVariables(this, s);
      }
    }

    return s;
  }