code: @Nonnull
      public static Optional<Secret> secretFor(String credentialsId) {
          List<StringCredentials> creds = filter(
                  lookupCredentials(StringCredentials.class,
                          Jenkins.getInstance(), ACL.SYSTEM,
                          Collections.<DomainRequirement>emptyList()),
                  withId(trimToEmpty(credentialsId))
          );
  
          return FluentIterableWrapper.from(creds)
                  .transform(new NullSafeFunction<StringCredentials, Secret>() {
                      @Override
                      protected Secret applyNullSafe(@Nonnull StringCredentials input) {
                          return input.getSecret();
                      }
                  }).first();
      }
docs: Tries to find {@link StringCredentials} by id and returns secret from it.
  
  @param credentialsId id to find creds
  
  @return secret from creds or empty optional