From e3bc5fb175e06a972c4c427a5454e845a07df0cd Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 15 Jan 2023 20:39:00 +0100 Subject: [PATCH 01/37] first commit --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c8517ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM rust:1.62.0-alpine3.16 as builder +RUN apk add alpine-sdk +RUN mkdir -p /src +WORKDIR /src +COPY ./ . +RUN cargo build --release + +FROM registry.kci.rocks/build_images/k8s-helmfile-deploy +RUN apk add --no-cache libstdc++ gcompat && apk add --no-cache yq --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community +COPY --from=builder /src/target/release/helmfile_checker /bin/helmfile_checker +ENV RUST_LOG=info +ENTRYPOINT ["/bin/helmfile_checker"] -- 2.45.2 From b523e9fd9a0c93f95ac7d293e836672f72b809dc Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 15 Jan 2023 21:00:53 +0100 Subject: [PATCH 02/37] Remove unused stuff --- src/connectors/argo.rs | 23 +++---- src/connectors/helmfile.rs | 2 +- src/main.rs | 124 ++----------------------------------- src/types/mod.rs | 2 +- 4 files changed, 18 insertions(+), 133 deletions(-) diff --git a/src/connectors/argo.rs b/src/connectors/argo.rs index d1a302e..ecd2ed0 100644 --- a/src/connectors/argo.rs +++ b/src/connectors/argo.rs @@ -1,10 +1,13 @@ -use clap::Arg; -use log::{debug, info, error}; -use serde_json::from_str; use crate::types::{self, HelmRepo}; +use log::{debug, error, info}; +use serde_json::from_str; use super::Connector; -use std::{borrow::Borrow, io::{Result, Error, ErrorKind}, process::Command}; +use std::{ + borrow::Borrow, + io::{Error, ErrorKind, Result}, + process::Command, +}; pub(crate) struct Argo; @@ -96,7 +99,7 @@ impl Connector for Argo { ); } } - + Ok(()) } else { Err(Error::new( @@ -104,12 +107,10 @@ impl Connector for Argo { String::from_utf8_lossy(&output.stderr), )) } - } - } -impl Argo{ -pub(crate) fn init() -> Argo { - Argo +impl Argo { + pub(crate) fn init() -> Argo { + Argo + } } -} \ No newline at end of file diff --git a/src/connectors/helmfile.rs b/src/connectors/helmfile.rs index fb8ff6e..bae5885 100644 --- a/src/connectors/helmfile.rs +++ b/src/connectors/helmfile.rs @@ -4,7 +4,7 @@ use serde_json::from_str; use crate::types; use super::Connector; -use std::{borrow::Borrow, fmt::format, io::Result, process::Command}; +use std::{borrow::Borrow, io::Result, process::Command}; pub(crate) struct Helmfile { path: String, diff --git a/src/main.rs b/src/main.rs index 49ee268..7fc20cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,14 +9,13 @@ use serde::{Deserialize, Serialize}; use serde_json::from_str; use std::{ borrow::Borrow, - fmt::{self, format}, - io::{Error, ErrorKind, Result}, + io::Result, process::{exit, Command}, }; use tabled::Tabled; use version_compare::{Cmp, Version}; -use crate::types::HelmChart; +use crate::types::{HelmChart, Status}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] enum Kinds { @@ -58,23 +57,6 @@ struct LocalCharts { version: Option, } -/// Three possible statuses of versions comparison -#[derive(Clone, Serialize)] -enum Status { - Uptodate, - Outdated, - Missing, -} - -impl fmt::Display for Status { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Status::Uptodate => write!(f, "Up-to-date"), - Status::Outdated => write!(f, "Outdated"), - Status::Missing => write!(f, "Missing"), - } - } -} #[derive(Clone, Tabled, Serialize)] struct ExecResult { name: String, @@ -110,7 +92,7 @@ fn main() { if !args.no_sync { info!("syncing helm repositories"); - let res = match args.kind { + 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(), @@ -122,7 +104,7 @@ fn main() { } charts.iter().for_each(|a| { - let err = check_chart(&mut result, a); + check_chart(&mut result, a).unwrap(); }); // Parse the helmfile @@ -269,104 +251,6 @@ fn handle_result(result: &Vec, outdated_fail: bool) -> Result Ok(failed) } -/// Downloading repos from repositories -fn repo_sync() -> Result<()> { - info!("syncing helm repos"); - let cmd: String = "argocd app list -o json | jq '[ .[] | {name: .spec.source.chart, url: .spec.source.repoURL} ]'".to_string(); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helmfile is failed"); - info!("{:?}", output.clone()); - if output.status.success() { - let repos: Vec = serde_json::from_slice(&output.stdout).unwrap(); - info!("adding repositories"); - for repo in repos.iter() { - let name = repo.name.clone(); - if name.is_some() { - info!( - "syncing {} with the origin {}", - name.clone().unwrap(), - repo.url - ); - let cmd = format!( - "helm repo add {} {}", - name.clone().unwrap(), - repo.url.clone() - ); - debug!("running {}", cmd); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helm repo sync is failed"); - match output.status.success() { - true => { - info!( - "{} with the origin {} is synced successfully", - name.unwrap(), - repo.url - ); - } - false => { - error!( - "{} with the origin {} can't be synced", - name.unwrap(), - repo.url - ) - } - } - } - } - let cmd = "helm repo update"; - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helm repo sync is failed"); - match output.status.success() { - true => { - info!("repositories are updated successfully"); - } - false => { - error!( - "repositories can't be updated, {}", - String::from_utf8_lossy(&output.stderr) - ); - } - } - - Ok(()) - } else { - Err(Error::new( - ErrorKind::Other, - String::from_utf8_lossy(&output.stderr), - )) - } -} - -/// Run helmfile list and write the result into struct -fn parse_argo_apps() -> Result> { - let cmd: String = "argocd app list -o json | jq '[.[] | {chart: .spec.source.chart, version: .spec.source.targetRevision}]'".to_string(); - - debug!("executing '${}'", cmd); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helmfile is failed"); - let helm_stdout = String::from_utf8_lossy(&output.stdout); - - match from_str::>(Borrow::borrow(&helm_stdout)) { - Ok(mut charts) => { - charts.dedup(); - Ok(charts) - } - Err(err) => Err(err.into()), - } -} - /// Takes two version and returns the newer one. fn get_newer_version(v1: String, v2: String) -> String { match Version::from(&v1.replace('v', "")) diff --git a/src/types/mod.rs b/src/types/mod.rs index a0be023..768c0de 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -16,7 +16,7 @@ pub(crate) struct HelmRepo { } #[derive(Clone, Serialize)] -enum Status { +pub(crate) enum Status { Uptodate, Outdated, Missing, -- 2.45.2 From ceb1ca38050f4d2b5063178182877dcbbaa2b1dc Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 15 Jan 2023 21:11:07 +0100 Subject: [PATCH 03/37] Remove Dockerfile --- Dockerfile | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c8517ed..0000000 --- a/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM rust:1.62.0-alpine3.16 as builder -RUN apk add alpine-sdk -RUN mkdir -p /src -WORKDIR /src -COPY ./ . -RUN cargo build --release - -FROM registry.kci.rocks/build_images/k8s-helmfile-deploy -RUN apk add --no-cache libstdc++ gcompat && apk add --no-cache yq --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community -COPY --from=builder /src/target/release/helmfile_checker /bin/helmfile_checker -ENV RUST_LOG=info -ENTRYPOINT ["/bin/helmfile_checker"] -- 2.45.2 From acb073a9151396bdcf535f7e958a0d6f9e677f6c Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 16 Jan 2023 16:45:45 +0100 Subject: [PATCH 04/37] Add yaml output --- Cargo.lock | 10 ++++++ Cargo.toml | 2 ++ src/main.rs | 83 ++++++++++++++++++----------------------------- src/output/mod.rs | 61 ++++++++++++++++++++++++++++++++++ src/types/mod.rs | 22 ++++++++++++- 5 files changed, 126 insertions(+), 52 deletions(-) create mode 100644 src/output/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 011ec71..d8ef859 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,6 +56,7 @@ version = "0.1.0" dependencies = [ "build_html", "clap", + "clap_complete", "env_logger", "handlebars", "log", @@ -87,6 +88,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "clap_complete" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8955d4e8cd4f28f9a01c93a050194c4d131e73ca02f6636bcddbed867014d7" +dependencies = [ + "clap", +] + [[package]] name = "clap_derive" version = "4.1.0" diff --git a/Cargo.toml b/Cargo.toml index db36db3..eef3fb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,5 @@ serde_yaml = "0.9.16" tabled = "0.10.0" build_html = "2.1.0" handlebars = "4.3.1" +clap_complete = "4.0.6" + diff --git a/src/main.rs b/src/main.rs index 7fc20cc..ed082ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,10 @@ mod connectors; +mod output; mod types; - -use clap::{Parser, ValueEnum}; +use clap::{arg, command, Parser, Subcommand, ValueEnum}; use connectors::{Argo, Connector, Helm, Helmfile}; -use handlebars::Handlebars; use log::{debug, error, info, warn}; +use output::Output; use serde::{Deserialize, Serialize}; use serde_json::from_str; use std::{ @@ -12,7 +12,7 @@ use std::{ io::Result, process::{exit, Command}, }; -use tabled::Tabled; +use types::ExecResult; use version_compare::{Cmp, Version}; use crate::types::{HelmChart, Status}; @@ -24,13 +24,22 @@ enum Kinds { Helmfile, } +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] +enum Outputs { + Yaml, + HTML, +} + /// Check you helm releaseas managed by Argo #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Args { - /// Type of the + /// How do you install your helm charts #[clap(long, value_enum)] kind: Kinds, + /// What kind of output would you like to receive? + #[clap(long, value_enum, default_value = "yaml")] + output: Outputs, /// Path to the helmfile #[clap(short, long, value_parser, default_value = "./")] path: String, @@ -42,6 +51,14 @@ struct Args { no_sync: bool, } +#[derive(Debug, Subcommand)] +enum Commands { + #[command(arg_required_else_help = true)] + Generate { + #[arg(value_name = "SHELL", default_missing_value = "zsh")] + shell: clap_complete::shells::Shell, + }, +} /// A struct to write helm repo description to #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] struct Repo { @@ -57,25 +74,7 @@ struct LocalCharts { version: Option, } -#[derive(Clone, Tabled, Serialize)] -struct ExecResult { - name: String, - latest_version: String, - current_version: String, - status: Status, -} - // Implementation for the ExecResult struct -impl ExecResult { - fn new(name: String, latest_version: String, current_version: String, status: Status) -> Self { - Self { - name, - latest_version, - current_version, - status, - } - } -} fn main() { // Preparations step @@ -109,7 +108,7 @@ fn main() { // Parse the helmfile // Handling the result - match handle_result(&result, args.outdated_fail) { + match handle_result(&result, args.outdated_fail, args.output) { Ok(result) => { if result { exit(1); @@ -197,7 +196,11 @@ fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> } /// Handle result -fn handle_result(result: &Vec, outdated_fail: bool) -> Result { +fn handle_result( + result: &Vec, + outdated_fail: bool, + output_kind: Outputs, +) -> Result { let mut failed = false; for r in result.clone() { match r.status { @@ -220,34 +223,12 @@ fn handle_result(result: &Vec, outdated_fail: bool) -> Result } } } - let template = r#" - - - - - - - - {{#each this as |tr|}} - - - - - - - {{/each}} -
Chart NameCurrent VersionLatest VersionStatus
{{tr.name}}{{tr.current_version}}{{tr.latest_version}}{{tr.status}}
-"#; - let mut reg = Handlebars::new(); - // TODO: Handle this error - reg.register_template_string("html_table", template) - .unwrap(); - - match reg.render("html_table", &result) { - Ok(res) => println!("{}", res), - Err(err) => error!("{}", err), + match output_kind { + Outputs::Yaml => print!("{}", output::YAML::print(result)?), + Outputs::HTML => print!("{}", output::HTML::print(result)?), }; + Ok(failed) } diff --git a/src/output/mod.rs b/src/output/mod.rs new file mode 100644 index 0000000..2423b5b --- /dev/null +++ b/src/output/mod.rs @@ -0,0 +1,61 @@ +use std::io::{Result, Error, ErrorKind}; + +use handlebars::Handlebars; +use log::error; + +use crate::types::ExecResult; + +pub(crate) trait Output { + fn print(data: &Vec) -> Result; +} + +pub(crate) struct HTML; + +impl Output for HTML { + fn print(data: &Vec) -> Result { + // To generate htlm output, I have to use templates because I haven't found any other good + // solution + let template = r#" + + + + + + + + {{#each this as |tr|}} + + + + + + + {{/each}} +
Chart NameCurrent VersionLatest VersionStatus
{{tr.name}}{{tr.current_version}}{{tr.latest_version}}{{tr.status}}
+"#; + + let mut reg = Handlebars::new(); + // TODO: Handle this error + reg.register_template_string("html_table", template) + .unwrap(); + + match reg.render("html_table", &data) { + Ok(res) => Ok(res), + Err(err) => { + error!("{}", err); + return Err(Error::new(ErrorKind::InvalidInput, err.to_string())); + } + } + } +} + +pub(crate) struct YAML; + +impl Output for YAML { + fn print(data: &Vec) -> Result { + match serde_yaml::to_string(&data) { + Ok(res) => return Ok(res), + Err(err) => return Err(Error::new(ErrorKind::InvalidData, err.to_string())), + } + } +} diff --git a/src/types/mod.rs b/src/types/mod.rs index 768c0de..eaf52b4 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,5 +1,6 @@ use serde::{Deserialize, Serialize}; use std::fmt; +use tabled::Tabled; /// Struct for parsing charts info from helmfile #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] @@ -15,7 +16,7 @@ pub(crate) struct HelmRepo { pub(crate) url: String, } -#[derive(Clone, Serialize)] +#[derive(Clone, Serialize, Deserialize)] pub(crate) enum Status { Uptodate, Outdated, @@ -31,3 +32,22 @@ impl fmt::Display for Status { } } } + +#[derive(Clone, Tabled, Serialize, Deserialize)] +pub(crate) struct ExecResult { + pub(crate) name: 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 { + Self { + name, + latest_version, + current_version, + status, + } + } +} -- 2.45.2 From 6d17814a6322b227414a719a62ccc50834bd97c3 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 16 Jan 2023 18:34:21 +0100 Subject: [PATCH 05/37] Add ci/cd --- .github/workflows/build-version.yaml | 61 ++++++++++++++++++++++++ .github/workflows/container-stable.yaml | 53 ++++++++++++++++++++ .github/workflows/container-version.yaml | 53 ++++++++++++++++++++ .github/workflows/tests.yaml | 57 ++++++++++++++++++++++ scripts/download_cdh.sh | 50 +++++++++++++++++++ scripts/rename_releases.sh | 10 ++++ 6 files changed, 284 insertions(+) create mode 100644 .github/workflows/build-version.yaml create mode 100644 .github/workflows/container-stable.yaml create mode 100644 .github/workflows/container-version.yaml create mode 100644 .github/workflows/tests.yaml create mode 100755 scripts/download_cdh.sh create mode 100755 scripts/rename_releases.sh diff --git a/.github/workflows/build-version.yaml b/.github/workflows/build-version.yaml new file mode 100644 index 0000000..2bca855 --- /dev/null +++ b/.github/workflows/build-version.yaml @@ -0,0 +1,61 @@ +--- +name: "Version build" + +on: + push: + tags: + - "v*.*.*" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features --target=${{ matrix.target }} + + - name: Archive build artifacts + uses: actions/upload-artifact@v2 + with: + name: build-${{matrix.target}} + path: ${{ github.workspace }}/target/${{ matrix.target }}/release/cdh + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v2 + + - name: Set version variable + run: echo "CDH_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Rename release to avoid name conflict + run: ./scripts/rename_releases.sh + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: release/* diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml new file mode 100644 index 0000000..9189fff --- /dev/null +++ b/.github/workflows/container-stable.yaml @@ -0,0 +1,53 @@ +--- +name: "Stable container" + +on: + push: + branches: + - main + paths: + - "src/**" + +jobs: + containerization: + runs-on: ubuntu-latest + 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 + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:stable + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:latest + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml new file mode 100644 index 0000000..d40f07e --- /dev/null +++ b/.github/workflows/container-version.yaml @@ -0,0 +1,53 @@ +--- +name: "Version container" + +on: + push: + tags: + - "v*.*.*" + +jobs: + containerization: + runs-on: ubuntu-latest + 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 + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:${{ env.TAG }} + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..b991a9b --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,57 @@ +--- +name: "Tests" + +on: + pull_request: + branches: + - main + paths: + - "src/**" + +jobs: + cargo_udeps: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - name: Install cargo-udeps + run: cargo install cargo-udeps --locked + + - name: Check dependencies + run: cargo +nightly udeps + + cargo_test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + - run: cargo test + cargo_clippy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + - run: cargo clippy diff --git a/scripts/download_cdh.sh b/scripts/download_cdh.sh new file mode 100755 index 0000000..3d47749 --- /dev/null +++ b/scripts/download_cdh.sh @@ -0,0 +1,50 @@ +#!/bin/bash +case "$(uname)" in + +"Darwin") + SYSTEM="apple-darwin" + case $(uname -m) in + "arm64") + TARGET="aarch64-$SYSTEM" + ;; + "x86_64") + TARGET="x86_64-$SYSTEM" + ;; + *) + echo "Unsuported target" + exit 1 + ;; + esac + ;; +"Linux") + SYSTEM="unknown-linux-gnu" + case $(uname -m) in + "x86_64") + TARGET="x86_64-$SYSTEM" + ;; + *) + echo "Unsuported target" + exit 1 + ;; + esac + ;; +*) + echo "Signal number $1 is not processed" + 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) }')" +echo "Downloading $LATEST_VERSION" + +RELEASE_NAME=cdh-$LATEST_VERSION-$TARGET +RELEASE_URL="https://github.com/allanger/check-da-helm/releases/download/$LATEST_VERSION/$RELEASE_NAME" +echo "Link for downloading: $RELEASE_URL" +curl -LJO $RELEASE_URL + +mv $RELEASE_NAME cdh +chmod +x cdh + +echo 'Make sure that cdh is in your $PATH' +echo 'Try: ' +echo ' $ export PATH=$PATH:$PWD' +echo ' $ cdh -h' \ No newline at end of file diff --git a/scripts/rename_releases.sh b/scripts/rename_releases.sh new file mode 100755 index 0000000..02f42b3 --- /dev/null +++ b/scripts/rename_releases.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo 'renaming cdh to cdh-$VERSION-$SYSTEM format' +mkdir -p release +echo "version - $CDH_VERSION" +for BUILD in build*; do + SYSTEM=$(echo $BUILD | sed -e 's/build-//g') + echo "system - $SYSTEM" + cp $BUILD/cdh release/cdh-$CDH_VERSION-$SYSTEM +done +ls release -- 2.45.2 From d1ea6090edfb992869378f3f60d2edcb176be12f Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 16 Jan 2023 20:06:03 +0100 Subject: [PATCH 06/37] fix clippy and udeps errors --- Cargo.lock | 7 ------- Cargo.toml | 1 - src/main.rs | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8ef859..02db667 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,12 +32,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "build_html" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8ffb62af7b0911893e2d6126891b2a018e387078fa5d855cb42d0d90d88075" - [[package]] name = "bytecount" version = "0.6.3" @@ -54,7 +48,6 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" name = "cdh" version = "0.1.0" dependencies = [ - "build_html", "clap", "clap_complete", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index eef3fb2..a6e103e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ version-compare = "0.1.0" clap = { version = "4.1.1", features = ["derive", "env"] } serde_yaml = "0.9.16" tabled = "0.10.0" -build_html = "2.1.0" handlebars = "4.3.1" clap_complete = "4.0.6" diff --git a/src/main.rs b/src/main.rs index ed082ed..2031a8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -122,7 +122,7 @@ fn main() { } fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> Result<()> { - if local_chart.clone().name.is_some() { + if local_chart.name.is_some() { let version = local_chart.version.clone().unwrap(); let chart = local_chart.name.clone().unwrap(); return match version.is_empty() { -- 2.45.2 From e1d5b39275fccee493b6287f6ec3c367e3ec6b3a Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 16 Jan 2023 20:57:52 +0100 Subject: [PATCH 07/37] Update README.md --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 4e4d1c1..a322e3e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ # Check Da Helm > Your helm releases are outdated, aren't they? Now you can check! + +[![Version build](https://github.com/allanger/check-da-helm/actions/workflows/build-version.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/build-version.yaml) +[![Version container](https://github.com/allanger/check-da-helm/actions/workflows/container-version.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/container-version.yaml) +[![Stable container](https://github.com/allanger/check-da-helm/actions/workflows/container-stable.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/container-stable.yaml) + +## What's this? +It's a simple command line tool that lets you check whether your helm releases (currently installed by helmfile or argo) are outdated or not. Why it's created? But the main reason why it's created, is a necessity to check if helm releases that you have installed in your cluster still exist in repos. Once `Bitnami` removed old charts from their main repo and, I believe, everybody needed then some time to understand what happened. So I decided to write this tool. I was checking helmfiles and testing if chart were still in repos. And in case something is broken, I would be notified in the morning. Of course, broken helm charts are something you'll eventually know about, but it just feels better to know about them with this simple cli. + +## Install +### Dependencies +Depending on the tool you want to use `cdm` with, you must have either `helmfile` or `argocd` installed. And in any case you need to have `helm` + +### Download + +Get executable from github releases + +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 +$ cdm -h +``` + +### Build from source +1. Build binary +```BASH +$ cargo build --release +``` +2. Run `gum help` + -- 2.45.2 From 6793f17e3aa80f9a0afb0182c0ee19f416d8c927 Mon Sep 17 00:00:00 2001 From: allanger Date: Mon, 16 Jan 2023 21:05:07 +0100 Subject: [PATCH 08/37] Make CDH great (...not again) (#3) --- .github/workflows/build-version.yaml | 61 +++++++ .github/workflows/container-stable.yaml | 53 ++++++ .github/workflows/container-version.yaml | 53 ++++++ .github/workflows/tests.yaml | 57 +++++++ Cargo.lock | 17 +- Cargo.toml | 3 +- README.md | 31 ++++ scripts/download_cdh.sh | 50 ++++++ scripts/rename_releases.sh | 10 ++ src/connectors/argo.rs | 23 +-- src/connectors/helmfile.rs | 2 +- src/main.rs | 209 ++++------------------- src/output/mod.rs | 61 +++++++ src/types/mod.rs | 24 ++- 14 files changed, 460 insertions(+), 194 deletions(-) create mode 100644 .github/workflows/build-version.yaml create mode 100644 .github/workflows/container-stable.yaml create mode 100644 .github/workflows/container-version.yaml create mode 100644 .github/workflows/tests.yaml create mode 100755 scripts/download_cdh.sh create mode 100755 scripts/rename_releases.sh create mode 100644 src/output/mod.rs diff --git a/.github/workflows/build-version.yaml b/.github/workflows/build-version.yaml new file mode 100644 index 0000000..2bca855 --- /dev/null +++ b/.github/workflows/build-version.yaml @@ -0,0 +1,61 @@ +--- +name: "Version build" + +on: + push: + tags: + - "v*.*.*" + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features --target=${{ matrix.target }} + + - name: Archive build artifacts + uses: actions/upload-artifact@v2 + with: + name: build-${{matrix.target}} + path: ${{ github.workspace }}/target/${{ matrix.target }}/release/cdh + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v2 + + - name: Set version variable + run: echo "CDH_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Rename release to avoid name conflict + run: ./scripts/rename_releases.sh + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: release/* diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml new file mode 100644 index 0000000..9189fff --- /dev/null +++ b/.github/workflows/container-stable.yaml @@ -0,0 +1,53 @@ +--- +name: "Stable container" + +on: + push: + branches: + - main + paths: + - "src/**" + +jobs: + containerization: + runs-on: ubuntu-latest + 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 + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:stable + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:latest + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml new file mode 100644 index 0000000..d40f07e --- /dev/null +++ b/.github/workflows/container-version.yaml @@ -0,0 +1,53 @@ +--- +name: "Version container" + +on: + push: + tags: + - "v*.*.*" + +jobs: + containerization: + runs-on: ubuntu-latest + 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 + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:${{ env.TAG }} + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..b991a9b --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,57 @@ +--- +name: "Tests" + +on: + pull_request: + branches: + - main + paths: + - "src/**" + +jobs: + cargo_udeps: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - name: Install cargo-udeps + run: cargo install cargo-udeps --locked + + - name: Check dependencies + run: cargo +nightly udeps + + cargo_test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + - run: cargo test + cargo_clippy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + - run: cargo clippy diff --git a/Cargo.lock b/Cargo.lock index 011ec71..02db667 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,12 +32,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "build_html" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8ffb62af7b0911893e2d6126891b2a018e387078fa5d855cb42d0d90d88075" - [[package]] name = "bytecount" version = "0.6.3" @@ -54,8 +48,8 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" name = "cdh" version = "0.1.0" dependencies = [ - "build_html", "clap", + "clap_complete", "env_logger", "handlebars", "log", @@ -87,6 +81,15 @@ dependencies = [ "termcolor", ] +[[package]] +name = "clap_complete" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8955d4e8cd4f28f9a01c93a050194c4d131e73ca02f6636bcddbed867014d7" +dependencies = [ + "clap", +] + [[package]] name = "clap_derive" version = "4.1.0" diff --git a/Cargo.toml b/Cargo.toml index db36db3..a6e103e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,6 @@ version-compare = "0.1.0" clap = { version = "4.1.1", features = ["derive", "env"] } serde_yaml = "0.9.16" tabled = "0.10.0" -build_html = "2.1.0" handlebars = "4.3.1" +clap_complete = "4.0.6" + diff --git a/README.md b/README.md index 4e4d1c1..a322e3e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ # Check Da Helm > Your helm releases are outdated, aren't they? Now you can check! + +[![Version build](https://github.com/allanger/check-da-helm/actions/workflows/build-version.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/build-version.yaml) +[![Version container](https://github.com/allanger/check-da-helm/actions/workflows/container-version.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/container-version.yaml) +[![Stable container](https://github.com/allanger/check-da-helm/actions/workflows/container-stable.yaml/badge.svg)](https://github.com/allanger/check-da-helm/actions/workflows/container-stable.yaml) + +## What's this? +It's a simple command line tool that lets you check whether your helm releases (currently installed by helmfile or argo) are outdated or not. Why it's created? But the main reason why it's created, is a necessity to check if helm releases that you have installed in your cluster still exist in repos. Once `Bitnami` removed old charts from their main repo and, I believe, everybody needed then some time to understand what happened. So I decided to write this tool. I was checking helmfiles and testing if chart were still in repos. And in case something is broken, I would be notified in the morning. Of course, broken helm charts are something you'll eventually know about, but it just feels better to know about them with this simple cli. + +## Install +### Dependencies +Depending on the tool you want to use `cdm` with, you must have either `helmfile` or `argocd` installed. And in any case you need to have `helm` + +### Download + +Get executable from github releases + +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 +$ cdm -h +``` + +### Build from source +1. Build binary +```BASH +$ cargo build --release +``` +2. Run `gum help` + diff --git a/scripts/download_cdh.sh b/scripts/download_cdh.sh new file mode 100755 index 0000000..3d47749 --- /dev/null +++ b/scripts/download_cdh.sh @@ -0,0 +1,50 @@ +#!/bin/bash +case "$(uname)" in + +"Darwin") + SYSTEM="apple-darwin" + case $(uname -m) in + "arm64") + TARGET="aarch64-$SYSTEM" + ;; + "x86_64") + TARGET="x86_64-$SYSTEM" + ;; + *) + echo "Unsuported target" + exit 1 + ;; + esac + ;; +"Linux") + SYSTEM="unknown-linux-gnu" + case $(uname -m) in + "x86_64") + TARGET="x86_64-$SYSTEM" + ;; + *) + echo "Unsuported target" + exit 1 + ;; + esac + ;; +*) + echo "Signal number $1 is not processed" + 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) }')" +echo "Downloading $LATEST_VERSION" + +RELEASE_NAME=cdh-$LATEST_VERSION-$TARGET +RELEASE_URL="https://github.com/allanger/check-da-helm/releases/download/$LATEST_VERSION/$RELEASE_NAME" +echo "Link for downloading: $RELEASE_URL" +curl -LJO $RELEASE_URL + +mv $RELEASE_NAME cdh +chmod +x cdh + +echo 'Make sure that cdh is in your $PATH' +echo 'Try: ' +echo ' $ export PATH=$PATH:$PWD' +echo ' $ cdh -h' \ No newline at end of file diff --git a/scripts/rename_releases.sh b/scripts/rename_releases.sh new file mode 100755 index 0000000..02f42b3 --- /dev/null +++ b/scripts/rename_releases.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo 'renaming cdh to cdh-$VERSION-$SYSTEM format' +mkdir -p release +echo "version - $CDH_VERSION" +for BUILD in build*; do + SYSTEM=$(echo $BUILD | sed -e 's/build-//g') + echo "system - $SYSTEM" + cp $BUILD/cdh release/cdh-$CDH_VERSION-$SYSTEM +done +ls release diff --git a/src/connectors/argo.rs b/src/connectors/argo.rs index d1a302e..ecd2ed0 100644 --- a/src/connectors/argo.rs +++ b/src/connectors/argo.rs @@ -1,10 +1,13 @@ -use clap::Arg; -use log::{debug, info, error}; -use serde_json::from_str; use crate::types::{self, HelmRepo}; +use log::{debug, error, info}; +use serde_json::from_str; use super::Connector; -use std::{borrow::Borrow, io::{Result, Error, ErrorKind}, process::Command}; +use std::{ + borrow::Borrow, + io::{Error, ErrorKind, Result}, + process::Command, +}; pub(crate) struct Argo; @@ -96,7 +99,7 @@ impl Connector for Argo { ); } } - + Ok(()) } else { Err(Error::new( @@ -104,12 +107,10 @@ impl Connector for Argo { String::from_utf8_lossy(&output.stderr), )) } - } - } -impl Argo{ -pub(crate) fn init() -> Argo { - Argo +impl Argo { + pub(crate) fn init() -> Argo { + Argo + } } -} \ No newline at end of file diff --git a/src/connectors/helmfile.rs b/src/connectors/helmfile.rs index fb8ff6e..bae5885 100644 --- a/src/connectors/helmfile.rs +++ b/src/connectors/helmfile.rs @@ -4,7 +4,7 @@ use serde_json::from_str; use crate::types; use super::Connector; -use std::{borrow::Borrow, fmt::format, io::Result, process::Command}; +use std::{borrow::Borrow, io::Result, process::Command}; pub(crate) struct Helmfile { path: String, diff --git a/src/main.rs b/src/main.rs index 49ee268..2031a8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,21 @@ mod connectors; +mod output; mod types; - -use clap::{Parser, ValueEnum}; +use clap::{arg, command, Parser, Subcommand, ValueEnum}; use connectors::{Argo, Connector, Helm, Helmfile}; -use handlebars::Handlebars; use log::{debug, error, info, warn}; +use output::Output; use serde::{Deserialize, Serialize}; use serde_json::from_str; use std::{ borrow::Borrow, - fmt::{self, format}, - io::{Error, ErrorKind, Result}, + io::Result, process::{exit, Command}, }; -use tabled::Tabled; +use types::ExecResult; use version_compare::{Cmp, Version}; -use crate::types::HelmChart; +use crate::types::{HelmChart, Status}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] enum Kinds { @@ -25,13 +24,22 @@ enum Kinds { Helmfile, } +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] +enum Outputs { + Yaml, + HTML, +} + /// Check you helm releaseas managed by Argo #[derive(Parser)] #[clap(author, version, about, long_about = None)] struct Args { - /// Type of the + /// How do you install your helm charts #[clap(long, value_enum)] kind: Kinds, + /// What kind of output would you like to receive? + #[clap(long, value_enum, default_value = "yaml")] + output: Outputs, /// Path to the helmfile #[clap(short, long, value_parser, default_value = "./")] path: String, @@ -43,6 +51,14 @@ struct Args { no_sync: bool, } +#[derive(Debug, Subcommand)] +enum Commands { + #[command(arg_required_else_help = true)] + Generate { + #[arg(value_name = "SHELL", default_missing_value = "zsh")] + shell: clap_complete::shells::Shell, + }, +} /// A struct to write helm repo description to #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] struct Repo { @@ -58,42 +74,7 @@ struct LocalCharts { version: Option, } -/// Three possible statuses of versions comparison -#[derive(Clone, Serialize)] -enum Status { - Uptodate, - Outdated, - Missing, -} - -impl fmt::Display for Status { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Status::Uptodate => write!(f, "Up-to-date"), - Status::Outdated => write!(f, "Outdated"), - Status::Missing => write!(f, "Missing"), - } - } -} -#[derive(Clone, Tabled, Serialize)] -struct ExecResult { - name: String, - latest_version: String, - current_version: String, - status: Status, -} - // Implementation for the ExecResult struct -impl ExecResult { - fn new(name: String, latest_version: String, current_version: String, status: Status) -> Self { - Self { - name, - latest_version, - current_version, - status, - } - } -} fn main() { // Preparations step @@ -110,7 +91,7 @@ fn main() { if !args.no_sync { info!("syncing helm repositories"); - let res = match args.kind { + 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(), @@ -122,12 +103,12 @@ fn main() { } charts.iter().for_each(|a| { - let err = check_chart(&mut result, a); + check_chart(&mut result, a).unwrap(); }); // Parse the helmfile // Handling the result - match handle_result(&result, args.outdated_fail) { + match handle_result(&result, args.outdated_fail, args.output) { Ok(result) => { if result { exit(1); @@ -141,7 +122,7 @@ fn main() { } fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> Result<()> { - if local_chart.clone().name.is_some() { + if local_chart.name.is_some() { let version = local_chart.version.clone().unwrap(); let chart = local_chart.name.clone().unwrap(); return match version.is_empty() { @@ -215,7 +196,11 @@ fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> } /// Handle result -fn handle_result(result: &Vec, outdated_fail: bool) -> Result { +fn handle_result( + result: &Vec, + outdated_fail: bool, + output_kind: Outputs, +) -> Result { let mut failed = false; for r in result.clone() { match r.status { @@ -238,135 +223,15 @@ fn handle_result(result: &Vec, outdated_fail: bool) -> Result } } } - let template = r#" - - - - - - - - {{#each this as |tr|}} - - - - - - - {{/each}} -
Chart NameCurrent VersionLatest VersionStatus
{{tr.name}}{{tr.current_version}}{{tr.latest_version}}{{tr.status}}
-"#; - let mut reg = Handlebars::new(); - // TODO: Handle this error - reg.register_template_string("html_table", template) - .unwrap(); - - match reg.render("html_table", &result) { - Ok(res) => println!("{}", res), - Err(err) => error!("{}", err), + match output_kind { + Outputs::Yaml => print!("{}", output::YAML::print(result)?), + Outputs::HTML => print!("{}", output::HTML::print(result)?), }; + Ok(failed) } -/// Downloading repos from repositories -fn repo_sync() -> Result<()> { - info!("syncing helm repos"); - let cmd: String = "argocd app list -o json | jq '[ .[] | {name: .spec.source.chart, url: .spec.source.repoURL} ]'".to_string(); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helmfile is failed"); - info!("{:?}", output.clone()); - if output.status.success() { - let repos: Vec = serde_json::from_slice(&output.stdout).unwrap(); - info!("adding repositories"); - for repo in repos.iter() { - let name = repo.name.clone(); - if name.is_some() { - info!( - "syncing {} with the origin {}", - name.clone().unwrap(), - repo.url - ); - let cmd = format!( - "helm repo add {} {}", - name.clone().unwrap(), - repo.url.clone() - ); - debug!("running {}", cmd); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helm repo sync is failed"); - match output.status.success() { - true => { - info!( - "{} with the origin {} is synced successfully", - name.unwrap(), - repo.url - ); - } - false => { - error!( - "{} with the origin {} can't be synced", - name.unwrap(), - repo.url - ) - } - } - } - } - let cmd = "helm repo update"; - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helm repo sync is failed"); - match output.status.success() { - true => { - info!("repositories are updated successfully"); - } - false => { - error!( - "repositories can't be updated, {}", - String::from_utf8_lossy(&output.stderr) - ); - } - } - - Ok(()) - } else { - Err(Error::new( - ErrorKind::Other, - String::from_utf8_lossy(&output.stderr), - )) - } -} - -/// Run helmfile list and write the result into struct -fn parse_argo_apps() -> Result> { - let cmd: String = "argocd app list -o json | jq '[.[] | {chart: .spec.source.chart, version: .spec.source.targetRevision}]'".to_string(); - - debug!("executing '${}'", cmd); - let output = Command::new("bash") - .arg("-c") - .arg(cmd) - .output() - .expect("helmfile is failed"); - let helm_stdout = String::from_utf8_lossy(&output.stdout); - - match from_str::>(Borrow::borrow(&helm_stdout)) { - Ok(mut charts) => { - charts.dedup(); - Ok(charts) - } - Err(err) => Err(err.into()), - } -} - /// Takes two version and returns the newer one. fn get_newer_version(v1: String, v2: String) -> String { match Version::from(&v1.replace('v', "")) diff --git a/src/output/mod.rs b/src/output/mod.rs new file mode 100644 index 0000000..2423b5b --- /dev/null +++ b/src/output/mod.rs @@ -0,0 +1,61 @@ +use std::io::{Result, Error, ErrorKind}; + +use handlebars::Handlebars; +use log::error; + +use crate::types::ExecResult; + +pub(crate) trait Output { + fn print(data: &Vec) -> Result; +} + +pub(crate) struct HTML; + +impl Output for HTML { + fn print(data: &Vec) -> Result { + // To generate htlm output, I have to use templates because I haven't found any other good + // solution + let template = r#" + + + + + + + + {{#each this as |tr|}} + + + + + + + {{/each}} +
Chart NameCurrent VersionLatest VersionStatus
{{tr.name}}{{tr.current_version}}{{tr.latest_version}}{{tr.status}}
+"#; + + let mut reg = Handlebars::new(); + // TODO: Handle this error + reg.register_template_string("html_table", template) + .unwrap(); + + match reg.render("html_table", &data) { + Ok(res) => Ok(res), + Err(err) => { + error!("{}", err); + return Err(Error::new(ErrorKind::InvalidInput, err.to_string())); + } + } + } +} + +pub(crate) struct YAML; + +impl Output for YAML { + fn print(data: &Vec) -> Result { + match serde_yaml::to_string(&data) { + Ok(res) => return Ok(res), + Err(err) => return Err(Error::new(ErrorKind::InvalidData, err.to_string())), + } + } +} diff --git a/src/types/mod.rs b/src/types/mod.rs index a0be023..eaf52b4 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,5 +1,6 @@ use serde::{Deserialize, Serialize}; use std::fmt; +use tabled::Tabled; /// Struct for parsing charts info from helmfile #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] @@ -15,8 +16,8 @@ pub(crate) struct HelmRepo { pub(crate) url: String, } -#[derive(Clone, Serialize)] -enum Status { +#[derive(Clone, Serialize, Deserialize)] +pub(crate) enum Status { Uptodate, Outdated, Missing, @@ -31,3 +32,22 @@ impl fmt::Display for Status { } } } + +#[derive(Clone, Tabled, Serialize, Deserialize)] +pub(crate) struct ExecResult { + pub(crate) name: 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 { + Self { + name, + latest_version, + current_version, + status, + } + } +} -- 2.45.2 From e6e9c7b248fd441c6dc10e981d32b7205d6bceaf Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 16 Jan 2023 21:53:37 +0100 Subject: [PATCH 09/37] Fix the download script and update README --- README.md | 2 +- scripts/download_cdh.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a322e3e..1100173 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/scripts/download_cdh.sh b/scripts/download_cdh.sh index 3d47749..1211dfa 100755 --- a/scripts/download_cdh.sh +++ b/scripts/download_cdh.sh @@ -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' \ No newline at end of file +echo ' $ cdh -h' -- 2.45.2 From 6acf7a4dd1dedfae06654b96c182ebde9271bd9f Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 25 Jan 2023 13:01:24 +0100 Subject: [PATCH 10/37] add no_uptodate option --- src/main.rs | 11 +++++++++-- src/types/mod.rs | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2031a8f..64424e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,9 @@ struct Args { /// 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)] @@ -108,7 +111,7 @@ fn main() { // 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); @@ -197,11 +200,15 @@ fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> /// Handle result fn handle_result( - result: &Vec, + result: &mut Vec, outdated_fail: bool, output_kind: Outputs, + no_uptodate: bool, ) -> Result { 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), diff --git a/src/types/mod.rs b/src/types/mod.rs index eaf52b4..ca312a6 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -16,7 +16,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, @@ -42,7 +42,12 @@ pub(crate) struct ExecResult { } impl ExecResult { - pub(crate) fn new(name: String, latest_version: String, current_version: String, status: Status) -> Self { + pub(crate) fn new( + name: String, + latest_version: String, + current_version: String, + status: Status, + ) -> Self { Self { name, latest_version, -- 2.45.2 From 1a477790c4622a76f7733f42f3e8cb8eb8a016b1 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 25 Jan 2023 13:49:53 +0100 Subject: [PATCH 11/37] Update version in Cargo.toml to 0.1.1 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02db667..3f3e437 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdh" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index a6e103e..07768ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.0" +version = "0.1.1" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" -- 2.45.2 From aa3435ee7b0da62ef2109f7eddc815e9e0341c73 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 14 Feb 2023 21:16:34 +0000 Subject: [PATCH 12/37] Add docker images (#5) --- .dockerignore | 1 + .github/workflows/container-stable.yaml | 44 ++++++++++++++++++++---- .github/workflows/container-version.yaml | 41 +++++++++++++++++++--- Dockerfile | 10 ++++++ Makefile | 2 ++ dockerfiles/Dockerfile-argo | 11 ++++++ dockerfiles/Dockerfile-helmfile | 16 +++++++++ scripts/download_for_arch.sh | 15 ++++++++ src/connectors/helmfile.rs | 12 ++++--- src/main.rs | 7 ++-- 10 files changed, 140 insertions(+), 19 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 dockerfiles/Dockerfile-argo create mode 100644 dockerfiles/Dockerfile-helmfile create mode 100755 scripts/download_for_arch.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml index 9189fff..f3e145b 100644 --- a/.github/workflows/container-stable.yaml +++ b/.github/workflows/container-stable.yaml @@ -5,8 +5,6 @@ on: push: branches: - main - paths: - - "src/**" jobs: containerization: @@ -26,15 +24,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 }} @@ -43,8 +39,42 @@ 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 }} + - name: Build helmfile + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: ./dockerfiles + file: ./dockerfiles/Dockerfile-helmfile + platforms: linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}-helmfile:latest + ghcr.io/${{ github.repository }}-helmfile:stable + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} + + - name: Build argo + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: ./dockerfiles + file: ./dockerfiles/Dockerfile-argo + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}-argo:latest + ghcr.io/${{ github.repository }}-argo:stable labels: | action_id=${{ github.action }} action_link=${{ env.LINK }} diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index d40f07e..288ad56 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -1,5 +1,5 @@ --- -name: "Version container" +name: "Versioned container" on: push: @@ -27,15 +27,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,7 +42,40 @@ 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 }} + - name: Build helmfile + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: ./dockerfiles + file: ./dockerfiles/Dockerfile-helmfile + platforms: linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}-helmfile:${{ env.TAG }} + labels: | + action_id=${{ github.action }} + action_link=${{ env.LINK }} + actor=${{ github.actor }} + sha=${{ github.sha }} + ref=${{ github.ref }} + + - name: Build argo + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: ./dockerfiles + file: ./dockerfiles/Dockerfile-argo + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository }}-argo:${{ env.TAG }} labels: | action_id=${{ github.action }} action_link=${{ env.LINK }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0587e3d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM rust:1.66.1-alpine3.17 as builder +WORKDIR /src +RUN apk update && apk add --no-cache gcc musl-dev +COPY ./ . +RUN cargo build --release + +FROM alpine:3.17.1 +COPY --from=builder /src/target/release/cdh /bin/cdh +WORKDIR /workdir +ENTRYPOINT ["/bin/cdh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..acf3e73 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +build: + cargo build --release diff --git a/dockerfiles/Dockerfile-argo b/dockerfiles/Dockerfile-argo new file mode 100644 index 0000000..3d25b9b --- /dev/null +++ b/dockerfiles/Dockerfile-argo @@ -0,0 +1,11 @@ +FROM ghcr.io/allanger/dumb-downloader as builder +ARG ARGOCD_VERSION=v2.5.10 +ENV RUST_LOG=info +RUN mkdir /out +RUN dudo -l "https://github.com/argoproj/argo-cd/releases/download/{{ version }}/argocd-{{ os }}-{{ arch }}" -i /tmp/argocd -p $ARGOCD_VERSION +RUN mv /tmp/argocd /out/argocd && chmod +x /out/argocd + +FROM ghcr.io/allanger/check-da-helm-base +COPY --from=builder /out/ /usr/bin +RUN apk update --no-cache && apk add --no-cache jq bash +ENTRYPOINT ["cdh"] diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile new file mode 100644 index 0000000..c32a215 --- /dev/null +++ b/dockerfiles/Dockerfile-helmfile @@ -0,0 +1,16 @@ +FROM ghcr.io/allanger/dumb-downloader as builder +RUN apt-get update -y && apt-get install tar -y +ARG HELM_VERSION=v3.10.3 +ARG HELMFILE_VERSION=0.150.0 +ENV RUST_LOG=info +RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -i /tmp/helmfile -p $HELMFILE_VERSION +RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -i /tmp/helm.tar.gz -p $HELM_VERSION +RUN tar -xf /tmp/helm.tar.gz -C /tmp && rm -f /tmp/helm.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 +COPY --from=builder /out/ /usr/bin +RUN apk update --no-cache && apk add --no-cache jq bash +ENTRYPOINT ["cdh"] diff --git a/scripts/download_for_arch.sh b/scripts/download_for_arch.sh new file mode 100755 index 0000000..09287e9 --- /dev/null +++ b/scripts/download_for_arch.sh @@ -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 diff --git a/src/connectors/helmfile.rs b/src/connectors/helmfile.rs index bae5885..ca495ae 100644 --- a/src/connectors/helmfile.rs +++ b/src/connectors/helmfile.rs @@ -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> { let cmd: String = format!( - "helmfile -f {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'", - self.path + "helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'", + 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 {} sync", self.path, self.env); Command::new("bash") .arg("-c") .arg(cmd) @@ -47,7 +49,7 @@ 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} } } diff --git a/src/main.rs b/src/main.rs index 64424e9..7939b39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,6 +43,9 @@ 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, @@ -88,7 +91,7 @@ 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()).get_app(), + Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(), } .unwrap(); @@ -97,7 +100,7 @@ fn main() { 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::Helmfile => Helmfile::init(args.path, args.helmfile_environment).sync_repos(), }; match res { Ok(_) => info!("helm repos are synced"), -- 2.45.2 From b59696129137a823c145271985fd5fe51ad8f6cb Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 15 Feb 2023 09:01:11 +0100 Subject: [PATCH 13/37] Version v0.1.2 --- .github/workflows/container-version.yaml | 4 ++++ Cargo.lock | 2 +- Cargo.toml | 2 +- dockerfiles/Dockerfile-helmfile | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index 288ad56..662af96 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -52,6 +52,8 @@ jobs: - name: Build helmfile uses: docker/build-push-action@v2 with: + build-args: | + BASE_VERSION=${{ env.TAG }} builder: ${{ steps.buildx.outputs.name }} context: ./dockerfiles file: ./dockerfiles/Dockerfile-helmfile @@ -70,6 +72,8 @@ jobs: uses: docker/build-push-action@v2 with: builder: ${{ steps.buildx.outputs.name }} + build-args: | + BASE_VERSION=${{ env.TAG }} context: ./dockerfiles file: ./dockerfiles/Dockerfile-argo platforms: linux/amd64,linux/arm64 diff --git a/Cargo.lock b/Cargo.lock index 3f3e437..17ef53b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdh" -version = "0.1.1" +version = "0.1.2" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index 07768ea..3d17b49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.1" +version = "0.1.2" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index c32a215..1f165df 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -1,4 +1,5 @@ -FROM ghcr.io/allanger/dumb-downloader as builder +ARG BASE_VERSION=latest +FROM ghcr.io/allanger/dumb-downloader:${BASE_VERSION} as builder RUN apt-get update -y && apt-get install tar -y ARG HELM_VERSION=v3.10.3 ARG HELMFILE_VERSION=0.150.0 -- 2.45.2 From dad5fbdb151d89bbbe8697bbaae06079d3303d8d Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 15 Feb 2023 10:02:02 +0100 Subject: [PATCH 14/37] fix: versioned docker builds must work now --- dockerfiles/Dockerfile-argo | 3 ++- dockerfiles/Dockerfile-helmfile | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dockerfiles/Dockerfile-argo b/dockerfiles/Dockerfile-argo index 3d25b9b..f71de2e 100644 --- a/dockerfiles/Dockerfile-argo +++ b/dockerfiles/Dockerfile-argo @@ -1,3 +1,4 @@ +ARG BASE_VERSION=latest FROM ghcr.io/allanger/dumb-downloader as builder ARG ARGOCD_VERSION=v2.5.10 ENV RUST_LOG=info @@ -5,7 +6,7 @@ RUN mkdir /out RUN dudo -l "https://github.com/argoproj/argo-cd/releases/download/{{ version }}/argocd-{{ os }}-{{ arch }}" -i /tmp/argocd -p $ARGOCD_VERSION RUN mv /tmp/argocd /out/argocd && chmod +x /out/argocd -FROM ghcr.io/allanger/check-da-helm-base +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"] diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index 1f165df..01827d7 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -1,5 +1,5 @@ ARG BASE_VERSION=latest -FROM ghcr.io/allanger/dumb-downloader:${BASE_VERSION} as builder +FROM ghcr.io/allanger/dumb-downloader as builder RUN apt-get update -y && apt-get install tar -y ARG HELM_VERSION=v3.10.3 ARG HELMFILE_VERSION=0.150.0 @@ -11,7 +11,7 @@ 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 +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"] -- 2.45.2 From 34a957ef4a519cd62f4b527694a550e3a92492cd Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 15 Feb 2023 10:02:37 +0100 Subject: [PATCH 15/37] Version v0.1.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17ef53b..bdd2b39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdh" -version = "0.1.2" +version = "0.1.3" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index 3d17b49..f690782 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.2" +version = "0.1.3" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" -- 2.45.2 From 7adb5f0a4a9a96ca90a902f7c0bd56e046a2cd2c Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 15 Feb 2023 14:20:58 +0100 Subject: [PATCH 16/37] Fix helmfile dockerfile --- dockerfiles/Dockerfile-helmfile | 3 ++- examples/helmfile.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index 01827d7..9f72f9d 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -4,9 +4,10 @@ RUN apt-get update -y && apt-get install tar -y ARG HELM_VERSION=v3.10.3 ARG HELMFILE_VERSION=0.150.0 ENV RUST_LOG=info -RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -i /tmp/helmfile -p $HELMFILE_VERSION +RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -i /tmp/helmfile.tar.gz -p $HELMFILE_VERSION RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -i /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 diff --git a/examples/helmfile.yaml b/examples/helmfile.yaml index be825ca..271e7f2 100644 --- a/examples/helmfile.yaml +++ b/examples/helmfile.yaml @@ -11,4 +11,4 @@ releases: namespace: keel-system createNamespace: true chart: keel/keel - version: 0.9.11 + version: 0.9.10 -- 2.45.2 From 1c29b32407c6d0fb388af5a62096ad662ba3d7b5 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 5 Mar 2023 22:28:46 +0100 Subject: [PATCH 17/37] 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 --- .drone.yml | 26 ++++++++++++++++++++ Cargo.lock | 41 +++++++++++++++++++++++++++++++ Cargo.toml | 2 ++ examples/argocd/application.yaml | 18 ++++++++++++++ examples/helmfile.yaml | 19 ++++++++------- src/connectors/argo.rs | 4 +-- src/connectors/helmfile.rs | 42 +++++++++++++++++++++++++++++++- src/main.rs | 22 +++++++++++------ src/types/mod.rs | 7 +++++- 9 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 .drone.yml create mode 100644 examples/argocd/application.yaml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5074759 --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/Cargo.lock b/Cargo.lock index bdd2b39..760318a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,6 +57,7 @@ dependencies = [ "serde_json", "serde_yaml", "tabled", + "tempfile", "version-compare", ] @@ -175,6 +176,15 @@ dependencies = [ "libc", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.7" @@ -242,6 +252,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "io-lifetimes" version = "1.0.2" @@ -406,6 +425,15 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.6.0" @@ -539,6 +567,19 @@ dependencies = [ "syn", ] +[[package]] +name = "tempfile" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + [[package]] name = "termcolor" version = "1.1.3" diff --git a/Cargo.toml b/Cargo.toml index f690782..f827973 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,5 @@ tabled = "0.10.0" handlebars = "4.3.1" clap_complete = "4.0.6" +[dev-dependencies] +tempfile = "3.4.0" diff --git a/examples/argocd/application.yaml b/examples/argocd/application.yaml new file mode 100644 index 0000000..cd2cc2a --- /dev/null +++ b/examples/argocd/application.yaml @@ -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 diff --git a/examples/helmfile.yaml b/examples/helmfile.yaml index 271e7f2..4add955 100644 --- a/examples/helmfile.yaml +++ b/examples/helmfile.yaml @@ -1,14 +1,15 @@ repositories: - - name: keel - url: https://charts.keel.sh + - name: argo + url: https://argoproj.github.io/argo-helm releases: - # ----------------------------- - # -- Keel - # ----------------------------- - - name: keel + - name: argocd installed: true - namespace: keel-system + namespace: argocd createNamespace: true - chart: keel/keel - version: 0.9.10 + chart: argo/argo-cd + version: 5.23.3 + values: + - server: + extraArgs: + - --insecure diff --git a/src/connectors/argo.rs b/src/connectors/argo.rs index ecd2ed0..3bc7fb9 100644 --- a/src/connectors/argo.rs +++ b/src/connectors/argo.rs @@ -15,7 +15,7 @@ impl Connector for Argo { type ConnectorType = Argo; fn get_app(&self) -> Result> { - 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::>(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()), diff --git a/src/connectors/helmfile.rs b/src/connectors/helmfile.rs index ca495ae..524c2ed 100644 --- a/src/connectors/helmfile.rs +++ b/src/connectors/helmfile.rs @@ -14,7 +14,7 @@ pub(crate) struct Helmfile { impl Connector for Helmfile { fn get_app(&self) -> Result> { let cmd: String = format!( - "helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'", + "helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .chart, version: .version, name: .name}}]'", self.path, self.env ) @@ -48,8 +48,48 @@ impl Connector for Helmfile { type ConnectorType = Helmfile; } + impl Helmfile { 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 = vec![app]; + assert_eq!(apps, helmfile_app); + path.close().unwrap(); + } +} diff --git a/src/main.rs b/src/main.rs index 7939b39..99648b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,6 +109,7 @@ fn main() { } charts.iter().for_each(|a| { + debug!("{:?}", a); check_chart(&mut result, a).unwrap(); }); @@ -128,9 +129,9 @@ fn main() { } fn check_chart(result: &mut Vec, 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!( @@ -142,8 +143,8 @@ fn check_chart(result: &mut Vec, 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") @@ -156,6 +157,8 @@ fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> // Remove "v" from version definitions let mut versions: Vec = 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', "")); } @@ -172,8 +175,10 @@ fn check_chart(result: &mut Vec, 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()) { @@ -187,6 +192,7 @@ fn check_chart(result: &mut Vec, local_chart: &types::HelmChart) -> }; result.push(ExecResult::new( + local_chart.name.clone().unwrap(), chart.clone(), current_version.clone(), version.clone(), @@ -214,21 +220,21 @@ fn handle_result( } 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 ); } } diff --git a/src/types/mod.rs b/src/types/mod.rs index ca312a6..254f160 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -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, + // #[serde(alias = "name", alias = "chart")] + pub(crate) chart: Option, pub(crate) version: Option, } @@ -36,6 +38,7 @@ 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, @@ -44,12 +47,14 @@ pub(crate) struct ExecResult { impl ExecResult { 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, -- 2.45.2 From 3f6e88809e752c5903ffd41230202512487b598f Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 16 Mar 2023 16:55:34 +0100 Subject: [PATCH 18/37] fix: set --jobs in the main Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0587e3d..a920113 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM rust:1.66.1-alpine3.17 as builder WORKDIR /src RUN apk update && apk add --no-cache gcc musl-dev COPY ./ . -RUN cargo build --release +RUN cargo build --release --jobs 2 FROM alpine:3.17.1 COPY --from=builder /src/target/release/cdh /bin/cdh -- 2.45.2 From f4dd33d6df584dafcbfdaf576f03d1e5b06d6dae Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Fri, 17 Mar 2023 11:02:04 +0100 Subject: [PATCH 19/37] fix: Use the rust nightly toolchain --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a920113..311494e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM rust:1.66.1-alpine3.17 as builder WORKDIR /src RUN apk update && apk add --no-cache gcc musl-dev COPY ./ . -RUN cargo build --release --jobs 2 +RUN rustup default nightly && rustup update +RUN cargo build --release --jobs 2 -Z sparse-registry FROM alpine:3.17.1 COPY --from=builder /src/target/release/cdh /bin/cdh -- 2.45.2 From f6c15108148763b372d7d00adb18e987ea21379b Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 18 Mar 2023 18:36:20 +0100 Subject: [PATCH 20/37] chore: Update halmfile version --- dockerfiles/Dockerfile-helmfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index 9f72f9d..6870906 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -2,7 +2,7 @@ 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.10.3 -ARG HELMFILE_VERSION=0.150.0 +ARG HELMFILE_VERSION=0.151.0 ENV RUST_LOG=info RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -i /tmp/helmfile.tar.gz -p $HELMFILE_VERSION RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -i /tmp/helm.tar.gz -p $HELM_VERSION -- 2.45.2 From cc9ff758f4a3b0e604947189b9f647f9ec5ad618 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 18 Mar 2023 18:36:35 +0100 Subject: [PATCH 21/37] Version 0.1.5 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f827973..c46422e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.3" +version = "0.1.5" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" -- 2.45.2 From cff0139c0961faa4a515f7c10aee04b9a8e5ede2 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 22 Mar 2023 21:41:29 +0100 Subject: [PATCH 22/37] fix: Add amd64 to helmfile docker build --- .github/workflows/container-stable.yaml | 2 +- .github/workflows/container-version.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml index f3e145b..63cbe14 100644 --- a/.github/workflows/container-stable.yaml +++ b/.github/workflows/container-stable.yaml @@ -52,7 +52,7 @@ jobs: builder: ${{ steps.buildx.outputs.name }} context: ./dockerfiles file: ./dockerfiles/Dockerfile-helmfile - platforms: linux/arm64 + platforms: linux/amd64,linux/arm64 push: true tags: | ghcr.io/${{ github.repository }}-helmfile:latest diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index 662af96..f5d1a3a 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -57,7 +57,7 @@ jobs: builder: ${{ steps.buildx.outputs.name }} context: ./dockerfiles file: ./dockerfiles/Dockerfile-helmfile - platforms: linux/arm64 + platforms: linux/amd64,linux/arm64 push: true tags: | ghcr.io/${{ github.repository }}-helmfile:${{ env.TAG }} -- 2.45.2 From c2f2a3b8e6c8063014da3287d237f1feda022bd1 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 4 Apr 2023 11:56:51 +0200 Subject: [PATCH 23/37] fix(critical): Use helmfile `repos` instead of `sync` --- Cargo.lock | 2 +- src/connectors/helmfile.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 760318a..54430cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdh" -version = "0.1.3" +version = "0.1.5" dependencies = [ "clap", "clap_complete", diff --git a/src/connectors/helmfile.rs b/src/connectors/helmfile.rs index 524c2ed..4166e68 100644 --- a/src/connectors/helmfile.rs +++ b/src/connectors/helmfile.rs @@ -37,7 +37,7 @@ impl Connector for Helmfile { } } fn sync_repos(&self) -> Result<()> { - let cmd: String = format!("helmfile -f {} -e {} sync", self.path, self.env); + let cmd: String = format!("helmfile -f {} -e {} repos", self.path, self.env); Command::new("bash") .arg("-c") .arg(cmd) -- 2.45.2 From 64ae4af142d55f4e0de5585c2e6ecd8d628d2a73 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 4 Apr 2023 11:57:27 +0200 Subject: [PATCH 24/37] Version 0.1.6 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 54430cd..597f58d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,7 +46,7 @@ checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdh" -version = "0.1.5" +version = "0.1.6" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index c46422e..1e27539 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.5" +version = "0.1.6" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" -- 2.45.2 From 1e8894efccb6059c6f2b8f207c94cbad4b47d2e7 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 4 Apr 2023 14:24:12 +0200 Subject: [PATCH 25/37] fix: Use the correct dudo argument in Dockerfiles --- dockerfiles/Dockerfile-argo | 2 +- dockerfiles/Dockerfile-helmfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfiles/Dockerfile-argo b/dockerfiles/Dockerfile-argo index f71de2e..c99d96f 100644 --- a/dockerfiles/Dockerfile-argo +++ b/dockerfiles/Dockerfile-argo @@ -3,7 +3,7 @@ FROM ghcr.io/allanger/dumb-downloader as builder ARG ARGOCD_VERSION=v2.5.10 ENV RUST_LOG=info RUN mkdir /out -RUN dudo -l "https://github.com/argoproj/argo-cd/releases/download/{{ version }}/argocd-{{ os }}-{{ arch }}" -i /tmp/argocd -p $ARGOCD_VERSION +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} diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index 6870906..b37755b 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -4,8 +4,8 @@ RUN apt-get update -y && apt-get install tar -y ARG HELM_VERSION=v3.10.3 ARG HELMFILE_VERSION=0.151.0 ENV RUST_LOG=info -RUN dudo -l "https://github.com/helmfile/helmfile/releases/download/v{{ version }}/helmfile_{{ version }}_{{ os }}_{{ arch }}.tar.gz" -i /tmp/helmfile.tar.gz -p $HELMFILE_VERSION -RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -i /tmp/helm.tar.gz -p $HELM_VERSION +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 -- 2.45.2 From c7e8a87a3685b286fcd43a1e624b4a1abb715db3 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 4 May 2023 12:31:31 +0200 Subject: [PATCH 26/37] Add an image with helm secrets installed --- .github/workflows/container-stable.yaml | 60 ++++++++++++++-------- .github/workflows/container-version.yaml | 65 +++++++++++++++--------- dockerfiles/Dockerfile-helmfile-secrets | 24 +++++++++ 3 files changed, 103 insertions(+), 46 deletions(-) create mode 100644 dockerfiles/Dockerfile-helmfile-secrets diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml index 63cbe14..5c14b37 100644 --- a/.github/workflows/container-stable.yaml +++ b/.github/workflows/container-stable.yaml @@ -7,7 +7,8 @@ on: - main jobs: - containerization: + prepare_base: + name: Prepare the base image runs-on: ubuntu-latest steps: - name: Checkout @@ -30,6 +31,7 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.CR_PAT }} + - name: Build base uses: docker/build-push-action@v2 with: @@ -46,35 +48,49 @@ jobs: actor=${{ github.actor }} sha=${{ github.sha }} ref=${{ github.ref }} - - name: Build helmfile - uses: docker/build-push-action@v2 - with: - builder: ${{ steps.buildx.outputs.name }} - context: ./dockerfiles - file: ./dockerfiles/Dockerfile-helmfile - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/${{ github.repository }}-helmfile:latest - ghcr.io/${{ github.repository }}-helmfile:stable - 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 + strategy: + matrix: + target_image: + - helmfile + - helmfile-secrets + - argo + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Build argo + - 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-argo + file: ./dockerfiles/Dockerfile-$${{ matrix.target_image }} platforms: linux/amd64,linux/arm64 push: true tags: | - ghcr.io/${{ github.repository }}-argo:latest - ghcr.io/${{ github.repository }}-argo:stable + 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 }} diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index f5d1a3a..8510f6f 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -7,7 +7,8 @@ on: - "v*.*.*" jobs: - containerization: + build_base: + name: Prepare the base image runs-on: ubuntu-latest steps: - name: Checkout @@ -49,40 +50,56 @@ jobs: actor=${{ github.actor }} sha=${{ github.sha }} ref=${{ github.ref }} - - name: Build helmfile - uses: docker/build-push-action@v2 - with: - build-args: | - BASE_VERSION=${{ env.TAG }} - builder: ${{ steps.buildx.outputs.name }} - context: ./dockerfiles - file: ./dockerfiles/Dockerfile-helmfile - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/${{ github.repository }}-helmfile:${{ 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 + strategy: + matrix: + target_image: + - helmfile + - helmfile-secrets + - argo + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Build argo + - 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 }} - build-args: | - BASE_VERSION=${{ env.TAG }} context: ./dockerfiles - file: ./dockerfiles/Dockerfile-argo + file: ./dockerfiles/Dockerfile-$${{ matrix.target_image }} platforms: linux/amd64,linux/arm64 push: true tags: | - ghcr.io/${{ github.repository }}-argo:${{ env.TAG }} + 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 }} + \ No newline at end of file diff --git a/dockerfiles/Dockerfile-helmfile-secrets b/dockerfiles/Dockerfile-helmfile-secrets new file mode 100644 index 0000000..5e3f4f2 --- /dev/null +++ b/dockerfiles/Dockerfile-helmfile-secrets @@ -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.10.3 +ARG HELMFILE_VERSION=0.151.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 mozilla/sops:v3.7-alpine as sops +WORKDIR /out +RUN cp $(which sops) /out/sops + +FROM ghcr.io/allanger/check-da-helm-base:${BASE_VERSION} +COPY --from=builder /out/ /usr/bin +COPY --from=sops /out/ /usr/bin +RUN apk update --no-cache && apk add --no-cache jq bash age git +RUN helm plugin install https://github.com/jkroepke/helm-secrets --version v4.4.2 +ENTRYPOINT ["cdh"] -- 2.45.2 From 6c04658d0dfb4d04efef82e1c2b864e3293e3e30 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 4 May 2023 12:32:47 +0200 Subject: [PATCH 27/37] Fix the build --- .github/workflows/container-stable.yaml | 2 +- .github/workflows/container-version.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml index 5c14b37..cee9ba2 100644 --- a/.github/workflows/container-stable.yaml +++ b/.github/workflows/container-stable.yaml @@ -85,7 +85,7 @@ jobs: with: builder: ${{ steps.buildx.outputs.name }} context: ./dockerfiles - file: ./dockerfiles/Dockerfile-$${{ matrix.target_image }} + file: ./dockerfiles/Dockerfile-${{ matrix.target_image }} platforms: linux/amd64,linux/arm64 push: true tags: | diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index 8510f6f..07ac535 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -90,7 +90,7 @@ jobs: with: builder: ${{ steps.buildx.outputs.name }} context: ./dockerfiles - file: ./dockerfiles/Dockerfile-$${{ matrix.target_image }} + file: ./dockerfiles/Dockerfile-${{ matrix.target_image }} platforms: linux/amd64,linux/arm64 push: true tags: | -- 2.45.2 From d941ea51e746dd0b3bb8215eb45d8ef1cbf88fd3 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 4 May 2023 12:34:14 +0200 Subject: [PATCH 28/37] Add jobs dependency --- .github/workflows/container-stable.yaml | 1 + .github/workflows/container-version.yaml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/container-stable.yaml b/.github/workflows/container-stable.yaml index cee9ba2..0748112 100644 --- a/.github/workflows/container-stable.yaml +++ b/.github/workflows/container-stable.yaml @@ -52,6 +52,7 @@ jobs: build_containers: name: Build final images runs-on: ubuntu-latest + needs: prepare_base strategy: matrix: target_image: diff --git a/.github/workflows/container-version.yaml b/.github/workflows/container-version.yaml index 07ac535..0c2d1b2 100644 --- a/.github/workflows/container-version.yaml +++ b/.github/workflows/container-version.yaml @@ -7,7 +7,7 @@ on: - "v*.*.*" jobs: - build_base: + prepare_base: name: Prepare the base image runs-on: ubuntu-latest steps: @@ -54,6 +54,7 @@ jobs: build_containers: name: Build final images runs-on: ubuntu-latest + needs: prepare_base strategy: matrix: target_image: -- 2.45.2 From 7b370a8266c652df2e1feca2f4719d80afda68f2 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Thu, 4 May 2023 22:22:33 +0200 Subject: [PATCH 29/37] fix: Install sops from alpine testing repos --- dockerfiles/Dockerfile-helmfile-secrets | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dockerfiles/Dockerfile-helmfile-secrets b/dockerfiles/Dockerfile-helmfile-secrets index 5e3f4f2..f583955 100644 --- a/dockerfiles/Dockerfile-helmfile-secrets +++ b/dockerfiles/Dockerfile-helmfile-secrets @@ -12,13 +12,10 @@ 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 mozilla/sops:v3.7-alpine as sops -WORKDIR /out -RUN cp $(which sops) /out/sops FROM ghcr.io/allanger/check-da-helm-base:${BASE_VERSION} COPY --from=builder /out/ /usr/bin -COPY --from=sops /out/ /usr/bin -RUN apk update --no-cache && apk add --no-cache jq bash age git +RUN apk update --no-cache && apk add --no-cache jq bash age git &&\ + apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing sops RUN helm plugin install https://github.com/jkroepke/helm-secrets --version v4.4.2 ENTRYPOINT ["cdh"] -- 2.45.2 From 7f4b3033bd8ddaaebb20d912c5c4953c96ed6b4c Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 7 May 2023 11:12:48 +0200 Subject: [PATCH 30/37] Install sops with dudo --- dockerfiles/Dockerfile-helmfile-secrets | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dockerfiles/Dockerfile-helmfile-secrets b/dockerfiles/Dockerfile-helmfile-secrets index f583955..f8fbb1f 100644 --- a/dockerfiles/Dockerfile-helmfile-secrets +++ b/dockerfiles/Dockerfile-helmfile-secrets @@ -1,8 +1,9 @@ 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.10.3 -ARG HELMFILE_VERSION=0.151.0 +ARG HELM_VERSION=v3.11.3 +ARG HELMFILE_VERSION=0.153.1 +ARG SOPS_VERSION=v3.7.2 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 @@ -11,11 +12,13 @@ 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 &&\ - apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing sops +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"] -- 2.45.2 From edbab404e97e46a714a4618d5696f00900ea64cc Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 7 May 2023 11:17:02 +0200 Subject: [PATCH 31/37] chore: Update dependencies --- Cargo.lock | 436 +++++++++++++++++++++++++++++++++++------------------ Cargo.toml | 2 +- 2 files changed, 291 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 597f58d..e2f2366 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,13 +4,62 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.19" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" + +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +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 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -25,9 +74,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -40,13 +89,13 @@ checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" [[package]] name = "cc" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cdh" -version = "0.1.6" +version = "0.1.7" dependencies = [ "clap", "clap_complete", @@ -69,55 +118,66 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.1.1" +version = "4.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" +checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", - "is-terminal", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", "strsim", - "termcolor", ] [[package]] name = "clap_complete" -version = "4.1.0" +version = "4.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce8955d4e8cd4f28f9a01c93a050194c4d131e73ca02f6636bcddbed867014d7" +checksum = "1a19591b2ab0e3c04b588a0e04ddde7b9eaa423646d1b4a8092879216bf47473" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "clap_lex" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" + +[[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.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] @@ -134,9 +194,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", @@ -157,13 +217,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -193,9 +253,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", @@ -203,9 +263,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.5" +version = "4.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e4ab33f1213cdc25b5fa45c76881240cfe79284cf2b395e8b9e312a30a2fd" +checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a" dependencies = [ "log", "pest", @@ -223,18 +283,15 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[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.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "humantime" @@ -244,9 +301,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -263,43 +320,44 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.2" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ + "hermit-abi", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "edc207893e85c5d6be840e969b496b53d94cec8be2d501b214f50daa97fa8024" [[package]] name = "linux-raw-sys" -version = "0.1.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" +checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" [[package]] name = "log" @@ -318,15 +376,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.1" 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 = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "papergrid" @@ -341,9 +393,9 @@ dependencies = [ [[package]] name = "pest" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" +checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" dependencies = [ "thiserror", "ucd-trie", @@ -351,9 +403,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2" +checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" dependencies = [ "pest", "pest_generator", @@ -361,26 +413,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db" +checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "pest_meta" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" +checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" dependencies = [ "once_cell", "pest", - "sha1", + "sha2", ] [[package]] @@ -392,7 +444,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -409,36 +461,36 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ "aho-corasick", "memchr", @@ -447,55 +499,55 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" [[package]] name = "rustix" -version = "0.36.6" +version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -504,9 +556,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.16" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834" +checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" dependencies = [ "indexmap", "itoa", @@ -516,10 +568,10 @@ dependencies = [ ] [[package]] -name = "sha1" -version = "0.10.5" +name = "sha2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", @@ -534,9 +586,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.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -564,56 +627,56 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "tempfile" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" @@ -623,9 +686,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-width" @@ -635,15 +698,21 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unsafe-libyaml" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" +checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" + +[[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" @@ -684,57 +753,132 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/Cargo.toml b/Cargo.toml index 1e27539..c47c5c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.6" +version = "0.1.7" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" -- 2.45.2 From 52a3be2846638192c38af47b76ce87a4d8683a3e Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 7 May 2023 13:08:00 +0200 Subject: [PATCH 32/37] fix: Sync repos before listing apps --- src/main.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index 99648b0..33fca96 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,6 +87,19 @@ fn main() { env_logger::init(); let args = Args::parse(); let mut result: Vec = Vec::new(); + + 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.clone(), args.helmfile_environment.clone()).sync_repos(), + }; + match res { + Ok(_) => info!("helm repos are synced"), + Err(err) => error!("couldn't sync repos', {}", err), + } + } let charts = match args.kind { Kinds::Argo => Argo::init().get_app(), @@ -95,19 +108,6 @@ fn main() { } .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, args.helmfile_environment).sync_repos(), - }; - match res { - Ok(_) => info!("helm repos are synced"), - Err(err) => error!("couldn't sync repos', {}", err), - } - } - charts.iter().for_each(|a| { debug!("{:?}", a); check_chart(&mut result, a).unwrap(); -- 2.45.2 From 10a86abbbbf888434b277c1ae3fb527ff5245828 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 7 May 2023 13:11:42 +0200 Subject: [PATCH 33/37] Version 0.1.8 --- Cargo.lock | 14 +++++++------- Cargo.toml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2f2366..14dd364 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,7 +95,7 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cdh" -version = "0.1.7" +version = "0.1.8" dependencies = [ "clap", "clap_complete", @@ -382,9 +382,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "papergrid" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1526bb6aa9f10ec339fb10360f22c57edf81d5678d0278e93bc12a47ffbe4b01" +checksum = "1fdfe703c51ddc52887ad78fc69cd2ea78d895ffcd6e955c9d03566db8ab5bb1" dependencies = [ "bytecount", "fnv", @@ -608,9 +608,9 @@ dependencies = [ [[package]] name = "tabled" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c3ee73732ffceaea7b8f6b719ce3bb17f253fa27461ffeaf568ebd0cdb4b85" +checksum = "da1a2e56bbf7bfdd08aaa7592157a742205459eff774b73bc01809ae2d99dc2a" dependencies = [ "papergrid", "tabled_derive", @@ -619,9 +619,9 @@ 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", diff --git a/Cargo.toml b/Cargo.toml index c47c5c4..f32eeec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.7" +version = "0.1.8" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" @@ -13,7 +13,7 @@ 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.12.0" handlebars = "4.3.1" clap_complete = "4.0.6" -- 2.45.2 From b8353389ccac972b4e9101daa905bc4c328bd317 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Fri, 2 Jun 2023 11:55:37 +0200 Subject: [PATCH 34/37] Disable not-implemented yet helm support --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14dd364..b5fb014 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,7 +95,7 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cdh" -version = "0.1.8" +version = "0.1.9" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index f32eeec..d9e48c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cdh" authors = ["allanger "] -version = "0.1.8" +version = "0.1.9" description = "Your helm releases are outdated, aren't they? Now you can check" edition = "2021" diff --git a/src/main.rs b/src/main.rs index 33fca96..360e3dc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ use crate::types::{HelmChart, Status}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] enum Kinds { Argo, - Helm, + //Helm, Helmfile, } @@ -92,7 +92,7 @@ fn main() { info!("syncing helm repositories"); let res = match args.kind { Kinds::Argo => Argo::init().sync_repos(), - Kinds::Helm => Helm::init().sync_repos(), + // Kinds::Helm => Helm::init().sync_repos(), Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).sync_repos(), }; match res { @@ -103,7 +103,7 @@ fn main() { let charts = match args.kind { Kinds::Argo => Argo::init().get_app(), - Kinds::Helm => Helm::init().get_app(), + //Kinds::Helm => Helm::init().get_app(), Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(), } .unwrap(); -- 2.45.2 From d3ef1b87dbb35322ee851e3216ed3ce4a95fc05d Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 10 Jun 2023 00:07:14 +0200 Subject: [PATCH 35/37] Run `cargo update` to keep dependencies updated --- Cargo.lock | 204 ++++++++++++++++++----------------------------------- 1 file changed, 68 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5fb014..71eec2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -47,7 +47,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -57,7 +57,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -118,9 +118,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.2.7" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" +checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" dependencies = [ "clap_builder", "clap_derive", @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.2.7" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" +checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" dependencies = [ "anstream", "anstyle", @@ -142,30 +142,30 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.2.1" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a19591b2ab0e3c04b588a0e04ddde7b9eaa423646d1b4a8092879216bf47473" +checksum = "7f6b5c519bab3ea61843a7923d074b04245624bb84a64a8c150f5deb014e388b" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.2.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -223,7 +223,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -263,9 +263,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.6" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035ef95d03713f2c347a72547b7cd38cbc9af7cd51e6099fb62d586d4a6dee3a" +checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d" dependencies = [ "log", "pest", @@ -320,13 +320,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -338,7 +338,7 @@ dependencies = [ "hermit-abi", "io-lifetimes", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -349,24 +349,21 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "libc" -version = "0.2.143" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc207893e85c5d6be840e969b496b53d94cec8be2d501b214f50daa97fa8024" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "memchr" @@ -376,15 +373,15 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "papergrid" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdfe703c51ddc52887ad78fc69cd2ea78d895ffcd6e955c9d03566db8ab5bb1" +checksum = "ae7891b22598926e4398790c8fe6447930c72a67d36d983a49d6ce682ce83290" dependencies = [ "bytecount", "fnv", @@ -421,7 +418,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -461,18 +458,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -488,9 +485,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -499,9 +496,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "rustix" @@ -514,7 +511,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -525,22 +522,22 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "serde" -version = "1.0.162" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -597,9 +594,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -608,9 +605,9 @@ dependencies = [ [[package]] name = "tabled" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1a2e56bbf7bfdd08aaa7592157a742205459eff774b73bc01809ae2d99dc2a" +checksum = "994ca3cfbe91dd1756a82a605a150fd7c9d9196cddc7af0612c1999cef224588" dependencies = [ "papergrid", "tabled_derive", @@ -632,15 +629,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -669,7 +667,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -686,9 +684,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-width" @@ -751,37 +749,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -790,93 +764,51 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" -- 2.45.2 From da08ab2fc7ac7ca7116d98d929610f0ab966a0aa Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 27 Jun 2023 04:21:28 +0200 Subject: [PATCH 36/37] chore: Keep containers up-to-date --- dockerfiles/Dockerfile-argo | 2 +- dockerfiles/Dockerfile-helmfile | 4 ++-- dockerfiles/Dockerfile-helmfile-secrets | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dockerfiles/Dockerfile-argo b/dockerfiles/Dockerfile-argo index c99d96f..7913916 100644 --- a/dockerfiles/Dockerfile-argo +++ b/dockerfiles/Dockerfile-argo @@ -1,6 +1,6 @@ ARG BASE_VERSION=latest FROM ghcr.io/allanger/dumb-downloader as builder -ARG ARGOCD_VERSION=v2.5.10 +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 diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile index b37755b..d2ad685 100644 --- a/dockerfiles/Dockerfile-helmfile +++ b/dockerfiles/Dockerfile-helmfile @@ -1,8 +1,8 @@ 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.10.3 -ARG HELMFILE_VERSION=0.151.0 +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 diff --git a/dockerfiles/Dockerfile-helmfile-secrets b/dockerfiles/Dockerfile-helmfile-secrets index f8fbb1f..633780a 100644 --- a/dockerfiles/Dockerfile-helmfile-secrets +++ b/dockerfiles/Dockerfile-helmfile-secrets @@ -1,9 +1,9 @@ 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.11.3 -ARG HELMFILE_VERSION=0.153.1 -ARG SOPS_VERSION=v3.7.2 +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 -- 2.45.2 From 2a235516029b1a210bdee5d219b345f7cb1d7bcf Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 6 Aug 2023 20:51:19 +0200 Subject: [PATCH 37/37] Upgrade dependencies --- Cargo.lock | 341 +++++++++++++++++++---------------------- Cargo.toml | 2 +- Dockerfile | 4 +- examples/helmfile.yaml | 8 + 4 files changed, 168 insertions(+), 187 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71eec2f..2b39784 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,39 +4,38 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -52,26 +51,26 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "block-buffer" version = "0.10.4" @@ -83,15 +82,9 @@ dependencies = [ [[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.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "cdh" @@ -118,54 +111,52 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.3.3" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.3" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_complete" -version = "4.3.1" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6b5c519bab3ea61843a7923d074b04245624bb84a64a8c150f5deb014e388b" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.39", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -175,9 +166,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -204,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", @@ -216,34 +207,26 @@ dependencies = [ ] [[package]] -name = "errno" -version = "0.3.1" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +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", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fnv" @@ -263,9 +246,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" dependencies = [ "log", "pest", @@ -277,9 +260,9 @@ 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" @@ -289,9 +272,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "humantime" @@ -301,75 +284,54 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "indexmap" -version = "1.9.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "io-lifetimes", "rustix", "windows-sys", ] [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "log" -version = "0.4.18" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +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" @@ -379,9 +341,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "papergrid" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7891b22598926e4398790c8fe6447930c72a67d36d983a49d6ce682ce83290" +checksum = "a2ccbe15f2b6db62f9a9871642746427e297b0ceb85f9a7f1ee5ff47d184d0c8" dependencies = [ "bytecount", "fnv", @@ -390,19 +352,20 @@ dependencies = [ [[package]] name = "pest" -version = "2.6.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" dependencies = [ "pest", "pest_generator", @@ -410,22 +373,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.39", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" dependencies = [ "once_cell", "pest", @@ -458,36 +421,48 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.8.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +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", @@ -496,19 +471,18 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rustix" -version = "0.37.19" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ - "bitflags", + "bitflags 2.4.1", "errno", - "io-lifetimes", "libc", "linux-raw-sys", "windows-sys", @@ -516,35 +490,35 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -553,9 +527,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.21" +version = "0.9.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" dependencies = [ "indexmap", "itoa", @@ -566,9 +540,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -594,9 +568,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -605,9 +579,9 @@ dependencies = [ [[package]] name = "tabled" -version = "0.12.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994ca3cfbe91dd1756a82a605a150fd7c9d9196cddc7af0612c1999cef224588" +checksum = "dfe9c3632da101aba5131ed63f9eed38665f8b3c68703a6bb18124835c1a5d22" dependencies = [ "papergrid", "tabled_derive", @@ -629,11 +603,10 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall", @@ -643,62 +616,62 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.39", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +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.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +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.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "utf8parse" @@ -736,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", ] @@ -760,9 +733,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -775,42 +748,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/Cargo.toml b/Cargo.toml index d9e48c6..e5536ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ 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.12.0" +tabled = "0.14.0" handlebars = "4.3.1" clap_complete = "4.0.6" diff --git a/Dockerfile b/Dockerfile index 311494e..61ba6f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM rust:1.66.1-alpine3.17 as builder +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.17.1 +FROM alpine:3.18 COPY --from=builder /src/target/release/cdh /bin/cdh WORKDIR /workdir ENTRYPOINT ["/bin/cdh"] diff --git a/examples/helmfile.yaml b/examples/helmfile.yaml index 4add955..b0f2095 100644 --- a/examples/helmfile.yaml +++ b/examples/helmfile.yaml @@ -1,6 +1,9 @@ repositories: - name: argo url: https://argoproj.github.io/argo-helm + - name: bitnami + url: registry-1.docker.io/bitnamicharts + oci: true releases: - name: argocd @@ -13,3 +16,8 @@ releases: - server: extraArgs: - --insecure + + - name: redis + installed: true + chart: bitnami/redis + version: 17.13.1 -- 2.45.2