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 more linters #72

Merged
merged 6 commits into from
May 23, 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
16 changes: 3 additions & 13 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Editor configuration, see https://editorconfig.org
root = true
# EditorConfig is awesome: https://EditorConfig.org

[*]
# Ensure consistent file encoding in UNIX style
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
end_of_line = lf
40 changes: 40 additions & 0 deletions .github/workflows/check-generic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generic checks to ease collaboration:
# - consistent file encoding in UNIX style
# - whitespaces in all purposes files like markdown, yaml, etc
name: Check Generic

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
editorconfig-checker:
name: Run editorconfig-checker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run editorconfig-checker
run: docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker

markdownlint:
name: Run markdownlint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run markdownlint-cli2
uses: DavidAnson/markdownlint-cli2-action@v13

yamllint:
name: Run yamllint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run yamllint
run: yamllint .
14 changes: 14 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Disable some built-in rules
config:
line-length: false
no-inline-html: false
first-line-h1: false
code-fence-style:
style: backtick

# Define glob expressions to use (only valid at root)
globs:
- "**/*.md"

# Ignore files that are not part of version control
gitignore: true
12 changes: 10 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"singleQuote": true,
"trailingComma": "all"
}
"trailingComma": "all",
"overrides": [
{
"files": "*.{yaml,yml}",
"options": {
"singleQuote": false
}
}
]
}
18 changes: 18 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends: default

ignore-from-file:
- .gitignore
- .yamllintignore

rules:
document-start: disable
indentation:
spaces: 2
line-length: disable
quoted-strings:
quote-type: double
required: only-when-needed
allow-quoted-quotes: true
check-keys: true
truthy:
check-keys: false
1 change: 1 addition & 0 deletions .yamllintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# DRec UI CHANGELOG.md

## 0.0.1

- Dockerfile and buildspec.yml changes
- CICD testing
- CICD testing
70 changes: 35 additions & 35 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
version: 0.2
env:
parameter-store:
docker_username: /powertrust/docker/username
docker_password: /powertrust/docker/password
phases:
install:
# runtime-versions:
# nodejs: 18
# docker: 18
commands:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_linux_amd64
- chmod +x ./aws-iam-authenticator
- export PATH=$PWD/:$PATH
pre_build:
commands:
- IMAGE="drec-ui"
- BUILD_NUMBER=$(cat version)
- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 895706603967.dkr.ecr.eu-west-1.amazonaws.com
- export KUBECONFIG=$HOME/.kube/config
build:
commands:
- echo $docker_password | docker login --username $docker_username --password-stdin
- docker build -t $IMAGE:$BUILD_NUMBER -f Dockerfile --build-arg build_environment=$environment .
- docker tag $IMAGE:$BUILD_NUMBER 895706603967.dkr.ecr.eu-west-1.amazonaws.com/$IMAGE:$environment-$BUILD_NUMBER
post_build:
commands:
- docker push 895706603967.dkr.ecr.eu-west-1.amazonaws.com/$IMAGE:$environment-$BUILD_NUMBER
- aws eks update-kubeconfig --name drec
- template=`cat "$IMAGE-$environment.yaml" | sed "s/{{BUILD_NUMBER}}/$environment-$BUILD_NUMBER/g"`
- echo "$template" | kubectl apply -f -
version: 0.2
env:
parameter-store:
docker_username: /powertrust/docker/username
docker_password: /powertrust/docker/password
phases:
install:
# runtime-versions:
# nodejs: 18
# docker: 18
commands:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- chmod +x ./kubectl
- curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_linux_amd64
- chmod +x ./aws-iam-authenticator
- export PATH=$PWD/:$PATH
pre_build:
commands:
- IMAGE="drec-ui"
- BUILD_NUMBER=$(cat version)
- aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 895706603967.dkr.ecr.eu-west-1.amazonaws.com
- export KUBECONFIG=$HOME/.kube/config
build:
commands:
- echo $docker_password | docker login --username $docker_username --password-stdin
- docker build -t $IMAGE:$BUILD_NUMBER -f Dockerfile --build-arg build_environment=$environment .
- docker tag $IMAGE:$BUILD_NUMBER 895706603967.dkr.ecr.eu-west-1.amazonaws.com/$IMAGE:$environment-$BUILD_NUMBER
post_build:
commands:
- docker push 895706603967.dkr.ecr.eu-west-1.amazonaws.com/$IMAGE:$environment-$BUILD_NUMBER
- aws eks update-kubeconfig --name drec
- template=`cat "$IMAGE-$environment.yaml" | sed "s/{{BUILD_NUMBER}}/$environment-$BUILD_NUMBER/g"`
- echo "$template" | kubectl apply -f -
18 changes: 9 additions & 9 deletions drec-ui-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ spec:
app.kubernetes.io/name: drec-ui
spec:
containers:
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-dev-env
ports:
- containerPort: 80
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-dev-env
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
Expand All @@ -35,4 +35,4 @@ spec:
protocol: TCP
type: NodePort
selector:
app.kubernetes.io/name: drec-ui
app.kubernetes.io/name: drec-ui
16 changes: 8 additions & 8 deletions drec-ui-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ spec:
app.kubernetes.io/name: drec-ui
spec:
containers:
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-prod-env
ports:
- containerPort: 80
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-prod-env
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
Expand Down
16 changes: 8 additions & 8 deletions drec-ui-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ spec:
app.kubernetes.io/name: drec-ui
spec:
containers:
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-stage-env
ports:
- containerPort: 80
- image: 895706603967.dkr.ecr.eu-west-1.amazonaws.com/drec-ui:{{BUILD_NUMBER}}
imagePullPolicy: Always
name: drec-ui
envFrom:
- secretRef:
name: drec-stage-env
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
Expand Down
Loading