Compare commits

...

29 Commits
v0.1.0 ... main

Author SHA1 Message Date
Nikolai Rodionov 2a23551602
Upgrade dependencies 2023-11-19 23:00:13 +01:00
Nikolai Rodionov da08ab2fc7
chore: Keep containers up-to-date 2023-06-27 04:21:28 +02:00
Nikolai Rodionov d3ef1b87db
Run `cargo update` to keep dependencies updated 2023-06-10 00:10:08 +02:00
Nikolai Rodionov b8353389cc
Disable not-implemented yet helm support 2023-06-02 11:55:37 +02:00
Nikolai Rodionov 10a86abbbb
Version 0.1.8 2023-05-07 13:11:42 +02:00
Nikolai Rodionov 52a3be2846
fix: Sync repos before listing apps 2023-05-07 13:08:00 +02:00
Nikolai Rodionov edbab404e9
chore: Update dependencies 2023-05-07 11:17:02 +02:00
Nikolai Rodionov 7f4b3033bd
Install sops with dudo 2023-05-07 11:12:48 +02:00
Nikolai Rodionov 7b370a8266
fix: Install sops from alpine testing repos 2023-05-04 22:22:33 +02:00
Nikolai Rodionov d941ea51e7
Add jobs dependency 2023-05-04 12:34:14 +02:00
Nikolai Rodionov 6c04658d0d
Fix the build 2023-05-04 12:32:47 +02:00
Nikolai Rodionov c7e8a87a36
Add an image with helm secrets installed 2023-05-04 12:31:31 +02:00
Nikolai Rodionov 1e8894efcc
fix: Use the correct dudo argument in Dockerfiles 2023-04-04 14:24:12 +02:00
Nikolai Rodionov 64ae4af142
Version 0.1.6 2023-04-04 11:57:27 +02:00
Nikolai Rodionov c2f2a3b8e6
fix(critical): Use helmfile `repos` instead of `sync` 2023-04-04 11:56:51 +02:00
Nikolai Rodionov cff0139c09 fix: Add amd64 to helmfile docker build 2023-03-22 21:41:29 +01:00
Nikolai Rodionov cc9ff758f4 Version 0.1.5 2023-03-18 18:36:35 +01:00
Nikolai Rodionov f6c1510814 chore: Update halmfile version 2023-03-18 18:36:20 +01:00
Nikolai Rodionov f4dd33d6df fix: Use the rust nightly toolchain 2023-03-17 11:02:04 +01:00
Nikolai Rodionov 3f6e88809e fix: set --jobs in the main Dockerfile 2023-03-16 16:55:34 +01:00
Nikolai Rodionov 1c29b32407 fix: helmfile and argocd are working again
- The tool was totally broken, not it works again
- Development has been moved to my Gitea server
- A basic test for helmfile is added
- A basic drone pipeline is added
2023-03-16 15:02:23 +01:00
Nikolai Rodionov 7adb5f0a4a Fix helmfile dockerfile 2023-02-15 14:20:58 +01:00
Nikolai Rodionov 34a957ef4a Version v0.1.3 2023-02-15 10:02:37 +01:00
Nikolai Rodionov dad5fbdb15 fix: versioned docker builds must work now 2023-02-15 10:02:02 +01:00
Nikolai Rodionov b596961291 Version v0.1.2 2023-02-15 09:01:11 +01:00
Nikolai Rodionov aa3435ee7b
Add docker images (#5) 2023-02-14 22:16:34 +01:00
Nikolai Rodionov 1a477790c4 Update version in Cargo.toml to 0.1.1 2023-01-25 13:49:53 +01:00
Nikolai Rodionov 6acf7a4dd1 add no_uptodate option 2023-01-25 13:01:24 +01:00
Nikolai Rodionov e6e9c7b248 Fix the download script and update README 2023-01-16 21:53:37 +01:00
20 changed files with 640 additions and 244 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
target

26
.drone.yml Normal file
View File

@ -0,0 +1,26 @@
---
kind: pipeline
type: kubernetes
name: Tests
trigger:
event:
- push
steps:
- name: Prepare helm and helmfile
image: ghcr.io/helmfile/helmfile:canary
commands:
- mkdir -p bin
- cp $(which helm) ./bin/helm
- cp $(which helmfile) ./bin/helmfile
- name: Unit tests
image: rust:slim
environment:
CARGO_BUILD_JOBS: 1
commands:
- export PATH=$PWD/bin:$PATH
- helm
- helmfile
- cargo test

View File

@ -5,11 +5,10 @@ on:
push:
branches:
- main
paths:
- "src/**"
jobs:
containerization:
prepare_base:
name: Prepare the base image
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -26,7 +25,6 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
@ -34,7 +32,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build
- name: Build base
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
@ -43,8 +41,57 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:stable
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:latest
ghcr.io/${{ github.repository }}-base:latest
labels: |
action_id=${{ github.action }}
action_link=${{ env.LINK }}
actor=${{ github.actor }}
sha=${{ github.sha }}
ref=${{ github.ref }}
build_containers:
name: Build final images
runs-on: ubuntu-latest
needs: prepare_base
strategy:
matrix:
target_image:
- helmfile
- helmfile-secrets
- argo
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set action link variable
run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build ${{ matrix.target_image }}
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./dockerfiles
file: ./dockerfiles/Dockerfile-${{ matrix.target_image }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}-${{ matrix.target_image }}:latest
ghcr.io/${{ github.repository }}-${{ matrix.target_image }}:stable
labels: |
action_id=${{ github.action }}
action_link=${{ env.LINK }}

View File

@ -1,5 +1,5 @@
---
name: "Version container"
name: "Versioned container"
on:
push:
@ -7,7 +7,8 @@ on:
- "v*.*.*"
jobs:
containerization:
prepare_base:
name: Prepare the base image
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -27,15 +28,13 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build
- name: Build base
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
@ -44,10 +43,64 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:${{ env.TAG }}
ghcr.io/${{ github.repository }}-base:${{ env.TAG }}
labels: |
action_id=${{ github.action }}
action_link=${{ env.LINK }}
actor=${{ github.actor }}
sha=${{ github.sha }}
ref=${{ github.ref }}
build_containers:
name: Build final images
runs-on: ubuntu-latest
needs: prepare_base
strategy:
matrix:
target_image:
- helmfile
- helmfile-secrets
- argo
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set version variable
run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set action link variable
run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build ${{ matrix.target_image }}
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./dockerfiles
file: ./dockerfiles/Dockerfile-${{ matrix.target_image }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}-${{ matrix.target_image }}:${{ env.TAG }}
ghcr.io/${{ github.repository }}-${{ matrix.target_image }}:${{ env.TAG }}
labels: |
action_id=${{ github.action }}
action_link=${{ env.LINK }}
actor=${{ github.actor }}
sha=${{ github.sha }}
ref=${{ github.ref }}

462
Cargo.lock generated
View File

@ -4,18 +4,60 @@ version = 3
[[package]]
name = "aho-corasick"
version = "0.7.19"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "autocfg"
version = "1.1.0"
name = "anstream"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
[[package]]
name = "anstyle-parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "bitflags"
@ -24,29 +66,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
version = "0.10.3"
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "bytecount"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
[[package]]
name = "cc"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
[[package]]
name = "cdh"
version = "0.1.0"
version = "0.1.9"
dependencies = [
"clap",
"clap_complete",
@ -57,6 +99,7 @@ dependencies = [
"serde_json",
"serde_yaml",
"tabled",
"tempfile",
"version-compare",
]
@ -68,55 +111,64 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.1.1"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2"
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
dependencies = [
"bitflags",
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"is-terminal",
"once_cell",
"strsim",
"termcolor",
]
[[package]]
name = "clap_complete"
version = "4.1.0"
version = "4.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce8955d4e8cd4f28f9a01c93a050194c4d131e73ca02f6636bcddbed867014d7"
checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.1.0"
version = "4.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
name = "clap_lex"
version = "0.3.1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
dependencies = [
"os_str_bytes",
]
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "cpufeatures"
version = "0.2.5"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
dependencies = [
"libc",
]
@ -133,9 +185,9 @@ dependencies = [
[[package]]
name = "digest"
version = "0.10.5"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
@ -143,9 +195,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.10.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
dependencies = [
"humantime",
"is-terminal",
@ -155,25 +207,26 @@ dependencies = [
]
[[package]]
name = "errno"
version = "0.2.8"
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
"windows-sys",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
name = "fastrand"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fnv"
@ -183,9 +236,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "generic-array"
version = "0.14.6"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
@ -193,9 +246,9 @@ dependencies = [
[[package]]
name = "handlebars"
version = "4.3.5"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd"
checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225"
dependencies = [
"log",
"pest",
@ -207,24 +260,21 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.12.3"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
[[package]]
name = "heck"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.2.6"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
[[package]]
name = "humantime"
@ -234,86 +284,66 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "indexmap"
version = "1.9.1"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"autocfg",
"equivalent",
"hashbrown",
]
[[package]]
name = "io-lifetimes"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.2"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "itoa"
version = "1.0.4"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "libc"
version = "0.2.137"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "log"
version = "0.4.17"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.5.0"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "once_cell"
version = "1.16.0"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "os_str_bytes"
version = "6.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "papergrid"
version = "0.7.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1526bb6aa9f10ec339fb10360f22c57edf81d5678d0278e93bc12a47ffbe4b01"
checksum = "a2ccbe15f2b6db62f9a9871642746427e297b0ceb85f9a7f1ee5ff47d184d0c8"
dependencies = [
"bytecount",
"fnv",
@ -322,19 +352,20 @@ dependencies = [
[[package]]
name = "pest"
version = "2.4.0"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a"
checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5"
dependencies = [
"memchr",
"thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.4.0"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2"
checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2"
dependencies = [
"pest",
"pest_generator",
@ -342,26 +373,26 @@ dependencies = [
[[package]]
name = "pest_generator"
version = "2.4.0"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db"
checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
name = "pest_meta"
version = "2.4.0"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d"
checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6"
dependencies = [
"once_cell",
"pest",
"sha1",
"sha2",
]
[[package]]
@ -373,7 +404,7 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"version_check",
]
@ -390,27 +421,48 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.47"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.6.0"
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
@ -419,19 +471,18 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.27"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rustix"
version = "0.36.6"
version = "0.38.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
dependencies = [
"bitflags",
"bitflags 2.4.1",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
@ -439,35 +490,35 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.11"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "serde"
version = "1.0.147"
version = "1.0.192"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.147"
version = "1.0.192"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
name = "serde_json"
version = "1.0.87"
version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"itoa",
"ryu",
@ -476,9 +527,9 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.9.16"
version = "0.9.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834"
checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c"
dependencies = [
"indexmap",
"itoa",
@ -488,10 +539,10 @@ dependencies = [
]
[[package]]
name = "sha1"
version = "0.10.5"
name = "sha2"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",
@ -506,9 +557,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.103"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
"proc-macro2",
"quote",
@ -517,9 +579,9 @@ dependencies = [
[[package]]
name = "tabled"
version = "0.10.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c3ee73732ffceaea7b8f6b719ce3bb17f253fa27461ffeaf568ebd0cdb4b85"
checksum = "dfe9c3632da101aba5131ed63f9eed38665f8b3c68703a6bb18124835c1a5d22"
dependencies = [
"papergrid",
"tabled_derive",
@ -528,81 +590,100 @@ dependencies = [
[[package]]
name = "tabled_derive"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beca1b4eaceb4f2755df858b88d9b9315b7ccfd1ffd0d7a48a52602301f01a57"
checksum = "99f688a08b54f4f02f0a3c382aefdb7884d3d69609f785bd253dc033243e3fe4"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
name = "tempfile"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall",
"rustix",
"windows-sys",
]
[[package]]
name = "termcolor"
version = "1.1.3"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.37"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.37"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.39",
]
[[package]]
name = "typenum"
version = "1.15.0"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "unicode-ident"
version = "1.0.5"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-width"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unsafe-libyaml"
version = "0.2.5"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2"
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "version-compare"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
@ -628,9 +709,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]
@ -643,9 +724,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
@ -658,42 +748,42 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

View File

@ -1,7 +1,7 @@
[package]
name = "cdh"
authors = ["allanger <allanger@zohomail.com>"]
version = "0.1.0"
version = "0.1.9"
description = "Your helm releases are outdated, aren't they? Now you can check"
edition = "2021"
@ -13,7 +13,9 @@ env_logger = "0.10.0"
version-compare = "0.1.0"
clap = { version = "4.1.1", features = ["derive", "env"] }
serde_yaml = "0.9.16"
tabled = "0.10.0"
tabled = "0.14.0"
handlebars = "4.3.1"
clap_complete = "4.0.6"
[dev-dependencies]
tempfile = "3.4.0"

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM rust:1.70.0-alpine3.18 as builder
WORKDIR /src
RUN apk update && apk add --no-cache gcc musl-dev
COPY ./ .
RUN rustup default nightly && rustup update
RUN cargo build --release --jobs 2 -Z sparse-registry
FROM alpine:3.18
COPY --from=builder /src/target/release/cdh /bin/cdh
WORKDIR /workdir
ENTRYPOINT ["/bin/cdh"]

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
build:
cargo build --release

View File

@ -20,7 +20,7 @@ Prebuilt binaries exist for **Linux x86_64** and **MacOS arm64** and **x86_64**
Don't forget to add the binary to $PATH
```BASH
$ curl https://raw.githubusercontent.com/allanger/check-da-helm/main/scripts/download_cdm.sh | bash
$ curl https://raw.githubusercontent.com/allanger/check-da-helm/main/scripts/download_cdh.sh | bash
$ cdm -h
```

View File

@ -0,0 +1,12 @@
ARG BASE_VERSION=latest
FROM ghcr.io/allanger/dumb-downloader as builder
ARG ARGOCD_VERSION=v2.7.6
ENV RUST_LOG=info
RUN mkdir /out
RUN dudo -l "https://github.com/argoproj/argo-cd/releases/download/{{ version }}/argocd-{{ os }}-{{ arch }}" -d /tmp/argocd -p $ARGOCD_VERSION
RUN mv /tmp/argocd /out/argocd && chmod +x /out/argocd
FROM ghcr.io/allanger/check-da-helm-base:${BASE_VERSION}
COPY --from=builder /out/ /usr/bin
RUN apk update --no-cache && apk add --no-cache jq bash
ENTRYPOINT ["cdh"]

View File

@ -0,0 +1,18 @@
ARG BASE_VERSION=latest
FROM ghcr.io/allanger/dumb-downloader as builder
RUN apt-get update -y && apt-get install tar -y
ARG HELM_VERSION=v3.12.1
ARG HELMFILE_VERSION=0.154.0
ENV RUST_LOG=info
RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -d /tmp/helmfile.tar.gz -p $HELMFILE_VERSION
RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -d /tmp/helm.tar.gz -p $HELM_VERSION
RUN tar -xf /tmp/helm.tar.gz -C /tmp && rm -f /tmp/helm.tar.gz
RUN tar -xf /tmp/helmfile.tar.gz -C /tmp && rm -f /tmp/helmfile.tar.gz
RUN mkdir /out && for bin in `find /tmp | grep helm`; do cp $bin /out/; done
RUN chmod +x /out/helm
RUN chmod +x /out/helmfile
FROM ghcr.io/allanger/check-da-helm-base:${BASE_VERSION}
COPY --from=builder /out/ /usr/bin
RUN apk update --no-cache && apk add --no-cache jq bash
ENTRYPOINT ["cdh"]

View File

@ -0,0 +1,24 @@
ARG BASE_VERSION=latest
FROM ghcr.io/allanger/dumb-downloader as builder
RUN apt-get update -y && apt-get install tar -y
ARG HELM_VERSION=v3.12.1
ARG HELMFILE_VERSION=0.154.0
ARG SOPS_VERSION=v3.7.3
ENV RUST_LOG=info
RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -d /tmp/helmfile.tar.gz -p $HELMFILE_VERSION
RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -d /tmp/helm.tar.gz -p $HELM_VERSION
RUN tar -xf /tmp/helm.tar.gz -C /tmp && rm -f /tmp/helm.tar.gz
RUN tar -xf /tmp/helmfile.tar.gz -C /tmp && rm -f /tmp/helmfile.tar.gz
RUN mkdir /out && for bin in `find /tmp | grep helm`; do cp $bin /out/; done
RUN chmod +x /out/helm
RUN chmod +x /out/helmfile
# Download SOPS
RUN dudo -l "https://github.com/mozilla/sops/releases/download/{{ version }}/sops-{{ version }}.{{ os }}.{{ arch }}" -d /out/sops -p $SOPS_VERSION
RUN chmod +x /out/sops
FROM ghcr.io/allanger/check-da-helm-base:${BASE_VERSION}
COPY --from=builder /out/ /usr/bin
RUN apk update --no-cache && apk add --no-cache jq bash age git musl
RUN helm plugin install https://github.com/jkroepke/helm-secrets --version v4.4.2
ENTRYPOINT ["cdh"]

View File

@ -0,0 +1,18 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: sealed-secrets
namespace: argocd
spec:
project: default
source:
chart: argo-cd
repoURL: https://argoproj.github.io/argo-helm
targetRevision: 5.23.3
helm:
releaseName: sealed-secrets
syncPolicy:
automated: {}
destination:
server: "https://kubernetes.default.svc"
namespace: argocd

View File

@ -1,14 +1,23 @@
repositories:
- name: keel
url: https://charts.keel.sh
- name: argo
url: https://argoproj.github.io/argo-helm
- name: bitnami
url: registry-1.docker.io/bitnamicharts
oci: true
releases:
# -----------------------------
# -- Keel
# -----------------------------
- name: keel
- name: argocd
installed: true
namespace: keel-system
namespace: argocd
createNamespace: true
chart: keel/keel
version: 0.9.11
chart: argo/argo-cd
version: 5.23.3
values:
- server:
extraArgs:
- --insecure
- name: redis
installed: true
chart: bitnami/redis
version: 17.13.1

View File

@ -33,7 +33,7 @@ case "$(uname)" in
exit 1
;;
esac
LATEST_VERSION="v$(curl -s https://raw.githubusercontent.com/allanger/check-da-helm/main/Cargo.toml | awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }')"
LATEST_VERSION="v$(curl -s https://raw.githubusercontent.com/allanger/check-da-helm/main/Cargo.toml | awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2); exit}')"
echo "Downloading $LATEST_VERSION"
RELEASE_NAME=cdh-$LATEST_VERSION-$TARGET
@ -47,4 +47,4 @@ chmod +x cdh
echo 'Make sure that cdh is in your $PATH'
echo 'Try: '
echo ' $ export PATH=$PATH:$PWD'
echo ' $ cdh -h'
echo ' $ cdh -h'

15
scripts/download_for_arch.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
case $(uname -m) in
"arm64"|"aarch64")
PLATFORM="arm64"
;;
"x86_64")
PLATFORM="amd64"
;;
*)
echo "Unsuported target"
exit 1
;;
esac
echo "Downloading $2 from $1"
curl -LJO $1 $2

View File

@ -15,7 +15,7 @@ impl Connector for Argo {
type ConnectorType = Argo;
fn get_app(&self) -> Result<Vec<types::HelmChart>> {
let cmd: String = "argocd app list -o json | jq '[.[] | {chart: .spec.source.chart, version: .spec.source.targetRevision}]'".to_string();
let cmd: String = "argocd app list -o json | jq '[.[] | {chart: .spec.source.chart, version: .spec.source.targetRevision, name: .spec.source.helm.releaseName}]'".to_string();
debug!("executing '${}'", cmd);
let output = Command::new("bash")
@ -27,7 +27,7 @@ impl Connector for Argo {
match from_str::<Vec<types::HelmChart>>(Borrow::borrow(&helm_stdout)) {
Ok(mut charts) => {
charts.dedup();
charts.iter_mut().for_each(|chart| {chart.chart = Some(format!("{}/{}", chart.chart.clone().unwrap(), chart.chart.clone().unwrap()))});
Ok(charts)
}
Err(err) => Err(err.into()),

View File

@ -8,13 +8,15 @@ use std::{borrow::Borrow, io::Result, process::Command};
pub(crate) struct Helmfile {
path: String,
env: String,
}
impl Connector for Helmfile {
fn get_app(&self) -> Result<Vec<types::HelmChart>> {
let cmd: String = format!(
"helmfile -f {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'",
self.path
"helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .chart, version: .version, name: .name}}]'",
self.path,
self.env
)
.to_string();
@ -35,7 +37,7 @@ impl Connector for Helmfile {
}
}
fn sync_repos(&self) -> Result<()> {
let cmd: String = format!("helmfile -f {} sync", self.path);
let cmd: String = format!("helmfile -f {} -e {} repos", self.path, self.env);
Command::new("bash")
.arg("-c")
.arg(cmd)
@ -46,8 +48,48 @@ impl Connector for Helmfile {
type ConnectorType = Helmfile;
}
impl Helmfile {
pub(crate) fn init(path: String) -> Self {
Self { path: path }
pub(crate) fn init(path: String, env: String) -> Self {
Self {path, env}
}
}
#[cfg(test)]
mod tests {
use tempfile::NamedTempFile;
use std::io::Write;
use crate::connectors::{Helmfile, Connector};
use crate::types;
static HELMFILE_EXAMPLE: &str = "repositories:\n
- name: argo\n
url: https://argoproj.github.io/argo-helm\n
releases:\n
- name: argocd\n
installed: true\n
namespace: argocd\n
createNamespace: true\n
chart: argo/argo-cd\n
version: 5.23.3\n
values:\n
- server:\n
extraArgs:\n
- --insecure";
#[test]
fn test_helmfile() {
let mut file = NamedTempFile::new().unwrap();
writeln!(file, "{}", HELMFILE_EXAMPLE.clone()).unwrap();
let path = file.into_temp_path();
let helmfile_app = Helmfile::init(path.to_string_lossy().to_string(), "default".to_string()).get_app().unwrap();
let app = types::HelmChart{
chart: Some("argo/argo-cd".to_string()),
name: Some("argocd".to_string()),
version: Some("5.23.3".to_string()),
};
let apps: Vec<types::HelmChart> = vec![app];
assert_eq!(apps, helmfile_app);
path.close().unwrap();
}
}

View File

@ -20,7 +20,7 @@ use crate::types::{HelmChart, Status};
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
enum Kinds {
Argo,
Helm,
//Helm,
Helmfile,
}
@ -43,12 +43,18 @@ struct Args {
/// Path to the helmfile
#[clap(short, long, value_parser, default_value = "./")]
path: String,
/// Pass an environment to the helmfile
#[arg(long, required = false, default_value = "default")]
helmfile_environment: String,
/// Should execution be failed if you have outdated charts
#[clap(short, long, action, default_value_t = false, env = "OUTDATED_FAIL")]
outdated_fail: bool,
/// Set to true if you don't want to sync repositories
#[clap(short, long, action, default_value_t = false)]
no_sync: bool,
/// Set to true if you don't wante to see up-to-date charts in the output
#[clap(long, action, default_value_t = true)]
no_uptodate: bool
}
#[derive(Debug, Subcommand)]
@ -81,20 +87,13 @@ fn main() {
env_logger::init();
let args = Args::parse();
let mut result: Vec<ExecResult> = Vec::new();
let charts = match args.kind {
Kinds::Argo => Argo::init().get_app(),
Kinds::Helm => Helm::init().get_app(),
Kinds::Helmfile => Helmfile::init(args.path.clone()).get_app(),
}
.unwrap();
if !args.no_sync {
info!("syncing helm repositories");
let res = match args.kind {
Kinds::Argo => Argo::init().sync_repos(),
Kinds::Helm => Helm::init().sync_repos(),
Kinds::Helmfile => Helmfile::init(args.path).sync_repos(),
// Kinds::Helm => Helm::init().sync_repos(),
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).sync_repos(),
};
match res {
Ok(_) => info!("helm repos are synced"),
@ -102,13 +101,21 @@ fn main() {
}
}
let charts = match args.kind {
Kinds::Argo => Argo::init().get_app(),
//Kinds::Helm => Helm::init().get_app(),
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(),
}
.unwrap();
charts.iter().for_each(|a| {
debug!("{:?}", a);
check_chart(&mut result, a).unwrap();
});
// Parse the helmfile
// Handling the result
match handle_result(&result, args.outdated_fail, args.output) {
match handle_result(&mut result, args.outdated_fail, args.output, args.no_uptodate) {
Ok(result) => {
if result {
exit(1);
@ -122,9 +129,9 @@ fn main() {
}
fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) -> Result<()> {
if local_chart.name.is_some() {
if local_chart.chart.is_some() {
let version = local_chart.version.clone().unwrap();
let chart = local_chart.name.clone().unwrap();
let chart = local_chart.chart.clone().unwrap();
return match version.is_empty() {
true => {
warn!(
@ -136,8 +143,8 @@ fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) ->
false => {
info!("checking {} - {}", chart, version);
let cmd = format!(
"helm search repo {}/{} --versions --output json",
chart, chart
"helm search repo {} --versions --output json",
chart,
);
debug!("executing '${}'", cmd);
let output = Command::new("bash")
@ -150,6 +157,8 @@ fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) ->
// Remove "v" from version definitions
let mut versions: Vec<HelmChart> = from_str(helm_stdout.borrow()).unwrap();
versions.iter_mut().for_each(|f| {
f.name = local_chart.name.clone();
f.chart = local_chart.chart.clone();
if f.version.is_some() {
f.version = Some(f.version.as_ref().unwrap().replace('v', ""));
}
@ -166,8 +175,10 @@ fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) ->
);
}
let remote = Version::from(current_version.as_str()).unwrap();
debug!("{:?}", versions);
let status: Status = if versions.contains(&HelmChart {
name: Some(format!("{}/{}", chart.clone(), chart.clone())),
chart: Some(chart.clone()),
name: local_chart.name.clone(),
version: Some(version.clone()),
}) {
match local.compare(remote.clone()) {
@ -181,6 +192,7 @@ fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) ->
};
result.push(ExecResult::new(
local_chart.name.clone().unwrap(),
chart.clone(),
current_version.clone(),
version.clone(),
@ -197,28 +209,32 @@ fn check_chart(result: &mut Vec<ExecResult>, local_chart: &types::HelmChart) ->
/// Handle result
fn handle_result(
result: &Vec<ExecResult>,
result: &mut Vec<ExecResult>,
outdated_fail: bool,
output_kind: Outputs,
no_uptodate: bool,
) -> Result<bool> {
let mut failed = false;
if no_uptodate {
result.retain(|r| r.status != types::Status::Uptodate)
}
for r in result.clone() {
match r.status {
Status::Uptodate => info!("{} is up-to-date", r.name),
Status::Uptodate => info!("{} is up-to-date", r.chart),
Status::Outdated => {
if outdated_fail {
failed = true
}
warn!(
"{} is outdated. Current version is {}, but the latest is {}",
r.name, r.current_version, r.latest_version
r.chart, r.current_version, r.latest_version
);
}
Status::Missing => {
failed = true;
error!(
"{} is broken. Current version is {}, but it can't be found in the repo",
r.name, r.current_version
r.chart, r.current_version
);
}
}

View File

@ -5,8 +5,10 @@ use tabled::Tabled;
/// Struct for parsing charts info from helmfile
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub(crate) struct HelmChart {
#[serde(alias = "name", alias = "chart")]
// #[serde(alias = "name", alias = "chart")]
pub(crate) name: Option<String>,
// #[serde(alias = "name", alias = "chart")]
pub(crate) chart: Option<String>,
pub(crate) version: Option<String>,
}
@ -16,7 +18,7 @@ pub(crate) struct HelmRepo {
pub(crate) url: String,
}
#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq)]
pub(crate) enum Status {
Uptodate,
Outdated,
@ -36,15 +38,23 @@ impl fmt::Display for Status {
#[derive(Clone, Tabled, Serialize, Deserialize)]
pub(crate) struct ExecResult {
pub(crate) name: String,
pub(crate) chart: String,
pub(crate) latest_version: String,
pub(crate) current_version: String,
pub(crate) status: Status,
}
impl ExecResult {
pub(crate) fn new(name: String, latest_version: String, current_version: String, status: Status) -> Self {
pub(crate) fn new(
name: String,
chart: String,
latest_version: String,
current_version: String,
status: Status,
) -> Self {
Self {
name,
chart,
latest_version,
current_version,
status,