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 prettier to pre-commit hook #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'latest' # default is latest (stable)
version: "latest" # default is latest (stable)
token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest'

Check warning on line 29 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

29:81 [line-length] line too long (81 > 80 characters)

- name: Run chart-releaser
uses: helm/[email protected]
Expand Down
94 changes: 47 additions & 47 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
---
name: Test
on:
workflow_call:
workflow_dispatch:
pull_request:
branches:
- '**'
push:
branches:
- main
workflow_call:
workflow_dispatch:
pull_request:
branches:
- "**"
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: yamllint -c yaml_lint_configuration.yaml .
unittests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.20.0

- name: Setup Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Create kind cluster
uses: helm/[email protected]

- name: Upgrade and Test All Charts
run: ct install --all --target-branch ${{ github.event.repository.default_branch}}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: yamllint -c yaml_lint_configuration.yaml .
unittests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.20.0

- name: Setup Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Create kind cluster
uses: helm/[email protected]

- name: Upgrade and Test All Charts
run: ct install --all --target-branch ${{ github.event.repository.default_branch}}

Check warning on line 51 in .github/workflows/test.yaml

View workflow job for this annotation

GitHub Actions / lint

51:81 [line-length] line too long (90 > 80 characters)
44 changes: 19 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
---
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: pretty-format-json
args: [--autofix, --no-sort-keys]
exclude: .*valid.*
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--width, '80']
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint
args: [-d relaxed]
exclude: .*/templates
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: pretty-format-json
args: [--autofix, --no-sort-keys]
exclude: .*valid.*
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml]
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"cSpell.words": [
"ATSDR",
"CFPB",
"ISSO",
"cybersecurity"
]
}
"cSpell.words": [
"ATSDR",
"CFPB",
"ISSO",
"cybersecurity"
]
}
68 changes: 34 additions & 34 deletions charts/alerts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: '{{.Release.Name}}-{{.Values.appName}}'
labels:
app: {{.Values.appName}}
name: "{{.Release.Name}}-{{.Values.appName}}"
labels:
app: { { .Values.appName } }
spec:
replicas: {{.Values.replicaCount}}
selector:
matchLabels:
app: {{.Values.appName}}
template:
metadata:
annotations:
labels:
app: {{.Values.appName}}
spec:
imagePullSecrets:
containers:
- name: {{.Chart.Name}}
image: ghcr.io/cdcgov/phdi/alerts:{{ .Values.image.tag }}
imagePullPolicy: {{.Values.image.pullPolicy}}
ports:
- name: {{.Chart.Name}}
containerPort: {{.Values.service.port}}
env:
- name: TEAMS_WEBHOOK_URL
valueFrom:
secretKeyRef:
name: '{{.Release.Name}}-{{.Values.secretName}}'
key: webhook-url
- name: COMMUNICATION_SERVICE_NAME
value: {{.Values.communicationServiceName}}
- name: SLACK_BOT_TOKEN
valueFrom:
secretKeyRef:
name: '{{.Release.Name}}-{{.Values.secretName}}'
key: slack-bot-token
replicas: { { .Values.replicaCount } }
selector:
matchLabels:
app: { { .Values.appName } }
template:
metadata:
annotations:
labels:
app: { { .Values.appName } }
spec:
imagePullSecrets:
containers:
- name: { { .Chart.Name } }
image: ghcr.io/cdcgov/phdi/alerts:{{ .Values.image.tag }}
imagePullPolicy: { { .Values.image.pullPolicy } }
ports:
- name: { { .Chart.Name } }
containerPort: { { .Values.service.port } }
env:
- name: TEAMS_WEBHOOK_URL
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-{{.Values.secretName}}"
key: webhook-url
- name: COMMUNICATION_SERVICE_NAME
value: { { .Values.communicationServiceName } }
- name: SLACK_BOT_TOKEN
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-{{.Values.secretName}}"
key: slack-bot-token
4 changes: 2 additions & 2 deletions charts/alerts/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: "{{.Release.Name}}-{{.Values.secretName}}"
type: Opaque
stringData:
webhook-url: {{.Values.webhookUrl | quote}}
slack-bot-token: {{.Values.slackBotToken | quote}}
webhook-url: { { .Values.webhookUrl | quote } }
slack-bot-token: { { .Values.slackBotToken | quote } }
4 changes: 2 additions & 2 deletions charts/alerts/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
spec:
type: ClusterIP
ports:
- port: {{.Values.service.port}}
- port: { { .Values.service.port } }
targetPort: 8080
protocol: TCP
selector:
app: {{.Values.appName}}
app: { { .Values.appName } }
5 changes: 2 additions & 3 deletions charts/alerts/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ spec:
- name: wget
image: busybox
command: ["wget"]
args: [
"{{.Release.Name}}-{{.Values.serviceName}}:{{ .Values.service.port}}"
]
args:
["{{.Release.Name}}-{{.Values.serviceName}}:{{ .Values.service.port}}"]
restartPolicy: Never
23 changes: 23 additions & 0 deletions charts/ecr-viewer/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/ecr-viewer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: ecr-viewer
description: A Helm chart for the DIBBs eCR Viewer
type: application
version: 0.1.0
appVersion: "1.1.10"
22 changes: 22 additions & 0 deletions charts/ecr-viewer/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ecr-viewer.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ecr-viewer.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ecr-viewer.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ecr-viewer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
31 changes: 31 additions & 0 deletions charts/ecr-viewer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Release.Name }}-{{.Values.appName}}"
labels:
app: { { .Values.appName } }
spec:
replicas: { { .Values.replicaCount } }
selector:
matchLabels:
app: { { .Values.appName } }
template:
metadata:
annotations:
labels:
app: { { .Values.appName } }
spec:
imagePullSecrets:
containers:
- name: { { .Chart.Name } }
image: ghcr.io/cdcgov/phdi/ecr-viewer:{{ .Values.image.tag }}
imagePullPolicy: { { .Values.image.pullPolicy } }
ports:
- name: { { .Chart.Name } }
containerPort: { { .Values.service.port } }
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: "{{.Release.Name}}-{{.Values.secretName}}"
key: database-url
8 changes: 8 additions & 0 deletions charts/ecr-viewer/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: "{{.Release.Name}}-{{.Values.secretName}}"
type: Opaque
stringData:
database-url: { { .Values.databaseUrl | quote: null }: null }
13 changes: 13 additions & 0 deletions charts/ecr-viewer/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: "{{.Release.Name}}-{{.Values.serviceName}}"
spec:
type: ClusterIP
ports:
- port: { { .Values.service.port: null }: null }
targetPort: 8080
protocol: TCP
selector:
app: { { .Values.appName: null }: null }
15 changes: 15 additions & 0 deletions charts/ecr-viewer/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "ecr-viewer.fullname" . }}-test-connection"
labels:
{{- include "ecr-viewer.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "ecr-viewer.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Loading
Loading