An open API service indexing awesome lists of open source software.

https://github.com/cmdjulian/kirc

Sync / Coroutines / Reactive Container Registry Client written in Kotlin ready for GraalVM 🐋
https://github.com/cmdjulian/kirc

coroutines docker fuel java jvm kotlin oci projectreactor reactive registry

Last synced: 9 months ago
JSON representation

Sync / Coroutines / Reactive Container Registry Client written in Kotlin ready for GraalVM 🐋

Awesome Lists containing this project

README

          

[![](https://jitpack.io/v/cmdjulian/kirc.svg)](https://jitpack.io/#cmdjulian/kirc)

# kirc - (k)container image registry client

![kirc](./logo.png)

Kotlin client utilizing CoRoutines and Fuel to interact with the Container Registry API V2.
It supports all the read operations from the spec and can not only handle docker format but also oci.
The library is compatible with GraalVM and does already include the required reflection configs.

## Overview

A client can be obtained by the factory pattern from `{MODULE}ContainerImageClientFactory`.
After initializing the client, we can also pin it to a specific container image (repository and reference like Tag or
Digest) and make it an `ContainerImageClient` with the `.toImageClient()` function. This client is then used to interact
with a specific Image and provides some Image specific functions like the compressed size.

The library throws a dedicated error type to report back on exceptions for the different calls. It wraps a specific
instance of `RegistryClientException` for all errors. These errors are than divided into

1. a more general `ClientErrorException` like if a manifest was tried to be retrieved but didn't exist
(`ClientErrorException.NotFoundException`)
2. network related errors (`NetworkError`) like HostNotFound or SSL related errors
3. unexpected errors (`UnknownError`)

As authentication schema JWT auth and BasicAuth are supported. Currently, there are no plans to implement certificate
based authentication.

The Registry communication can be done using either `HTTP` or `HTTPS`. The library is also able to use a proxy for the
communication.

## Functionality

### Implemented

- ping
- list images
- list tags
- retrieve blob
- exists manifest
- retrieve manifest
- delete manifest
- download image
- inspect image

## Modules

The lib is published in three different flavors. All of them are based up on kotlins coroutines. All modules
transitively include the [suspending module](#suspending).

### Blocking

This module provides as the main entry point as `BlockingClientFactory`. All requests are blocking the current Thread.

Gradle

```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.cmdjulian.kirc:blocking:{VERSION}'
}
```

Gradle Kts

```kotlin
repositories {
maven(url = "https://jitpack.io")
}

dependencies {
implementation("com.github.cmdjulian.kirc:blocking:{VERSION}")
}
```

Maven

```xml

...



jitpack.io
https://jitpack.io

...



com.github.cmdjulian.kirc
blocking
{VERSION}

```

### Reactive

This module provides as the main entry point as `ReactiveClientFactory`. It uses the kotlin extension functions to
return project reactor types.

Gradle

```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.cmdjulian.kirc:reactive:{VERSION}'
}
```

Gradle Kts

```kotlin
repositories {
maven(url = "https://jitpack.io")
}

dependencies {
implementation("com.github.cmdjulian.kirc:reactive:{VERSION}")
}
```

Maven

```xml

...



jitpack.io
https://jitpack.io

...



com.github.cmdjulian.kirc
reactive
{VERSION}

```

### Suspending

This module provides as the main entry point as `SuspendingClientFactory`. It uses the kotlin coroutines to do the
requests.

Gradle

```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.cmdjulian.kirc:suspending:{VERSION}'
}
```

Gradle Kts

```kotlin
repositories {
maven(url = "https://jitpack.io")
}

dependencies {
implementation("com.github.cmdjulian.kirc:suspending:{VERSION}")
}
```

Maven

```xml

...



jitpack.io
https://jitpack.io

...



com.github.cmdjulian.kirc
suspending
{VERSION}

```

### Image

This module is transitively included from all the above modules. It's main purpose is to provide the components to parse
container image names. It's mainly packaged in its own module to be included without any of the aforementioned modules.

Gradle

```groovy
repositories {
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.github.cmdjulian.kirc:image:{VERSION}'
}
```

Gradle Kts

```kotlin
repositories {
maven(url = "https://jitpack.io")
}

dependencies {
implementation("com.github.cmdjulian.kirc:image:{VERSION}")
}
```

Maven

```xml

...



jitpack.io
https://jitpack.io

...



com.github.cmdjulian.kirc
image
{VERSION}

```