Class RegistryClient

java.lang.Object
io.jenkins.plugins.oras_artifacts.RegistryClient

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class RegistryClient extends Object
Wraps a Registry
  • Method Details

    • exists

      public boolean exists(String repository, String tag)
      Return whether a manifest exists for the given repository/tag.
    • ensureBuildRoot

      public void ensureBuildRoot(String repository, String tag, String jobFullName, int buildNumber)
      Ensure the build root artifact exists for the given repository/tag, creating it if needed.
    • archiveFile

      public void archiveFile(String repository, String tag, String archivedPath, Path localFile)
      Attach a single archived file as a referrer of the build root artifact.
      Parameters:
      repository - the repository (sanitized job full name)
      tag - the build root tag
      archivedPath - the archived path, relative to the artifacts root (e.g. "dir/file.txt")
      localFile - the local file to upload
    • listArchivedFiles

      public List<RegistryClient.ArchivedFile> listArchivedFiles(String repository, String tag)
      List all files archived for the given repository/tag by querying the OCI referrers API of the build root artifact digest.
    • findArchivedFile

      public Optional<RegistryClient.ArchivedFile> findArchivedFile(String repository, String tag, String path)
      Find a single archived file by its path.
    • openFile

      public InputStream openFile(String repository, String tag, String path) throws IOException
      Open a stream to download the content of an archived file.
      Throws:
      IOException
    • delete

      public boolean delete(String repository, String tag)
      Delete the build root artifact and all its referrers.
      Returns:
      true if something was deleted
    • pushStash

      public void pushStash(String repository, String name, Path tarGz)
      Push a stash (a single tar.gz artifact) under the given repository/name.
    • hasStash

      public boolean hasStash(String repository, String name)
      Whether a stash exists.
    • pullStash

      public void pullStash(String repository, String name, Path target)
      Pull the content of a stash to the given target file.
    • deleteAllStashes

      public void deleteAllStashes(String repository)
      Delete all stashes (tags starting with stash-) for the given repository.
    • testConnection

      public void testConnection(String repository) throws IOException
      Test the connection to the registry by pushing and deleting a small artifact.
      Throws:
      IOException