[WAS-636] - Removed minio from AWS #14
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
name: File Validator | |
on: | |
pull_request: | |
branches: | |
- master | |
env: | |
AWS_DIRS: | | |
EnvironmentSetup/AWS/Source/cluster-autoscaler/ | |
EnvironmentSetup/AWS/Source/deployments/ | |
EnvironmentSetup/AWS/Source/hpa/ | |
EnvironmentSetup/AWS/Source/ingress/ | |
EnvironmentSetup/AWS/Source/namespace/ | |
EnvironmentSetup/AWS/Source/pvc/ | |
EnvironmentSetup/AWS/Source/services/ | |
EnvironmentSetup/AWS/Source/strimzi-kafka-deployment/ | |
AZURE_DIRS: | | |
EnvironmentSetup/Azure/Source/deployments/ | |
EnvironmentSetup/Azure/Source/hpa/ | |
EnvironmentSetup/Azure/Source/ingress/ | |
EnvironmentSetup/Azure/Source/namespace/ | |
EnvironmentSetup/Azure/Source/pvc/ | |
EnvironmentSetup/Azure/Source/services/ | |
EnvironmentSetup/Azure/Source/strimzi-kafka-deployment/ | |
jobs: | |
terraform-validation: | |
runs-on: ubuntu-latest | |
name: Validate Terraform | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: terraform-aws-validate | |
uses: dflook/terraform-validate@v1 | |
id: terraform-aws-validate | |
with: | |
path: EnvironmentSetup/AWS/Source/terraform | |
- name: terraform-azure-validate | |
uses: dflook/terraform-validate@v1 | |
id: terraform-azure-validate | |
with: | |
path: EnvironmentSetup/Azure/Source/terraform | |
- name: Validate failed | |
if: ${{ failure() && steps.validate.outputs.failure-reason == 'validate-failed' }} | |
run: echo "terraform validate failed" | |
kubernetes-validation: | |
runs-on: ubuntu-latest | |
name: Validate Kubernetes Manifests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install kubeconform | |
run: | | |
curl -L -o kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v0.6.3/kubeconform-linux-amd64.tar.gz | |
tar -xvf kubeconform.tar.gz | |
chmod +x kubeconform | |
mv kubeconform /usr/local/bin/ | |
- name: String manipulation | |
id: replace-to-spaces | |
run: | | |
ENDLINE_REMOVED_AWS_DIRS="${AWS_DIRS//[$'\n']/$' '}" | |
ENDLINE_REMOVED_AZURE_DIRS="${AZURE_DIRS//[$'\n']/$' '}" | |
echo "endline-removed-aws-dirs=$ENDLINE_REMOVED_AWS_DIRS" >> $GITHUB_OUTPUT | |
echo "endline-removed-azure-dirs=$ENDLINE_REMOVED_AZURE_DIRS" >> $GITHUB_OUTPUT | |
- name: Validate AWS Kubernetes manifests | |
run: | | |
kubeconform -summary -strict -ignore-missing-schemas ${{ steps.replace-to-spaces.outputs.endline-removed-aws-dirs }} | |
- name: Validate Azure Kubernetes manifests | |
run: | | |
kubeconform -summary -strict -ignore-missing-schemas ${{ steps.replace-to-spaces.outputs.endline-removed-azure-dirs }} | |
image-validation: | |
runs-on: ubuntu-latest | |
name: Validate Images | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install yq | |
run: | | |
curl -LO "https://github.com/mikefarah/yq/releases/download/v4.12.0/yq_linux_amd64" | |
chmod +x yq_linux_amd64 | |
sudo mv yq_linux_amd64 /usr/local/bin/yq | |
shell: bash | |
- name: Validate Images | |
run: | | |
if [ -n "$(find "EnvironmentSetup/" -type f -name '*.yaml' -o -name '*.yml')" ]; then | |
for file in $(find "EnvironmentSetup/" -type f -name '*.yaml' -o -name '*.yml'); do | |
images=$(yq eval '.spec.template.spec.containers[].image' "$file") | |
for image in $images; do | |
if [[ $image == "---" || $image == "null" ]]; then | |
continue | |
fi | |
exists=$(docker manifest inspect $image > /dev/null ; echo $?) | |
if [ "$exists" -ne 0 ]; then | |
echo "Image $image does not exist on Docker Hub." | |
exit 1 | |
else | |
echo "$file::$image OK" | |
fi | |
done | |
done | |
fi | |
working-directory: ${{ github.workspace }} |