mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-12 15:13:49 -05:00
Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aeef51961 | ||
|
|
b015f67da4 | ||
|
|
0f0941b555 | ||
|
|
fa2629bb4f | ||
|
|
e2cc245a50 | ||
|
|
ce26ba8926 | ||
|
|
f268edf021 | ||
|
|
b378e472d6 | ||
|
|
d841861752 | ||
|
|
4caa117a4e | ||
|
|
02c5d00e66 | ||
|
|
040513dfd7 | ||
|
|
ad03004f33 | ||
|
|
becf647f07 | ||
|
|
c437316291 | ||
|
|
2461f3b94b | ||
|
|
dd64b62f4b | ||
|
|
d77871cd92 | ||
|
|
c3dd4d2462 | ||
|
|
3cfa4771eb | ||
|
|
14f3f1d19b | ||
|
|
94a65f204d | ||
|
|
8d0da37e36 | ||
|
|
780d7a088d | ||
|
|
bcb9f63735 | ||
|
|
4d691dd5fa | ||
|
|
685219ea62 | ||
|
|
756462cd7c | ||
|
|
f020ac0906 | ||
|
|
4b03a48d88 | ||
|
|
ba1cfac64b | ||
|
|
05d4c7c630 | ||
|
|
cf22ec300f | ||
|
|
5b428dbf67 | ||
|
|
787a730ab5 | ||
|
|
925989fd80 | ||
|
|
5656003058 | ||
|
|
f79d7ff03a | ||
|
|
550fb955a3 | ||
|
|
6ae95bf83b | ||
|
|
2262df0355 | ||
|
|
1beb7dc020 | ||
|
|
a0de565367 | ||
|
|
0314ef2f05 | ||
|
|
f1c8a45122 | ||
|
|
ce3f8176f1 | ||
|
|
8b520182ed | ||
|
|
e8fee79d20 | ||
|
|
24f160803a | ||
|
|
2ef77c9a55 | ||
|
|
a5bbdd0e33 | ||
|
|
b5aa0309ee | ||
|
|
4bbb53cd67 | ||
|
|
3ac6fb57e9 | ||
|
|
ead74dadd6 | ||
|
|
6e6afdb757 | ||
|
|
0c10134829 | ||
|
|
c0c7f7c0e9 | ||
|
|
aeeffaccba | ||
|
|
a1711b7ac8 | ||
|
|
9d628e3ab2 | ||
|
|
d3b18a6587 | ||
|
|
76a812f52f | ||
|
|
fe779c9c4e | ||
|
|
84609d5189 | ||
|
|
ded441cf75 | ||
|
|
0a8295fff4 | ||
|
|
9c8e6ccdea | ||
|
|
f1e1bcbf1c | ||
|
|
31f7bfbbcb | ||
|
|
15eb553e50 | ||
|
|
359147770f | ||
|
|
0a4e302322 | ||
|
|
5ed64c92fd | ||
|
|
6d08d75ac3 | ||
|
|
dc38b84e87 | ||
|
|
09b6880295 | ||
|
|
4f1075b2b2 | ||
|
|
c84270603f | ||
|
|
4aa28f2cc5 | ||
|
|
eadda5f776 | ||
|
|
622b156eed | ||
|
|
dca19b5ae2 | ||
|
|
f6ac43aac0 | ||
|
|
e5e60c4abc | ||
|
|
33a72c8c0d | ||
|
|
e544ef6ca5 | ||
|
|
afc34a0847 | ||
|
|
ce08e00bb4 | ||
|
|
6a77b85141 | ||
|
|
215e88ae0f | ||
|
|
178acfb2f6 | ||
|
|
59894343de | ||
|
|
61bc60493f | ||
|
|
be7d55d126 | ||
|
|
36a3a13c04 | ||
|
|
d85fadfb39 | ||
|
|
0f95be26dc | ||
|
|
0b7e064980 | ||
|
|
9e9bb78db7 | ||
|
|
88d346b480 | ||
|
|
4519c534a1 | ||
|
|
6b83f51749 | ||
|
|
0c3f293fa8 | ||
|
|
d94abecf35 | ||
|
|
c11b5e6432 | ||
|
|
022dc0b2cb | ||
|
|
51609da4ff | ||
|
|
3ed79e69bd | ||
|
|
078a51c4fa | ||
|
|
8d70d7ae4d | ||
|
|
6d45409928 | ||
|
|
bcfb9ef27a | ||
|
|
5c4de36052 | ||
|
|
eda30229e2 | ||
|
|
8fd012efbe | ||
|
|
8ab073d562 |
12
.github/actions/build-image/Dockerfile
vendored
12
.github/actions/build-image/Dockerfile
vendored
@@ -1,12 +0,0 @@
|
|||||||
FROM --platform=$BUILDPLATFORM alpine AS builder
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
ARG TARGETOS
|
|
||||||
|
|
||||||
COPY binaries/* /
|
|
||||||
RUN mv cup-$TARGETOS-$TARGETARCH cup
|
|
||||||
RUN chmod +x cup
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
COPY --from=builder /cup /cup
|
|
||||||
ENTRYPOINT ["/cup"]
|
|
||||||
52
.github/actions/build-image/action.yml
vendored
52
.github/actions/build-image/action.yml
vendored
@@ -1,52 +0,0 @@
|
|||||||
name: Build Image
|
|
||||||
inputs:
|
|
||||||
tags:
|
|
||||||
description: "Docker image tags"
|
|
||||||
required: true
|
|
||||||
gh-token:
|
|
||||||
description: "Github token"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Download binaries
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: .
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
ghcr.io/sergi0g/cup
|
|
||||||
tags: ${{ inputs.tags }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: sergi0g
|
|
||||||
password: ${{ inputs.gh-token }}
|
|
||||||
|
|
||||||
- name: Build and push image
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./.github/actions/build-image/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
34
.github/workflows/nightly.yml
vendored
34
.github/workflows/nightly.yml
vendored
@@ -62,24 +62,38 @@ jobs:
|
|||||||
cup-linux-arm64
|
cup-linux-arm64
|
||||||
|
|
||||||
build-image:
|
build-image:
|
||||||
needs:
|
needs: get-tag
|
||||||
- get-tag
|
|
||||||
- build-binaries
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- uses: ./.github/actions/build-image
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
tags: |
|
registry: ghcr.io
|
||||||
${{ needs.get-tag.outputs.tag }}
|
username: ${{ github.repository_owner }}
|
||||||
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/sergi0g/cup:${{ needs.get-tag.outputs.tag }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
nightly-release:
|
nightly-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs: [build-binaries, get-tag]
|
||||||
- build-binaries
|
|
||||||
- build-image
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download binaries
|
- name: Download binaries
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
31
.github/workflows/release.yml
vendored
31
.github/workflows/release.yml
vendored
@@ -60,19 +60,34 @@ jobs:
|
|||||||
cup-linux-arm64
|
cup-linux-arm64
|
||||||
|
|
||||||
build-image:
|
build-image:
|
||||||
needs:
|
needs: get-tag
|
||||||
- get-tag
|
|
||||||
- build-binaries
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- uses: ./.github/actions/build-image
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
tags: |
|
registry: ghcr.io
|
||||||
${{ needs.get-tag.outputs.tag }}
|
username: ${{ github.repository_owner }}
|
||||||
latest
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
gh-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
- name: Build and push image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/sergi0g/cup:${{ needs.get-tag.outputs.tag }},ghcr.io/sergi0g/cup:latest
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
1157
Cargo.lock
generated
1157
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
@@ -1,15 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cup"
|
name = "cup"
|
||||||
version = "3.1.0"
|
version = "3.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.7", features = ["derive"] }
|
clap = { version = "4.5.7", features = ["derive"] }
|
||||||
indicatif = { version = "0.17.8", optional = true }
|
indicatif = { version = "0.17.8", optional = true }
|
||||||
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
|
||||||
xitca-web = { version = "0.6.2", optional = true }
|
xitca-web = { version = "0.5.0", optional = true }
|
||||||
liquid = { version = "0.26.6", optional = true }
|
liquid = { version = "0.26.6", optional = true }
|
||||||
bollard = "0.18.1"
|
bollard = "0.16.1"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
http-auth = { version = "0.1.9", default-features = false }
|
http-auth = { version = "0.1.9", default-features = false }
|
||||||
termsize = { version = "0.1.8", optional = true }
|
termsize = { version = "0.1.8", optional = true }
|
||||||
@@ -17,11 +17,11 @@ regex = { version = "1.10.5", default-features = false, features = ["perf"] }
|
|||||||
chrono = { version = "0.4.38", default-features = false, features = ["std", "alloc", "clock"], optional = true }
|
chrono = { version = "0.4.38", default-features = false, features = ["std", "alloc", "clock"], optional = true }
|
||||||
reqwest = { version = "0.12.7", default-features = false, features = ["rustls-tls"] }
|
reqwest = { version = "0.12.7", default-features = false, features = ["rustls-tls"] }
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
reqwest-retry = "0.7.0"
|
reqwest-retry = "0.6.1"
|
||||||
reqwest-middleware = "0.3.3"
|
reqwest-middleware = "0.3.3"
|
||||||
rustc-hash = "2.0.0"
|
rustc-hash = "2.0.0"
|
||||||
http-link = "1.0.1"
|
http-link = "1.0.1"
|
||||||
itertools = "0.14.0"
|
itertools = "0.13.0"
|
||||||
serde_json = "1.0.133"
|
serde_json = "1.0.133"
|
||||||
serde = "1.0.215"
|
serde = "1.0.215"
|
||||||
tokio-cron-scheduler = { version = "0.13.0", default-features = false, optional = true }
|
tokio-cron-scheduler = { version = "0.13.0", default-features = false, optional = true }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ RUN ~/.bun/bin/bun install
|
|||||||
RUN ~/.bun/bin/bun run build
|
RUN ~/.bun/bin/bun run build
|
||||||
|
|
||||||
### Build Cup ###
|
### Build Cup ###
|
||||||
FROM rust:1-alpine AS build
|
FROM rust:1.80.1-alpine AS build
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
RUN apk add musl-dev
|
RUN apk add musl-dev
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
# 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/bun.lockb
BIN
docs/bun.lockb
Binary file not shown.
@@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build && pagefind --site out --output-path out/_pagefind",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"fmt": "bun prettier --write ."
|
"fmt": "bun prettier --write ."
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
"@types/react-dom": "^19.0.3",
|
"@types/react-dom": "^19.0.3",
|
||||||
"eslint": "^9.18.0",
|
"eslint": "^9.18.0",
|
||||||
"eslint-config-next": "15.1.5",
|
"eslint-config-next": "15.1.5",
|
||||||
"pagefind": "^1.3.0",
|
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.1",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB |
@@ -1,47 +0,0 @@
|
|||||||
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,7 +34,6 @@ 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": {
|
||||||
@@ -78,7 +77,3 @@ 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.
|
|
||||||
|
|||||||
27
src/check.rs
27
src/check.rs
@@ -120,16 +120,6 @@ pub async fn get_updates(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|image| &image.parts.registry)
|
.map(|image| &image.parts.registry)
|
||||||
.unique()
|
.unique()
|
||||||
.filter(|®istry| match ctx.config.registries.get(registry) {
|
|
||||||
Some(config) => {
|
|
||||||
if config.ignore {
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => true,
|
|
||||||
})
|
|
||||||
.collect::<Vec<&String>>();
|
.collect::<Vec<&String>>();
|
||||||
|
|
||||||
// Create request client. All network requests share the same client for better performance.
|
// Create request client. All network requests share the same client for better performance.
|
||||||
@@ -148,7 +138,7 @@ pub async fn get_updates(
|
|||||||
|
|
||||||
// Retrieve an authentication token (if required) for each registry.
|
// Retrieve an authentication token (if required) for each registry.
|
||||||
let mut tokens: FxHashMap<&str, Option<String>> = FxHashMap::default();
|
let mut tokens: FxHashMap<&str, Option<String>> = FxHashMap::default();
|
||||||
for registry in registries.clone() {
|
for registry in registries {
|
||||||
let credentials = if let Some(registry_config) = ctx.config.registries.get(registry) {
|
let credentials = if let Some(registry_config) = ctx.config.registries.get(registry) {
|
||||||
®istry_config.authentication
|
®istry_config.authentication
|
||||||
} else {
|
} else {
|
||||||
@@ -173,11 +163,24 @@ pub async fn get_updates(
|
|||||||
|
|
||||||
ctx.logger.debug(format!("Tokens: {:?}", tokens));
|
ctx.logger.debug(format!("Tokens: {:?}", tokens));
|
||||||
|
|
||||||
|
let ignored_registries = ctx
|
||||||
|
.config
|
||||||
|
.registries
|
||||||
|
.iter()
|
||||||
|
.filter_map(|(registry, registry_config)| {
|
||||||
|
if registry_config.ignore {
|
||||||
|
Some(registry)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect::<Vec<&String>>();
|
||||||
|
|
||||||
let mut handles = Vec::with_capacity(images.len());
|
let mut handles = Vec::with_capacity(images.len());
|
||||||
|
|
||||||
// Loop through images check for updates
|
// Loop through images check for updates
|
||||||
for image in &images {
|
for image in &images {
|
||||||
let is_ignored = !registries.contains(&&image.parts.registry)
|
let is_ignored = ignored_registries.contains(&&image.parts.registry)
|
||||||
|| ctx
|
|| ctx
|
||||||
.config
|
.config
|
||||||
.images
|
.images
|
||||||
|
|||||||
@@ -95,10 +95,6 @@ impl Client {
|
|||||||
let message = format!("{} {}: Connection timed out!", method, url);
|
let message = format!("{} {}: Connection timed out!", method, url);
|
||||||
self.ctx.logger.warn(&message);
|
self.ctx.logger.warn(&message);
|
||||||
Err(message)
|
Err(message)
|
||||||
} else if error.is_middleware() {
|
|
||||||
let message = format!("{} {}: Connection failed after 3 retries!", method, url);
|
|
||||||
self.ctx.logger.warn(&message);
|
|
||||||
Err(message)
|
|
||||||
} else {
|
} else {
|
||||||
error!(
|
error!(
|
||||||
"{} {}: Unexpected error: {}",
|
"{} {}: Unexpected error: {}",
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ 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>,
|
||||||
@@ -62,7 +61,6 @@ 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,
|
||||||
@@ -143,7 +141,6 @@ 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,7 +3,6 @@ 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 {
|
||||||
@@ -14,16 +13,6 @@ 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 {
|
||||||
@@ -34,8 +23,4 @@ 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,7 +7,6 @@ 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>,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub fn split(reference: &str) -> (String, String, String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let splits = repository_and_tag.split('@').next().unwrap().split(':').collect::<Vec<&str>>();
|
let splits = repository_and_tag.split(':').collect::<Vec<&str>>();
|
||||||
let (repository, tag) = match splits.len() {
|
let (repository, tag) = match splits.len() {
|
||||||
1 | 2 => {
|
1 | 2 => {
|
||||||
let repository_components = splits[0].split('/').collect::<Vec<&str>>();
|
let repository_components = splits[0].split('/').collect::<Vec<&str>>();
|
||||||
@@ -38,7 +38,7 @@ pub fn split(reference: &str) -> (String, String, String) {
|
|||||||
};
|
};
|
||||||
(repository, tag)
|
(repository, tag)
|
||||||
}
|
}
|
||||||
_ => {dbg!(splits); panic!()},
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
(registry.to_string(), repository, tag.to_string())
|
(registry.to_string(), repository, tag.to_string())
|
||||||
}
|
}
|
||||||
|
|||||||
1
web/.tool-versions
Normal file
1
web/.tool-versions
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nodejs 22.8.0
|
||||||
@@ -21,8 +21,6 @@ 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`}
|
||||||
@@ -37,7 +35,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(`${copyText}`)}
|
onClick={handleCopy(`docker pull ${children}`)}
|
||||||
>
|
>
|
||||||
<Clipboard className="size-5" />
|
<Clipboard className="size-5" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -40,9 +40,7 @@ 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 (data.url) {
|
if (clickable_registries.includes(data.parts.registry)) {
|
||||||
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}`;
|
||||||
@@ -84,14 +82,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="break-all font-mono text-black dark:text-white">
|
<DialogTitle className="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 hover:underline`}
|
className={`group w-fit text-black hover:underline dark:text-white`}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{data.reference}
|
{data.reference}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ 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