-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
460 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.