-
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
1 parent
5698801
commit ef2cc6f
Showing
6 changed files
with
205 additions
and
0 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 @@ | ||
* @DreamingRaven |
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,48 @@ | ||
name: Lint Helm Charts | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
CHARTS_DIR: "charts" | ||
K8S_VERSION: "1.31.0" | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine/helm:latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Environment Variables and Paths the GitHub Way | ||
run: | | ||
export GOPATH=$HOME/.go | ||
echo "GOPATH=$HOME/.go" >> $GITHUB_ENV | ||
echo "$GOPATH/bin" >> $GITHUB_PATH | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install Dependencies | ||
run: | | ||
apk add --no-cache git make musl-dev go | ||
go install github.com/yannh/kubeconform/cmd/kubeconform@v0.6.7 | ||
- name: Iteratively Lint Charts | ||
run: | | ||
for dir in ${{ env.CHARTS_DIR }}/*/ | ||
do | ||
echo "*************************************" | ||
dir=${dir%*/} # removes trailing "/" | ||
echo "linting ${dir} chart" | ||
helm dependency update "${dir}" | ||
helm lint "${dir}"/ | ||
# on run if not 'corvid' chart | ||
if [ "${dir}" != "${{ env.CHARTS_DIR }}/auth" ] && [ "${dir}" != "${{ env.CHARTS_DIR }}/kyverno" ]; then | ||
helm template --namespace tst "${dir}"/ | kubeconform -strict -kubernetes-version ${{ env.K8S_VERSION }} \ | ||
-schema-location './schemas/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \ | ||
-schema-location default \ | ||
-schema-location 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}/{{ .ResourceKind }}{{ .KindSuffix }}.json' \ | ||
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' | ||
fi | ||
echo "*************************************" | ||
done |
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: Build Helm Charts | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
CHARTS_DIR: "charts" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine/helm:latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Environment Variables and Paths the GitHub Way | ||
run: | | ||
export GOPATH=$HOME/.go | ||
echo "GOPATH=$HOME/.go" >> $GITHUB_ENV | ||
echo "$GOPATH/bin" >> $GITHUB_PATH | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install Dependencies | ||
run: | | ||
apk add --no-cache git make musl-dev go | ||
- name: Iteratively Build Charts | ||
run: | | ||
for dir in ${{ env.CHARTS_DIR }}/*/ | ||
do | ||
echo "*************************************" | ||
DIR=${dir%*/} # removes trailing "/" | ||
APP_VER=$(yq ".image.tag" ${DIR}/values.yaml | tr -d '"') | ||
if [ "${APP_VER}" == "null" ]; then | ||
echo "appVersion falling back to ${DIR}/Chart.yaml" | ||
APP_VER=$(yq ".appVersion" ${DIR}/Chart.yaml | tr -d '"') | ||
fi | ||
HELM_VER=$(yq ".version" ${DIR}/Chart.yaml | tr -d '"') | ||
echo "building ${DIR} chart (app: ${APP_VER}, chart: ${HELM_VER})" | ||
echo "helm dependency build ${DIR}" | ||
helm dependency build "${DIR}"/ | ||
echo "helm package '${DIR}/' --destination ./package --app-version ${APP_VER} --version=${HELM_VER}" | ||
helm package "${DIR}/" --destination ./package --app-version ${APP_VER} --version=${HELM_VER} | ||
echo "*************************************" | ||
done | ||
- name: Upload Charts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: charts | ||
path: ./package | ||
retention-days: 1 |
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,64 @@ | ||
name: Deploy Helm Charts | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
CHARTS_DIR: "charts" | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine/helm:latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Environment Variables and Paths the GitHub Way | ||
run: | | ||
export GOPATH=$HOME/.go | ||
echo "GOPATH=$HOME/.go" >> $GITHUB_ENV | ||
echo "$GOPATH/bin" >> $GITHUB_PATH | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install Dependencies | ||
run: | | ||
apk add --no-cache git tree make musl-dev go | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: charts | ||
path: package | ||
|
||
- name: Debug Artifacts | ||
run: | | ||
tree . | ||
- name: Login to GHCR OCI Registry | ||
run: | | ||
helm registry login ghcr.io -u DreamingRaven -p ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
HELM_EXPERIMENTAL_OCI: '1' | ||
|
||
- name: Helm Push Artifacts if Version Doesn't Exist | ||
run: | | ||
cd package | ||
for filename in *.tgz; do | ||
echo "*************************************" | ||
regex='([a-zA-Z0-9_-]+)-([v0-9\.-]+)\.tgz' | ||
chart_name=$(echo "$filename" | sed -E "s/$regex/\1/") | ||
chart_version=$(echo "$filename" | sed -E "s/$regex/\2/") | ||
echo "${chart_name} ${chart_version}" | ||
if helm pull oci://ghcr.io/DreamingRaven/"${chart_name}" --version "${chart_version}"; then | ||
echo "${chart_name} ${chart_version} exists, skipping ..." | ||
else | ||
echo "Pushing ${chart_name} ${chart_version} to ghcr.io/DreamingRaven" | ||
helm push "${filename}" oci://ghcr.io/DreamingRaven/ | ||
fi | ||
echo "*************************************" | ||
done | ||
env: | ||
HELM_EXPERIMENTAL_OCI: '1' | ||
shell: bash | ||
|
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,18 @@ | ||
name: Check Pipeline | ||
on: | ||
push: | ||
branches: | ||
- '**' # on push to any branch this pipeline should lint | ||
- '!main' # that is not master | ||
|
||
env: | ||
CHARTS_DIR: "charts" | ||
K8S_VERSION: "1.31.0" | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/0-lint.yaml | ||
build: | ||
uses: ./.github/workflows/1-build.yaml | ||
needs: | ||
- lint |
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,21 @@ | ||
name: Publish Pipeline | ||
on: | ||
push: | ||
branches: | ||
- 'main' # on push to any branch this pipeline should lint | ||
|
||
env: | ||
CHARTS_DIR: "charts" | ||
K8S_VERSION: "1.31.0" | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/0-lint.yaml | ||
build: | ||
uses: ./.github/workflows/1-build.yaml | ||
needs: | ||
- lint | ||
deploy: | ||
uses: ./.github/workflows/2-deploy.yaml | ||
needs: | ||
- build |