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

Issue #101: As a Devops, I would like to have a unified set of rules for yaml linting #102

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/workflow-yaml-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@

## Overview

This workflow is designed to maintain and enforce coding standards within YAML files across multiple projects within the organization. It ensures that any changes made to YAML files are consistent with the predefined standards set by the organization.
This workflow is designed to maintain and enforce coding standards within YAML
files across multiple projects within the organization. It ensures that any
changes made to YAML files are consistent with the predefined standards set by
the organization.

## Usage

- **Purpose:** Validate the organization's yaml standards across projects. It is triggered by **pull requests** to ensure that any new or altered YAML files comply with these standards.
- **Purpose:** Validate the organization's yaml standards across projects. It is
triggered by **pull requests** to ensure that any new or altered YAML files
comply with these standards.
- **Steps**
- YAML Lint Test: The workflow runs a linting test on the changed YAML files using the given configuration if specified.
- YAML Lint Test: The workflow runs a linting test on the changed YAML files
using the given configuration if specified.
- **Input:** You can specify specify a custom configuration file path for the
yaml link check. If you have specific rules or configurations for link
validation, you can create a configuration file in the project you are
calling this workflow from and input the path to this workflow. You can
find the documentation for this file
validation, you can create a configuration file in the project you are calling
this workflow from and input the path to this workflow. If you omit to specify
a file path, the default config file from current repository will be used. You
can find the documentation for this file
[here](https://yamllint.readthedocs.io/en/stable/configuration.html)

## YAML Linting Guidelines for Developers

- The [fnando.linter](https://marketplace.visualstudio.com/items?itemName=fnando.linter) extension for Visual Studio Code provides a flexible linter framework, which can be used for linting YAML files.
- The
[fnando.linter](https://marketplace.visualstudio.com/items?itemName=fnando.linter)
extension for Visual Studio Code provides a flexible linter framework, which
can be used for linting YAML files.
4 changes: 3 additions & 1 deletion .github/workflows/workflow-yaml-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Check Yaml conformance to AI Lab standards

on:

Check warning on line 4 in .github/workflows/workflow-yaml-check.yml

View workflow job for this annotation

GitHub Actions / yaml-lint-check

4:1 [truthy] truthy value should be one of [false, true]
workflow_call:
inputs:
config-file-path:
Expand Down Expand Up @@ -34,7 +34,9 @@
if [ -n "${{ github.event.inputs.config-file-path }}" ]; then
yamllint -c "${{ github.workspace }}/${{ github.event.inputs.config-file-path }}" "$file"
else
yamllint "$file"
default_config_url="https://raw.githubusercontent.com/ai-cfia/github-workflows/main/.yamllint.yml"
SonOfLope marked this conversation as resolved.
Show resolved Hide resolved
curl -s -O $default_config_url
yamllint -c "./$(basename $default_config_url)" "$file"
fi
fi
done
Expand Down
8 changes: 5 additions & 3 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
extends: default

ignore: |
.git/

rules:
line-length:
max: 120
allow-non-breakable-inline-mappings: true
line-length: disable
truthy: disable
Loading