Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial draft of helmfile-linter #93

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions github/helmfile-linter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM alpine:3.10

LABEL maintainer="Cloud Posse <[email protected]>"

LABEL "com.github.actions.name"="Helmfile Linter"
LABEL "com.github.actions.description"="Check All Helmfiles for Errors"
LABEL "com.github.actions.icon"="activity"
LABEL "com.github.actions.color"="blue"

RUN apk add --no-cache \
bash \
ca-certificates \
curl \
jq \
git

RUN curl -L https://github.com/roboll/helmfile/releases/download/v0.137.0/helmfile_linux_amd64 \
--output helmfile_linux_amd64 && \
chmod 764 helmfile_linux_amd64

COPY entrypoint.sh /

RUN chmod 755 /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions github/helmfile-linter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'Helmfile Linter'
description: 'Check All Helmfiles for Errors'
author: 'Cloud Posse <[email protected]>'
runs:
using: 'docker'
image: 'Dockerfile'
branding:
icon: 'activity'
color: 'blue'
43 changes: 43 additions & 0 deletions github/helmfile-linter/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# set -x

# Gather list of helmfiles in current project according to the error text of `helmfile lint`:
# "It must be named helmfile.d/*.{yaml,yml}, helmfile.yaml, or charts.yaml, or otherwise
# specified with the --file flag"
# However, we won't find the helmfiles with custom names (specified using the --file flag in the
# helmfile command).
helmfiles=( $(find . -type f -name "helmfile.yaml" \
-a -not -path "*helmfile.d/*" \
-a -not -path "*.github/*") )
for new_helmfile in $(find . -type f -name "charts.yaml" \
-a -not -path "*helmfile.d/*" \
-a -not -path "*.github/*"); do
helmfiles+=("$new_helmfile")
done
for new_helmfile in $(find . -type f -path '*helmfile.d/*' \
-a \( -name '*.yaml' -o -name '*.yml' \) ); do
helmfiles+=("$new_helmfile")
done

# lint each helmfile
echo ""
echo "Linting helmfiles."
for unlinted_helmfile in "${helmfiles[@]}"; do
# Split up helmfile path in order to move to the containing directory
helmfile_dir=`dirname "$unlinted_helmfile"`

# save current directory
original_dir=$(pwd)

# move to new directory
cd $helmfile_dir
echo "Linting ${unlinted_helmfile}:"
/helmfile_linux_amd64 lint
echo ""

# move back to original directory
cd $original_dir
done
echo "Done linting helmfiles."
echo ""
28 changes: 28 additions & 0 deletions github/mega-linter/.automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .automation

This folder holds automation scripts to help `deploy` and `cleanup` **DockerHub** images of the **Mega-Linter**

## cleanup-docker.sh

This script uses **GitHub Actions** so that when a PR is merged and closed, the **GitHub Action** is triggered.
It will then search **DockerHub** for the image that was deployed during the development, and remove it.

## upload-docker.sh

This script uses **GitHub Actions** so that when a push to the repository is committed, it will complete the following:

- Checkout the source code
- Build the **Docker** container for **Mega-Linter** using that source code
- Upload the container to **DockerHub**

When the script is triggered on master, it will push with the tag:**latest** which is used by all scripting for general availability.
When the script is triggered in a branch, it will push with the tag:**NameOfBranch** which can be used for:

- _testing_
- _troubleshooting_
- _debugging_
- **Note:** The branch name will be reduced to alphanumeric for consistency and uploading

## test

This folder holds all **Test Cases** to help run the _CI/CT/CD_ process for the **Mega-Linter**.
Loading