mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-09 05:33:51 -05:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60096792a9 | ||
|
|
a599d4e084 | ||
|
|
a5a1f12899 | ||
|
|
766a20ccac | ||
|
|
fe66ba842a | ||
|
|
c06c20394f | ||
|
|
98dafb8ba4 | ||
|
|
2addfca1b4 | ||
|
|
e3b05923ae | ||
|
|
aa4195f8d6 | ||
|
|
1b94629c79 |
3
.github/actions/build-image/action.yml
vendored
3
.github/actions/build-image/action.yml
vendored
@@ -8,7 +8,7 @@ inputs:
|
|||||||
required: true
|
required: true
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -47,5 +47,6 @@ runs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -355,7 +355,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cup"
|
name = "cup"
|
||||||
version = "3.0.2"
|
version = "3.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bollard",
|
"bollard",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -1505,9 +1505,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ring"
|
name = "ring"
|
||||||
version = "0.17.11"
|
version = "0.17.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73"
|
checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cup"
|
name = "cup"
|
||||||
version = "3.0.2"
|
version = "3.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# Cup 🥤
|
# Cup 🥤
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
Cup is the easiest way to check for container image updates.
|
Cup is the easiest way to check for container image updates.
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
BIN
docs/src/app/assets/ha-cup-component.png
Normal file
BIN
docs/src/app/assets/ha-cup-component.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
47
docs/src/content/docs/community-resources/home-assistant.mdx
Normal file
47
docs/src/content/docs/community-resources/home-assistant.mdx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import Image from "next/image";
|
||||||
|
|
||||||
|
import screenshot from "@/app/assets/ha-cup-component.png";
|
||||||
|
|
||||||
|
# Home Assistant integration
|
||||||
|
|
||||||
|
Many thanks to [@bastgau](https://github.com/bastgau) for creating this integration.
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
The **HA Cup Component** integration for Home Assistant allows you to retrieve update statistics for Docker containers directly from your Home Assistant interface.
|
||||||
|
|
||||||
|
With this integration, you can easily track the status of your Docker containers and receive notifications when updates are available.
|
||||||
|
|
||||||
|
The following sensors are currently implemented:
|
||||||
|
|
||||||
|
<Image
|
||||||
|
src={screenshot}
|
||||||
|
alt="Screenshot of Home Assistant showing a card with update information provided by Cup"
|
||||||
|
/>
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Via HACS
|
||||||
|
|
||||||
|
1. Open Home Assistant and go to HACS
|
||||||
|
2. Navigate to "Integrations" and click on "Add a custom repository".
|
||||||
|
3. Use https://github.com/bastgau/ha-cup-component as the URL
|
||||||
|
4. Search for "HA Cup Component" and install it.
|
||||||
|
5. Restart Home Assistant.
|
||||||
|
|
||||||
|
### One-click install
|
||||||
|
|
||||||
|
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=bastgau&repository=ha-cup-component&category=Integration)
|
||||||
|
|
||||||
|
### Manual Installation
|
||||||
|
|
||||||
|
1. Download the integration files from the GitHub repository.
|
||||||
|
2. Place the integration folder in the custom_components directory of Home Assistant.
|
||||||
|
3. Restart Home Assistant.
|
||||||
|
|
||||||
|
## Support & Contributions
|
||||||
|
|
||||||
|
If you encounter any issues or wish to contribute to improving this integration, feel free to open an issue or a pull request in the [GitHub repository](https://github.com/bastgau/ha-cup-component).
|
||||||
|
|
||||||
|
Support the author:
|
||||||
|
[](https://www.buymeacoffee.com/bastgau)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Callout, Cards } from "nextra/components";
|
import { Callout, Cards } from "nextra/components";
|
||||||
import { IconServer, IconTerminal } from "@tabler/icons-react"
|
import { IconServer, IconTerminal } from "@tabler/icons-react";
|
||||||
|
|
||||||
# Integrations
|
# Integrations
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ The data returned from the API or from the CLI is in JSON and looks like this:
|
|||||||
"repository": "sergi0g/cup",
|
"repository": "sergi0g/cup",
|
||||||
"tag": "latest",
|
"tag": "latest",
|
||||||
},
|
},
|
||||||
|
"url": "https://github.com/sergi0g/cup", // The URL specified in the "org.opencontainers.image.url" label, otherwise null
|
||||||
"result": {
|
"result": {
|
||||||
"has_update": true, // `true` when an image has an update of any kind, `false` when up to date and `null` when unknown.
|
"has_update": true, // `true` when an image has an update of any kind, `false` when up to date and `null` when unknown.
|
||||||
"info": {
|
"info": {
|
||||||
@@ -77,3 +78,7 @@ For retrieving the above data, refer to the CLI and server pages:
|
|||||||
href="/docs/usage/server"
|
href="/docs/usage/server"
|
||||||
/>
|
/>
|
||||||
</Cards>
|
</Cards>
|
||||||
|
|
||||||
|
## Refresh Cup
|
||||||
|
|
||||||
|
If you'd like to fetch the latest information, you can manually trigger a refresh by making a `GET` request to the `/api/v3/refresh` endpoint. Once the request completes, you can fetch the data as described above.
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ pub struct VersionInfo {
|
|||||||
pub struct Image {
|
pub struct Image {
|
||||||
pub reference: String,
|
pub reference: String,
|
||||||
pub parts: Parts,
|
pub parts: Parts,
|
||||||
|
pub url: Option<String>,
|
||||||
pub digest_info: Option<DigestInfo>,
|
pub digest_info: Option<DigestInfo>,
|
||||||
pub version_info: Option<VersionInfo>,
|
pub version_info: Option<VersionInfo>,
|
||||||
pub error: Option<String>,
|
pub error: Option<String>,
|
||||||
@@ -61,6 +62,7 @@ impl Image {
|
|||||||
repository,
|
repository,
|
||||||
tag,
|
tag,
|
||||||
},
|
},
|
||||||
|
url: image.url(),
|
||||||
digest_info: Some(DigestInfo {
|
digest_info: Some(DigestInfo {
|
||||||
local_digests,
|
local_digests,
|
||||||
remote_digest: None,
|
remote_digest: None,
|
||||||
@@ -141,6 +143,7 @@ impl Image {
|
|||||||
Update {
|
Update {
|
||||||
reference: self.reference.clone(),
|
reference: self.reference.clone(),
|
||||||
parts: self.parts.clone(),
|
parts: self.parts.clone(),
|
||||||
|
url: self.url.clone(),
|
||||||
result: UpdateResult {
|
result: UpdateResult {
|
||||||
has_update: has_update.to_option_bool(),
|
has_update: has_update.to_option_bool(),
|
||||||
info: match has_update {
|
info: match has_update {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use bollard::secret::{ImageInspect, ImageSummary};
|
|||||||
pub trait InspectData {
|
pub trait InspectData {
|
||||||
fn tags(&self) -> Option<&Vec<String>>;
|
fn tags(&self) -> Option<&Vec<String>>;
|
||||||
fn digests(&self) -> Option<&Vec<String>>;
|
fn digests(&self) -> Option<&Vec<String>>;
|
||||||
|
fn url(&self) -> Option<String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InspectData for ImageInspect {
|
impl InspectData for ImageInspect {
|
||||||
@@ -13,6 +14,16 @@ impl InspectData for ImageInspect {
|
|||||||
fn digests(&self) -> Option<&Vec<String>> {
|
fn digests(&self) -> Option<&Vec<String>> {
|
||||||
self.repo_digests.as_ref()
|
self.repo_digests.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn url(&self) -> Option<String> {
|
||||||
|
match &self.config {
|
||||||
|
Some(config) => match &config.labels {
|
||||||
|
Some(labels) => labels.get("org.opencontainers.image.url").cloned(),
|
||||||
|
None => None,
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InspectData for ImageSummary {
|
impl InspectData for ImageSummary {
|
||||||
@@ -23,4 +34,8 @@ impl InspectData for ImageSummary {
|
|||||||
fn digests(&self) -> Option<&Vec<String>> {
|
fn digests(&self) -> Option<&Vec<String>> {
|
||||||
Some(&self.repo_digests)
|
Some(&self.repo_digests)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn url(&self) -> Option<String> {
|
||||||
|
self.labels.get("org.opencontainers.image.url").cloned()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use super::{parts::Parts, status::Status};
|
|||||||
pub struct Update {
|
pub struct Update {
|
||||||
pub reference: String,
|
pub reference: String,
|
||||||
pub parts: Parts,
|
pub parts: Parts,
|
||||||
|
pub url: Option<String>,
|
||||||
pub result: UpdateResult,
|
pub result: UpdateResult,
|
||||||
pub time: u32,
|
pub time: u32,
|
||||||
pub server: Option<String>,
|
pub server: Option<String>,
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
nodejs 22.8.0
|
|
||||||
@@ -21,6 +21,8 @@ export function CodeBlock({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyText = children instanceof Array ? children.join("") : children;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`group relative flex w-full items-center rounded-lg bg-${theme}-100 px-3 py-2 font-mono text-${theme}-700 dark:bg-${theme}-950 dark:text-${theme}-300`}
|
className={`group relative flex w-full items-center rounded-lg bg-${theme}-100 px-3 py-2 font-mono text-${theme}-700 dark:bg-${theme}-950 dark:text-${theme}-300`}
|
||||||
@@ -35,7 +37,7 @@ export function CodeBlock({
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
className={`duration-50 absolute right-3 bg-${theme}-100 py-1 pl-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-${theme}-950`}
|
className={`duration-50 absolute right-3 bg-${theme}-100 py-1 pl-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-${theme}-950`}
|
||||||
onClick={handleCopy(`docker pull ${children}`)}
|
onClick={handleCopy(`${copyText}`)}
|
||||||
>
|
>
|
||||||
<Clipboard className="size-5" />
|
<Clipboard className="size-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ export default function Image({ data }: { data: Image }) {
|
|||||||
: data.reference;
|
: data.reference;
|
||||||
const info = getInfo(data)!;
|
const info = getInfo(data)!;
|
||||||
let url: string | null = null;
|
let url: string | null = null;
|
||||||
if (clickable_registries.includes(data.parts.registry)) {
|
if (data.url) {
|
||||||
|
url = data.url;
|
||||||
|
} else if (clickable_registries.includes(data.parts.registry)) {
|
||||||
switch (data.parts.registry) {
|
switch (data.parts.registry) {
|
||||||
case "registry-1.docker.io":
|
case "registry-1.docker.io":
|
||||||
url = `https://hub.docker.com/r/${data.parts.repository}`;
|
url = `https://hub.docker.com/r/${data.parts.repository}`;
|
||||||
@@ -82,14 +84,14 @@ export default function Image({ data }: { data: Image }) {
|
|||||||
>
|
>
|
||||||
<div className="mb-4 flex items-center gap-3">
|
<div className="mb-4 flex items-center gap-3">
|
||||||
<Box className={`size-6 shrink-0 text-${theme}-500`} />
|
<Box className={`size-6 shrink-0 text-${theme}-500`} />
|
||||||
<DialogTitle className="font-mono text-black dark:text-white">
|
<DialogTitle className="break-all font-mono text-black dark:text-white">
|
||||||
{url ? (
|
{url ? (
|
||||||
<>
|
<>
|
||||||
<a
|
<a
|
||||||
href={url}
|
href={url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className={`group w-fit text-black hover:underline dark:text-white`}
|
className={`group w-fit hover:underline`}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{data.reference}
|
{data.reference}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export interface Image {
|
|||||||
repository: string;
|
repository: string;
|
||||||
tag: string;
|
tag: string;
|
||||||
};
|
};
|
||||||
|
url: string | null;
|
||||||
result: {
|
result: {
|
||||||
has_update: boolean | null;
|
has_update: boolean | null;
|
||||||
info: VersionInfo | DigestInfo | null;
|
info: VersionInfo | DigestInfo | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user