code: public static Credentials lookupSystemCredentials(String credentialsId) {
          return firstOrNull(
                  lookupCredentials(
                          Credentials.class,
                          Jenkins.getInstance(),
                          ACL.SYSTEM,
                          emptyList()
                  ),
                  withId(credentialsId)
          );
      }
docs: Util method to find credential by id in jenkins
  
  @param credentialsId credentials to find in jenkins
  @return {@link CertificateCredentials} or {@link StandardUsernamePasswordCredentials} expected