diff --git a/Cargo.toml b/Cargo.toml index 5ec5826..764ca43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,9 @@ resolver = '2' members = [ 'apps/back', - 'libs/markdown_header', - 'libs/tool_tracing', - 'libs/markdown_struct', + 'libs/back/markdown_header', + 'libs/back/tool_tracing', + 'libs/back/markdown_struct', ] [profile.release] diff --git a/apps/back/Cargo.toml b/apps/back/Cargo.toml index 372bf38..bda259b 100644 --- a/apps/back/Cargo.toml +++ b/apps/back/Cargo.toml @@ -7,9 +7,9 @@ default-run = "server" [dependencies] chrono = { version = "0.4", features = ["serde"] } -markdown_header = { path = "../../libs/markdown_header" } -markdown_struct = { path = "../../libs/markdown_struct" } -tool_tracing = { path = "../../libs/tool_tracing" } +markdown_header = { path = "../../libs/back/markdown_header" } +markdown_struct = { path = "../../libs/back/markdown_struct" } +tool_tracing = { path = "../../libs/back/tool_tracing" } serde = "1.0" serde_json = "1.0" serde_yaml = "0.9" diff --git a/cicd/.helmignore b/cicd/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/cicd/.helmignore @@ -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/ diff --git a/cicd/Chart.yaml b/cicd/Chart.yaml new file mode 100644 index 0000000..e9330d7 --- /dev/null +++ b/cicd/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: cicd +description: Tekton pipeline for CI/CD + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/cicd/Readme.md b/cicd/Readme.md new file mode 100644 index 0000000..76e7f26 --- /dev/null +++ b/cicd/Readme.md @@ -0,0 +1,55 @@ +# Monofolio CICD + +## Goal + +- Create a "beta" version of the Monofolio website that is automatically deployed and is a ref to the `main` branch of the repository. +- Create a "production" version of the Monofolio website that is automatically deployed and is a ref to a `tag` in the repository. +- Make sure that the "production" version is tested in depth + +### Deploy flow + +- Build the Frontend if the folder related to the Frontend has changed. + - apps/front + - libs/front/* +- Build the Backend if the folder related to the Backend has changed. + - apps/back + - libs/back/* +- Push the images to a conteneur registry. +- Deploy the images to a Kubernetes cluster. + +### Test flow + +- Run Code Coverage tests on the Backend +- Run E2E tests on the Frontend +- Run Lighthouse tests on the Frontend +- Run Security tests on both the Backend and the Frontend + +### Deployment flow + +- Write code in a new branch +- Create a Pull Request +- PR is tested by Github Actions then the Test flow is executed. +- If both the Test flow and the PR checks pass, the PR is merged into the `main` branch. +- The Release flow is executed and the `beta` version is deployed. +- If the `beta` version is stable, a new tag is created and the `production` version is deployed. + +```mermaid +flowchart TD; + subgraph "Development flow" + A([Write code in a new branch]) --> B[Create a Pull Request]; + end + subgraph "Test flow" + B --> C[PR is tested by Github Actions]; + C -- If Github Action is ok --> D[Run the Test flow]; + D -- If test nok --> E[PR is locked with information]; + end + subgraph "Release flow" + D -- If test ok --> F[PR is merged into the `main` branch]; + F -- If Front changed --> G[Build the Frontend]; + F -- If Back changed --> H[Build the Backend]; + G --> I[Push the images to a conteneur registry]; + H --> I; + I --> J[Deploy the helm chart]; + end + +``` diff --git a/libs/.gitkeep b/cicd/templates/.gitkeep similarity index 100% rename from libs/.gitkeep rename to cicd/templates/.gitkeep diff --git a/cicd/templates/task/build-image.yaml b/cicd/templates/task/build-image.yaml new file mode 100644 index 0000000..ac95516 --- /dev/null +++ b/cicd/templates/task/build-image.yaml @@ -0,0 +1,56 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: build-image +spec: + description: | + This task builds selected image. + workspaces: + - name: shared-data + description: | + This workspace contains the cloned repo files, so they can be read by the + next task. + - name: dockerconfig + description: | + This workspace contains the docker config.json file, so it can be used by + the next task. + params: + - name: registrydns + type: string + description: The registry dns name. + default: docker.io + - name: buildctl_tcp + type: string + description: The buildctl tcp address. + default: tcp://buildkitd.buildkit.svc.cluster.local:1234 + - name: repo-branch + type: string + description: The git repo branch to clone from. + default: main + - name: path-dockerfile + type: string + description: The folder where the dockerfile are. + default: . + - name: context-dockerfile + type: string + description: The context where the dockerfile are. + default: . + - name: DOCKERFILE + type: string + description: The dockerfile to build. + default: Dockerfile + - name: IMAGE + type: string + description: The image name to build (repo/imagename). + steps: + - image: '{{ .Values.task.buildImage.baseImage }}' + name: build-all + env: + - name: DOCKER_CONFIG + value: $(workspaces.dockerconfig.path) + workingDir: $(workspaces.shared-data.path) + script: | + #!/usr/bin/env ash + buildctl --addr $(params.buildctl_tcp) build --progress=plain --frontend dockerfile.v0 --local context=$(params.context-dockerfile) --local dockerfile=$(params.path-dockerfile) --opt filename=$(params.DOCKERFILE) --output type=image,name=$(params.registrydns)/$(params.IMAGE):$(params.repo-branch),push=true + +# https://tekton.dev/docs/pipelines/tasks/#specifying-workspaces diff --git a/cicd/templates/task/git-clone.yaml b/cicd/templates/task/git-clone.yaml new file mode 100644 index 0000000..014d7f4 --- /dev/null +++ b/cicd/templates/task/git-clone.yaml @@ -0,0 +1,242 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: git-clone + labels: + app.kubernetes.io/version: '0.9' + annotations: + tekton.dev/pipelines.minVersion: '0.38.0' + tekton.dev/categories: Git + tekton.dev/tags: git + tekton.dev/displayName: 'git clone' + tekton.dev/platforms: 'linux/amd64,linux/s390x,linux/ppc64le,linux/arm64' +spec: + description: >- + These Tasks are Git tasks to work with repositories used by other tasks + in your Pipeline. + + The git-clone Task will clone a repo from the provided url into the + output Workspace. By default the repo will be cloned into the root of + your Workspace. You can clone into a subdirectory by setting this Task's + subdirectory param. This Task also supports sparse checkouts. To perform + a sparse checkout, pass a list of comma separated directory patterns to + this Task's sparseCheckoutDirectories param. + workspaces: + - name: output + description: The git repo will be cloned onto the volume backing this Workspace. + - name: ssh-directory + optional: true + description: | + A .ssh directory with private key, known_hosts, config, etc. Copied to + the user's home before git commands are executed. Used to authenticate + with the git remote when performing the clone. Binding a Secret to this + Workspace is strongly recommended over other volume types. + - name: basic-auth + optional: true + description: | + A Workspace containing a .gitconfig and .git-credentials file. These + will be copied to the user's home before any git commands are run. Any + other files in this Workspace are ignored. It is strongly recommended + to use ssh-directory over basic-auth whenever possible and to bind a + Secret to this Workspace over other volume types. + - name: ssl-ca-directory + optional: true + description: | + A workspace containing CA certificates, this will be used by Git to + verify the peer with when fetching or pushing over HTTPS. + params: + - name: url + description: Repository URL to clone from. + type: string + - name: revision + description: Revision to checkout. (branch, tag, sha, ref, etc...) + type: string + default: '' + - name: refspec + description: Refspec to fetch before checking out revision. + default: '' + - name: submodules + description: Initialize and fetch git submodules. + type: string + default: 'true' + - name: depth + description: Perform a shallow clone, fetching only the most recent N commits. + type: string + default: '1' + - name: sslVerify + description: Set the `http.sslVerify` global git config. Setting this to `false` is not advised unless you are sure that you trust your git remote. + type: string + default: 'true' + - name: crtFileName + description: file name of mounted crt using ssl-ca-directory workspace. default value is ca-bundle.crt. + type: string + default: 'ca-bundle.crt' + - name: subdirectory + description: Subdirectory inside the `output` Workspace to clone the repo into. + type: string + default: '' + - name: sparseCheckoutDirectories + description: Define the directory patterns to match or exclude when performing a sparse checkout. + type: string + default: '' + - name: deleteExisting + description: Clean out the contents of the destination directory if it already exists before cloning. + type: string + default: 'true' + - name: httpProxy + description: HTTP proxy server for non-SSL requests. + type: string + default: '' + - name: httpsProxy + description: HTTPS proxy server for SSL requests. + type: string + default: '' + - name: noProxy + description: Opt out of proxying HTTP/HTTPS requests. + type: string + default: '' + - name: verbose + description: Log the commands that are executed during `git-clone`'s operation. + type: string + default: 'true' + - name: gitInitImage + description: The image providing the git-init binary that this Task runs. + type: string + default: 'gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.40.2' + - name: userHome + description: | + Absolute path to the user's home directory. + type: string + default: '/home/git' + results: + - name: commit + description: The precise commit SHA that was fetched by this Task. + - name: url + description: The precise URL that was fetched by this Task. + - name: committer-date + description: The epoch timestamp of the commit that was fetched by this Task. + steps: + - name: clone + image: '$(params.gitInitImage)' + env: + - name: HOME + value: '$(params.userHome)' + - name: PARAM_URL + value: $(params.url) + - name: PARAM_REVISION + value: $(params.revision) + - name: PARAM_REFSPEC + value: $(params.refspec) + - name: PARAM_SUBMODULES + value: $(params.submodules) + - name: PARAM_DEPTH + value: $(params.depth) + - name: PARAM_SSL_VERIFY + value: $(params.sslVerify) + - name: PARAM_CRT_FILENAME + value: $(params.crtFileName) + - name: PARAM_SUBDIRECTORY + value: $(params.subdirectory) + - name: PARAM_DELETE_EXISTING + value: $(params.deleteExisting) + - name: PARAM_HTTP_PROXY + value: $(params.httpProxy) + - name: PARAM_HTTPS_PROXY + value: $(params.httpsProxy) + - name: PARAM_NO_PROXY + value: $(params.noProxy) + - name: PARAM_VERBOSE + value: $(params.verbose) + - name: PARAM_SPARSE_CHECKOUT_DIRECTORIES + value: $(params.sparseCheckoutDirectories) + - name: PARAM_USER_HOME + value: $(params.userHome) + - name: WORKSPACE_OUTPUT_PATH + value: $(workspaces.output.path) + - name: WORKSPACE_SSH_DIRECTORY_BOUND + value: $(workspaces.ssh-directory.bound) + - name: WORKSPACE_SSH_DIRECTORY_PATH + value: $(workspaces.ssh-directory.path) + - name: WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND + value: $(workspaces.basic-auth.bound) + - name: WORKSPACE_BASIC_AUTH_DIRECTORY_PATH + value: $(workspaces.basic-auth.path) + - name: WORKSPACE_SSL_CA_DIRECTORY_BOUND + value: $(workspaces.ssl-ca-directory.bound) + - name: WORKSPACE_SSL_CA_DIRECTORY_PATH + value: $(workspaces.ssl-ca-directory.path) + securityContext: + runAsNonRoot: true + runAsUser: 65532 + script: | + #!/usr/bin/env sh + set -eu + + if [ "${PARAM_VERBOSE}" = "true" ] ; then + set -x + fi + + if [ "${WORKSPACE_BASIC_AUTH_DIRECTORY_BOUND}" = "true" ] ; then + cp "${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.git-credentials" "${PARAM_USER_HOME}/.git-credentials" + cp "${WORKSPACE_BASIC_AUTH_DIRECTORY_PATH}/.gitconfig" "${PARAM_USER_HOME}/.gitconfig" + chmod 400 "${PARAM_USER_HOME}/.git-credentials" + chmod 400 "${PARAM_USER_HOME}/.gitconfig" + fi + + if [ "${WORKSPACE_SSH_DIRECTORY_BOUND}" = "true" ] ; then + cp -R "${WORKSPACE_SSH_DIRECTORY_PATH}" "${PARAM_USER_HOME}"/.ssh + chmod 700 "${PARAM_USER_HOME}"/.ssh + chmod -R 400 "${PARAM_USER_HOME}"/.ssh/* + fi + + if [ "${WORKSPACE_SSL_CA_DIRECTORY_BOUND}" = "true" ] ; then + export GIT_SSL_CAPATH="${WORKSPACE_SSL_CA_DIRECTORY_PATH}" + if [ "${PARAM_CRT_FILENAME}" != "" ] ; then + export GIT_SSL_CAINFO="${WORKSPACE_SSL_CA_DIRECTORY_PATH}/${PARAM_CRT_FILENAME}" + fi + fi + CHECKOUT_DIR="${WORKSPACE_OUTPUT_PATH}/${PARAM_SUBDIRECTORY}" + + cleandir() { + # Delete any existing contents of the repo directory if it exists. + # + # We don't just "rm -rf ${CHECKOUT_DIR}" because ${CHECKOUT_DIR} might be "/" + # or the root of a mounted volume. + if [ -d "${CHECKOUT_DIR}" ] ; then + # Delete non-hidden files and directories + rm -rf "${CHECKOUT_DIR:?}"/* + # Delete files and directories starting with . but excluding .. + rm -rf "${CHECKOUT_DIR}"/.[!.]* + # Delete files and directories starting with .. plus any other character + rm -rf "${CHECKOUT_DIR}"/..?* + fi + } + + if [ "${PARAM_DELETE_EXISTING}" = "true" ] ; then + cleandir || true + fi + + test -z "${PARAM_HTTP_PROXY}" || export HTTP_PROXY="${PARAM_HTTP_PROXY}" + test -z "${PARAM_HTTPS_PROXY}" || export HTTPS_PROXY="${PARAM_HTTPS_PROXY}" + test -z "${PARAM_NO_PROXY}" || export NO_PROXY="${PARAM_NO_PROXY}" + + git config --global --add safe.directory "${WORKSPACE_OUTPUT_PATH}" + /ko-app/git-init \ + -url="${PARAM_URL}" \ + -revision="${PARAM_REVISION}" \ + -refspec="${PARAM_REFSPEC}" \ + -path="${CHECKOUT_DIR}" \ + -sslVerify="${PARAM_SSL_VERIFY}" \ + -submodules="${PARAM_SUBMODULES}" \ + -depth="${PARAM_DEPTH}" \ + -sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}" + cd "${CHECKOUT_DIR}" + RESULT_SHA="$(git rev-parse HEAD)" + EXIT_CODE="$?" + if [ "${EXIT_CODE}" != 0 ] ; then + exit "${EXIT_CODE}" + fi + RESULT_COMMITTER_DATE="$(git log -1 --pretty=%ct)" + printf "%s" "${RESULT_COMMITTER_DATE}" > "$(results.committer-date.path)" + printf "%s" "${RESULT_SHA}" > "$(results.commit.path)" + printf "%s" "${PARAM_URL}" > "$(results.url.path)" diff --git a/cicd/templates/task/github-status.yaml b/cicd/templates/task/github-status.yaml new file mode 100644 index 0000000..49c95ae --- /dev/null +++ b/cicd/templates/task/github-status.yaml @@ -0,0 +1,194 @@ +--- +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: github-set-status + labels: + app.kubernetes.io/version: '0.4' + annotations: + tekton.dev/categories: Git + tekton.dev/pipelines.minVersion: '0.12.1' + tekton.dev/tags: github + tekton.dev/displayName: 'set github status' + tekton.dev/platforms: 'linux/amd64,linux/s390x,linux/ppc64le' +spec: + description: >- + This task will set the status of the CI job to the specified value along + with a link to the specified target URL where developers can follow the + progress of the CI job. + + The `github-set-status` task allows external services to mark GitHub commits + with an `error`, `failure`, `pending`, or `success` state, which is then + reflected in pull requests involving those commits. Statuses include as well a + `description` and a `target_url`, to give the user informations about the CI + statuses or a direct link to the full log. + + params: + - name: GITHUB_HOST_URL + description: | + The GitHub host, adjust this if you run a GitHub enteprise. + default: 'api.github.com' + type: string + + - name: API_PATH_PREFIX + description: | + The API path prefix, GitHub Enterprise has a prefix e.g. /api/v3 + default: '' + type: string + + - name: REPO_FULL_NAME + description: | + The GitHub repository full name, e.g.: tektoncd/catalog + type: string + + - name: GITHUB_TOKEN_SECRET_NAME + description: | + The name of the kubernetes secret that contains the GitHub token, default: github + type: string + default: github + + - name: GITHUB_TOKEN_SECRET_KEY + description: | + The key within the kubernetes secret that contains the GitHub token, default: token + type: string + default: token + + - name: SHA + description: | + Commit SHA to set the status for. + type: string + + - name: TARGET_URL + description: | + The target URL to associate with this status. This URL will be linked + from the GitHub UI to allow users to easily see the source of the + status. + type: string + + - name: DESCRIPTION + description: | + A short description of the status. + type: string + + - name: CONTEXT + description: | + The GitHub context, A string label to differentiate this status from + the status of other systems. ie: "continuous-integration/tekton" + default: 'continuous-integration/tekton' + type: string + + - name: STATE + description: | + The state of the status. Can be one of the following `error`, + `failure`, `pending`, or `success`. + type: string + + - name: AUTH_TYPE + description: | + The type of authentication to use. You could use the less secure "Basic" for example + type: string + default: Bearer + + - name: IMAGE + description: | + Image providing the python binary which this task uses. + type: string + default: python:3.10.1-alpine3.15 + + - name: SHEBANG + description: | + Python path. Depends on the image. + type: string + default: /usr/bin/env python + + volumes: + - name: githubtoken + secret: + secretName: $(params.GITHUB_TOKEN_SECRET_NAME) + + steps: + - name: set-status + volumeMounts: + - name: githubtoken + mountPath: /etc/github-set-status + env: + - name: GITHUB_HOST_URL + value: $(params.GITHUB_HOST_URL) + - name: API_PATH_PREFIX + value: $(params.API_PATH_PREFIX) + - name: REPO_FULL_NAME + value: $(params.REPO_FULL_NAME) + - name: GITHUB_TOKEN_SECRET_NAME + value: $(params.GITHUB_TOKEN_SECRET_NAME) + - name: GITHUB_TOKEN_SECRET_KEY + value: $(params.GITHUB_TOKEN_SECRET_KEY) + - name: SHA + value: $(params.SHA) + - name: TARGET_URL + value: $(params.TARGET_URL) + - name: DESCRIPTION + value: $(params.DESCRIPTION) + - name: CONTEXT + value: $(params.CONTEXT) + - name: STATE + value: $(params.STATE) + - name: AUTH_TYPE + value: $(params.AUTH_TYPE) + - name: SHEBANG + value: $(params.SHEBANG) + + image: $(params.IMAGE) + script: | + #!$(params.SHEBANG) + + """This script will set the CI status on GitHub PR""" + + import json + import os + import sys + import http.client + + github_token_filename = "/etc/github-set-status/" + \ + os.getenv("GITHUB_TOKEN_SECRET_KEY") + github_token = open(github_token_filename, "r").read() + + status_url = os.getenv("API_PATH_PREFIX") + "/repos/" + \ + os.getenv("REPO_FULL_NAME") + "/statuses/" + os.getenv("SHA") + + data = { + "state": os.getenv("STATE"), + "target_url": os.getenv("TARGET_URL"), + "description": os.getenv("DESCRIPTION"), + "context": os.getenv("CONTEXT") + } + print("Sending this data to GitHub@{url}: ".format( + url=os.getenv("GITHUB_HOST_URL"))) + print(data) + + authHeader = os.getenv("AUTH_TYPE") + " " + github_token + + # This is for our fake github server + if "$(params.GITHUB_HOST_URL)".startswith("http://"): + conn = http.client.HTTPConnection("$(params.GITHUB_HOST_URL)".replace("http://", "")) + else: + conn = http.client.HTTPSConnection("$(params.GITHUB_HOST_URL)") + + conn.request( + "POST", + status_url, + body=json.dumps(data), + headers={ + "User-Agent": "TektonCD, the peaceful cat", + "Authorization": authHeader, + "Accept": "application/vnd.github.v3+json ", + }) + resp = conn.getresponse() + if not str(resp.status).startswith("2"): + print("Error: %d" % (resp.status)) + print(resp.read()) + sys.exit(1) + else: + print("GitHub status '{state}' has been set on {repo}#{sha} ".format( + state=os.getenv("STATE"), + repo=os.getenv("REPO_FULL_NAME"), + sha=os.getenv("SHA"))) diff --git a/cicd/templates/task/helm-upgrade.yaml b/cicd/templates/task/helm-upgrade.yaml new file mode 100644 index 0000000..80a0d9a --- /dev/null +++ b/cicd/templates/task/helm-upgrade.yaml @@ -0,0 +1,57 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: helm-upgrade + labels: + app.kubernetes.io/version: '0.3' + annotations: + tekton.dev/pipelines.minVersion: '0.12.1' + tekton.dev/categories: Deployment + tekton.dev/tags: helm + tekton.dev/platforms: 'linux/amd64,linux/s390x,linux/ppc64le,linux/arm64' +spec: + description: >- + These tasks will install / upgrade a helm chart into your Kubernetes / + OpenShift Cluster using Helm + + params: + - name: charts_dir + description: The directory in source that contains the helm chart + - name: release_version + description: The helm release version in semantic versioning format + default: 'v1.0.0' + - name: release_name + description: The helm release name + default: 'helm-release' + - name: release_namespace + description: The helm release namespace + default: '' + - name: overwrite_values + description: 'Specify the values you want to overwrite, comma separated: autoscaling.enabled=true,replicas=1' + default: '' + - name: values_file + description: 'The values file to be used' + default: 'values.yaml' + - name: upgrade_extra_params + description: 'Extra parameters passed for the helm upgrade command' + default: '' + workspaces: + - name: source + - name: kubeconfig-dir + optional: true + steps: + - name: upgrade + image: '{{ .Values.task.helmUpgrade.baseImage }}' + workingDir: /workspace/source + script: | + echo "Setting up kubeconfig..." + [[ "$(workspaces.kubeconfig-dir.bound)" == "true" ]] && \ + [[ -f $(workspaces.kubeconfig-dir.path)/kubeconfig ]] && \ + export KUBECONFIG=$(workspaces.kubeconfig-dir.path)/kubeconfig + echo "Setting up variables..." + release_name="$(echo '$(params.release_name)' | tr '[:upper:]' '[:lower:]')" + echo "Release name: $release_name" + echo "Getting helm dependencies..." + helm dependency build "$(params.charts_dir)" + echo "installing helm chart..." + helm upgrade --install --wait --values "$(params.charts_dir)/$(params.values_file)" --namespace "$(params.release_namespace)" --version "$(params.release_version)" "$release_name" "$(params.charts_dir)" --debug --set "$(params.overwrite_values)" $(params.upgrade_extra_params) diff --git a/cicd/values.yaml b/cicd/values.yaml new file mode 100644 index 0000000..be7fa99 --- /dev/null +++ b/cicd/values.yaml @@ -0,0 +1,5 @@ +task: + buildImage: + baseImage: moby/buildkit:v0.15.2 + helmUpgrade: + baseImage: alpine/helm:3.15.4 diff --git a/libs/api-client/project.json b/libs/api-client/project.json deleted file mode 100644 index 02979e5..0000000 --- a/libs/api-client/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "api-client", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/api-client/src", - "projectType": "library", - "tags": [], - "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/api-client", - "main": "libs/api-client/src/index.ts", - "tsConfig": "libs/api-client/tsconfig.lib.json", - "assets": ["libs/api-client/*.md"] - } - } - } -} diff --git a/libs/markdown_header/Cargo.toml b/libs/back/markdown_header/Cargo.toml similarity index 100% rename from libs/markdown_header/Cargo.toml rename to libs/back/markdown_header/Cargo.toml diff --git a/libs/markdown_header/project.json b/libs/back/markdown_header/project.json similarity index 100% rename from libs/markdown_header/project.json rename to libs/back/markdown_header/project.json diff --git a/libs/markdown_header/readme.md b/libs/back/markdown_header/readme.md similarity index 100% rename from libs/markdown_header/readme.md rename to libs/back/markdown_header/readme.md diff --git a/libs/markdown_header/src/adapt/json.rs b/libs/back/markdown_header/src/adapt/json.rs similarity index 100% rename from libs/markdown_header/src/adapt/json.rs rename to libs/back/markdown_header/src/adapt/json.rs diff --git a/libs/markdown_header/src/adapt/mod.rs b/libs/back/markdown_header/src/adapt/mod.rs similarity index 100% rename from libs/markdown_header/src/adapt/mod.rs rename to libs/back/markdown_header/src/adapt/mod.rs diff --git a/libs/markdown_header/src/adapt/toml.rs b/libs/back/markdown_header/src/adapt/toml.rs similarity index 100% rename from libs/markdown_header/src/adapt/toml.rs rename to libs/back/markdown_header/src/adapt/toml.rs diff --git a/libs/markdown_header/src/adapt/yaml.rs b/libs/back/markdown_header/src/adapt/yaml.rs similarity index 100% rename from libs/markdown_header/src/adapt/yaml.rs rename to libs/back/markdown_header/src/adapt/yaml.rs diff --git a/libs/markdown_header/src/error.rs b/libs/back/markdown_header/src/error.rs similarity index 100% rename from libs/markdown_header/src/error.rs rename to libs/back/markdown_header/src/error.rs diff --git a/libs/markdown_header/src/lib.rs b/libs/back/markdown_header/src/lib.rs similarity index 100% rename from libs/markdown_header/src/lib.rs rename to libs/back/markdown_header/src/lib.rs diff --git a/libs/markdown_header/src/parser.rs b/libs/back/markdown_header/src/parser.rs similarity index 100% rename from libs/markdown_header/src/parser.rs rename to libs/back/markdown_header/src/parser.rs diff --git a/libs/markdown_struct/Cargo.toml b/libs/back/markdown_struct/Cargo.toml similarity index 100% rename from libs/markdown_struct/Cargo.toml rename to libs/back/markdown_struct/Cargo.toml diff --git a/libs/markdown_struct/project.json b/libs/back/markdown_struct/project.json similarity index 100% rename from libs/markdown_struct/project.json rename to libs/back/markdown_struct/project.json diff --git a/libs/markdown_struct/src/blog_timeline.rs b/libs/back/markdown_struct/src/blog_timeline.rs similarity index 100% rename from libs/markdown_struct/src/blog_timeline.rs rename to libs/back/markdown_struct/src/blog_timeline.rs diff --git a/libs/markdown_struct/src/content_struct.rs b/libs/back/markdown_struct/src/content_struct.rs similarity index 100% rename from libs/markdown_struct/src/content_struct.rs rename to libs/back/markdown_struct/src/content_struct.rs diff --git a/libs/markdown_struct/src/doc_header.rs b/libs/back/markdown_struct/src/doc_header.rs similarity index 100% rename from libs/markdown_struct/src/doc_header.rs rename to libs/back/markdown_struct/src/doc_header.rs diff --git a/libs/markdown_struct/src/doc_sidebar.rs b/libs/back/markdown_struct/src/doc_sidebar.rs similarity index 100% rename from libs/markdown_struct/src/doc_sidebar.rs rename to libs/back/markdown_struct/src/doc_sidebar.rs diff --git a/libs/markdown_struct/src/folder_struct.rs b/libs/back/markdown_struct/src/folder_struct.rs similarity index 100% rename from libs/markdown_struct/src/folder_struct.rs rename to libs/back/markdown_struct/src/folder_struct.rs diff --git a/libs/markdown_struct/src/lib.rs b/libs/back/markdown_struct/src/lib.rs similarity index 100% rename from libs/markdown_struct/src/lib.rs rename to libs/back/markdown_struct/src/lib.rs diff --git a/libs/markdown_struct/src/page_database.rs b/libs/back/markdown_struct/src/page_database.rs similarity index 100% rename from libs/markdown_struct/src/page_database.rs rename to libs/back/markdown_struct/src/page_database.rs diff --git a/libs/tool_tracing/Cargo.toml b/libs/back/tool_tracing/Cargo.toml similarity index 100% rename from libs/tool_tracing/Cargo.toml rename to libs/back/tool_tracing/Cargo.toml diff --git a/libs/tool_tracing/project.json b/libs/back/tool_tracing/project.json similarity index 100% rename from libs/tool_tracing/project.json rename to libs/back/tool_tracing/project.json diff --git a/libs/tool_tracing/src/init.rs b/libs/back/tool_tracing/src/init.rs similarity index 100% rename from libs/tool_tracing/src/init.rs rename to libs/back/tool_tracing/src/init.rs diff --git a/libs/tool_tracing/src/level.rs b/libs/back/tool_tracing/src/level.rs similarity index 100% rename from libs/tool_tracing/src/level.rs rename to libs/back/tool_tracing/src/level.rs diff --git a/libs/tool_tracing/src/lib.rs b/libs/back/tool_tracing/src/lib.rs similarity index 100% rename from libs/tool_tracing/src/lib.rs rename to libs/back/tool_tracing/src/lib.rs diff --git a/libs/tool_tracing/src/tracing_kind.rs b/libs/back/tool_tracing/src/tracing_kind.rs similarity index 100% rename from libs/tool_tracing/src/tracing_kind.rs rename to libs/back/tool_tracing/src/tracing_kind.rs diff --git a/libs/front/.gitkeep b/libs/front/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/libs/api-client/.eslintrc.json b/libs/front/api-client/.eslintrc.json similarity index 100% rename from libs/api-client/.eslintrc.json rename to libs/front/api-client/.eslintrc.json diff --git a/libs/api-client/README.md b/libs/front/api-client/README.md similarity index 100% rename from libs/api-client/README.md rename to libs/front/api-client/README.md diff --git a/libs/api-client/package.json b/libs/front/api-client/package.json similarity index 100% rename from libs/api-client/package.json rename to libs/front/api-client/package.json diff --git a/libs/front/api-client/project.json b/libs/front/api-client/project.json new file mode 100644 index 0000000..97dcf26 --- /dev/null +++ b/libs/front/api-client/project.json @@ -0,0 +1,19 @@ +{ + "name": "api-client", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/front/api-client/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/api-client", + "main": "libs/front/api-client/src/index.ts", + "tsConfig": "libs/front/api-client/tsconfig.lib.json", + "assets": ["libs/front/api-client/*.md"] + } + } + } +} diff --git a/libs/api-client/src/api/index.ts b/libs/front/api-client/src/api/index.ts similarity index 100% rename from libs/api-client/src/api/index.ts rename to libs/front/api-client/src/api/index.ts diff --git a/libs/api-client/src/api/schemas.gen.ts b/libs/front/api-client/src/api/schemas.gen.ts similarity index 100% rename from libs/api-client/src/api/schemas.gen.ts rename to libs/front/api-client/src/api/schemas.gen.ts diff --git a/libs/api-client/src/api/services.gen.ts b/libs/front/api-client/src/api/services.gen.ts similarity index 100% rename from libs/api-client/src/api/services.gen.ts rename to libs/front/api-client/src/api/services.gen.ts diff --git a/libs/api-client/src/api/types.gen.ts b/libs/front/api-client/src/api/types.gen.ts similarity index 100% rename from libs/api-client/src/api/types.gen.ts rename to libs/front/api-client/src/api/types.gen.ts diff --git a/libs/api-client/src/index.ts b/libs/front/api-client/src/index.ts similarity index 100% rename from libs/api-client/src/index.ts rename to libs/front/api-client/src/index.ts diff --git a/libs/api-client/tsconfig.json b/libs/front/api-client/tsconfig.json similarity index 89% rename from libs/api-client/tsconfig.json rename to libs/front/api-client/tsconfig.json index db7b566..f2400ab 100644 --- a/libs/api-client/tsconfig.json +++ b/libs/front/api-client/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../tsconfig.base.json", "compilerOptions": { "module": "commonjs", "forceConsistentCasingInFileNames": true, diff --git a/libs/api-client/tsconfig.lib.json b/libs/front/api-client/tsconfig.lib.json similarity index 84% rename from libs/api-client/tsconfig.lib.json rename to libs/front/api-client/tsconfig.lib.json index d9f60c1..628e61d 100644 --- a/libs/api-client/tsconfig.lib.json +++ b/libs/front/api-client/tsconfig.lib.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "declaration": true, "types": ["node"] }, diff --git a/package.json b/package.json index 435fc3a..ed6904f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "rust:test": "cargo llvm-cov --open --ignore-filename-regex 'init'", "rust:start": "podman compose up -d && nx run back:run", "rust:generate": "cargo run --bin swagger -- ./swagger.json", - "vue:gen_api": "npx @hey-api/openapi-ts -i ./swagger.json -o libs/api-client/src/api -c @hey-api/client-axios" + "vue:gen_api": "npx @hey-api/openapi-ts -i ./swagger.json -o libs/front/api-client/src/api -c @hey-api/client-axios" }, "private": true, "dependencies": { diff --git a/tsconfig.base.json b/tsconfig.base.json index 910d73c..65a9580 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,7 +15,7 @@ "skipDefaultLibCheck": true, "baseUrl": ".", "paths": { - "@portfolio/api-client": ["libs/api-client/src/index.ts"], + "@portfolio/api-client": ["libs/front/api-client/src/index.ts"], "@portfolio/hook": ["libs/hook/src/index.ts"] } },