diff --git a/.editorconfig b/.editorconfig index 59d9a3a..30e849c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/check-generic.yaml b/.github/workflows/check-generic.yaml new file mode 100644 index 0000000..1b2c8d0 --- /dev/null +++ b/.github/workflows/check-generic.yaml @@ -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 . diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..bf17a7f --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -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 diff --git a/.prettierrc b/.prettierrc index dcb7279..48cd1cf 100755 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,12 @@ { "singleQuote": true, - "trailingComma": "all" -} \ No newline at end of file + "trailingComma": "all", + "overrides": [ + { + "files": "*.{yaml,yml}", + "options": { + "singleQuote": false + } + } + ] +} diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..a0a00a2 --- /dev/null +++ b/.yamllint @@ -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 diff --git a/.yamllintignore b/.yamllintignore new file mode 100644 index 0000000..bd5535a --- /dev/null +++ b/.yamllintignore @@ -0,0 +1 @@ +pnpm-lock.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 09659f1..b201756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # DRec UI CHANGELOG.md ## 0.0.1 + - Dockerfile and buildspec.yml changes -- CICD testing \ No newline at end of file +- CICD testing diff --git a/buildspec.yml b/buildspec.yml index 13684d7..d3c0e52 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -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 - \ No newline at end of file +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 - diff --git a/drec-ui-dev.yaml b/drec-ui-dev.yaml index 4f3a1cd..162000f 100644 --- a/drec-ui-dev.yaml +++ b/drec-ui-dev.yaml @@ -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 @@ -35,4 +35,4 @@ spec: protocol: TCP type: NodePort selector: - app.kubernetes.io/name: drec-ui \ No newline at end of file + app.kubernetes.io/name: drec-ui diff --git a/drec-ui-prod.yaml b/drec-ui-prod.yaml index 70a69a6..39cfe61 100644 --- a/drec-ui-prod.yaml +++ b/drec-ui-prod.yaml @@ -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 diff --git a/drec-ui-stage.yaml b/drec-ui-stage.yaml index 9d4d973..3afe6f9 100644 --- a/drec-ui-stage.yaml +++ b/drec-ui-stage.yaml @@ -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