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

Add yaml linter github action #99

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
- package-ecosystem: 'github-actions'
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Validate API Spec

on:
Expand All @@ -19,30 +20,29 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 1
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@c2ac33f2c62f978d6c944d9648125a294e56dc0b # v4.0.2
with:
node-version: 'v20.12.0'
- name: Setup Node.js
uses: actions/setup-node@c2ac33f2c62f978d6c944d9648125a294e56dc0b # v4.0.2
with:
node-version: 'v20.12.0'

- name: Install tsp
run: npm install -g @typespec/[email protected]
- name: Install tsp
run: npm install -g @typespec/[email protected]

- name: Install dependencies
run: npm ci
- name: Install dependencies
run: npm ci

- name: Install autorest
run: npm install -g [email protected]
- name: Install autorest
run: npm install -g [email protected]

- name: make generate
run: make generate
working-directory: './api'

- name: Check for Uncommitted Changes
run: |
git diff --exit-code || (echo "::error::Uncommitted changes detected in OpenAPI spec. Please regenerate and commit them." && exit 1)
- name: make generate
run: make generate
working-directory: './api'

- name: Check for Uncommitted Changes
run: |
git diff --exit-code || (echo "::error::Uncommitted changes detected in OpenAPI spec. Please regenerate and commit them." && exit 1)
1 change: 1 addition & 0 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: 'ci-go'
on:
pull_request:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://oxsecurity.github.io/megalinter
name: mega-linter-yaml

on:
pull_request:

permissions:
contents: read

jobs:
build:
name: mega-linter-yaml
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 1

- name: yamllint
uses: oxsecurity/megalinter/flavors/ci_light@v7
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
run:
timeout: 10m
skip-dirs-use-default: true
Expand All @@ -22,4 +23,4 @@ linters:
- unused
linters-settings:
goimports:
local-prefixes: github.com/Azure/ARO-HCP
local-prefixes: github.com/Azure/ARO-HCP
14 changes: 14 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Configuration file for MegaLinter
# See all available variables at https://oxsecurity.github.io/megalinter/configuration/ and in linters documentation

APPLY_FIXES: none
ENABLE_LINTERS:
- YAML_YAMLLINT
EXCLUDED_DIRECTORIES:
- "node_modules"
LINTER_RULES_PATH: .
PRINT_ALPACA: false
GITHUB_STATUS_REPORTER: false
GITHUB_COMMENT_REPORTER: false
VALIDATE_ALL_CODEBASE: true
30 changes: 30 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments: disable
comments-indentation: disable
document-end: disable
document-start: disable
empty-lines: enable
empty-values: disable
hyphens: enable
indentation: disable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy:
level: warning
check-keys: false
1 change: 1 addition & 0 deletions api/autorest-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
input-file: redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json
use:
# TODO: This is an old version. We should fix incompatibilities and remove this later
Expand Down
1 change: 1 addition & 0 deletions api/redhatopenshift/HcpCluster/tspconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
emit:
- '@azure-tools/typespec-autorest'
options:
Expand Down
165 changes: 83 additions & 82 deletions deploy/aro-hcp-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,93 @@
---
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: frontend-template

parameters:
- name: NAMESPACE
required: true
value: aro-hcp
- name: REPLICAS
required: true
value: "1"
- name: ARO_HCP_FRONTEND_IMAGE
required: true
- name: FRONTEND_MI_CLIENT_ID
required: true
description: "Client ID of Frontend Managed Identity"
- name: NAMESPACE
required: true
value: aro-hcp
- name: REPLICAS
required: true
value: "1"
- name: ARO_HCP_FRONTEND_IMAGE
required: true
- name: FRONTEND_MI_CLIENT_ID
required: true
description: "Client ID of Frontend Managed Identity"

objects:
- apiVersion: v1
kind: Namespace
metadata:
name: ${NAMESPACE}
- apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
azure.workload.identity/client-id: ${FRONTEND_MI_CLIENT_ID}
name: frontend
namespace: ${NAMESPACE}
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: aro-hcp-frontend
name: aro-hcp-frontend
namespace: ${NAMESPACE}
spec:
progressDeadlineSeconds: 600
replicas: ${{REPLICAS}}
revisionHistoryLimit: 10
selector:
matchLabels:
- apiVersion: v1
kind: Namespace
metadata:
name: ${NAMESPACE}
- apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
azure.workload.identity/client-id: ${FRONTEND_MI_CLIENT_ID}
name: frontend
namespace: ${NAMESPACE}
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: aro-hcp-frontend
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
name: aro-hcp-frontend
namespace: ${NAMESPACE}
spec:
progressDeadlineSeconds: 600
replicas: ${{REPLICAS}}
revisionHistoryLimit: 10
selector:
matchLabels:
app: aro-hcp-frontend
azure.workload.identity/use: "true"
spec:
serviceAccountName: frontend
containers:
- name: aro-hcp-frontend
image: ${ARO_HCP_FRONTEND_IMAGE}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8443
protocol: TCP
resources:
limits:
memory: 1Gi
requests:
cpu: 100m
memory: 500Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
livenessProbe:
httpGet:
path: /healthz/ready
port: 8443
initialDelaySeconds: 15
periodSeconds: 20
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/ready
port: 8443
initialDelaySeconds: 5
periodSeconds: 10
restartPolicy: Always
terminationGracePeriodSeconds: 30
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: aro-hcp-frontend
azure.workload.identity/use: "true"
spec:
serviceAccountName: frontend
containers:
- name: aro-hcp-frontend
image: ${ARO_HCP_FRONTEND_IMAGE}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8443
protocol: TCP
resources:
limits:
memory: 1Gi
requests:
cpu: 100m
memory: 500Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
livenessProbe:
httpGet:
path: /healthz/ready
port: 8443
initialDelaySeconds: 15
periodSeconds: 20
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/ready
port: 8443
initialDelaySeconds: 5
periodSeconds: 10
restartPolicy: Always
terminationGracePeriodSeconds: 30