Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik committed Sep 3, 2024
0 parents commit 979ebc9
Show file tree
Hide file tree
Showing 85 changed files with 7,570 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/.nox
LICENSE
.history
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LOG_LEVEL=DEBUG
DIAL_URL=DIAL_URL
15 changes: 15 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[flake8]
# E501 string literal is too long
# W503 line break before binary operator
# E203 whitespace before ':' (triggered on list slices like xs[i : i + 5])
# E704 multiple statements on one line (def)
ignore = E501, W503, E203, E704
exclude =
.git,
.tmp,
.venv,
.conda,
.nox,
.pytest_cache
__pycache__,
__init__.py
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @adubovik
/.github/ @nepalevov @alexey-ban
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
time: "09:00"
# Disable version updates, keep security updates only
open-pull-requests-limit: 0
commit-message:
# Prefix all commit messages with "chore: "
prefix: "chore"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
time: "09:00"
commit-message:
# Prefix all commit messages with "chore: "
prefix: "chore"
14 changes: 14 additions & 0 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Validate PR title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
pr-title-check:
uses: epam/ai-dial-ci/.github/workflows/pr-title-check.yml@1.9.0
secrets:
ACTIONS_BOT_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR Workflow

on:
pull_request:
branches: [development, release-*]

jobs:
run_tests:
uses: epam/ai-dial-ci/.github/workflows/python_package_pr.yml@1.9.0
secrets: inherit
with:
python_version: 3.11
test_python_versions: '["3.11", "3.12"]'
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release Workflow

on:
push:
branches: [development, release-*]

jobs:
release:
uses: epam/ai-dial-ci/.github/workflows/python_package_release.yml@1.9.0
secrets: inherit
with:
python_version: 3.11
test_python_versions: '["3.11", "3.12"]'
26 changes: 26 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
id: scd
uses: peter-evans/slash-command-dispatch@13bc09769d122a64f75aa5037256f6f2d78be8c4 # v4.0.0
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
reaction-token: ${{ secrets.ACTIONS_BOT_TOKEN }}
config: >
[
{
"command": "deploy-review",
"permission": "write",
"issue_type": "pull-request",
"repository": "epam/ai-dial-ci",
"static_args": [
"application=${{ github.event.repository.name }}"
]
}
]
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.DS_Store
venv
.venv
.env
.history
.idea
__pycache__
.nox
dist
.vscode/launch.json
.pytest_cache
core-data
core-logs
config.json
~*
response_message_handler.py
198 changes: 198 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
include:
- template: Jobs/Container-Scanning.gitlab-ci.yml
- project: Gitlab/ci
ref: 0.2.27
file: helm/helm-environment.gitlab-ci.yml

variables:
DOCKER_PATH: "ai/dial/application/dial-interceptor-example"
DOCKER_REGISTRY_SERVER: "registry-dev.deltixhub.com"
HELM_REPO: https://charts.epam-rail.com
PRIVATE_HELM_REPO: "false"
CHART: "dial-extension" # Helm chart name, e.g. "gitlab-runner"
VERSION: "1.0.1" # Helm chart version
NAMESPACE: "dial-development"
# HELM_EXTRA_ARGS: "-f ${HELM_SECRET_FILE}"
RELEASE: ${CI_PROJECT_NAME}

development_ENV_ID: "staging"
development_HELM_VALUES_FILE: "helm/development.yaml"
development_ENV_URL: "https://dial-interceptor-example.staging.deltixhub.io"
development_AWS_ACCESS_KEY_ID: ${staging_AWS_ACCESS_KEY_ID}
development_AWS_SECRET_ACCESS_KEY: ${staging_AWS_SECRET_ACCESS_KEY}

staging_DEPLOY_ENV: "false"

review_DEPLOY_ENV: "true"
review_ENV_ID: "staging"
review_HELM_VALUES_FILE: "helm/review.yaml"
review_ENV_URL: "https://${CI_PROJECT_NAME}-mr-${CI_MERGE_REQUEST_IID}.staging.deltixhub.io"
review_HELM_CUSTOM_VALUES: "ingress.hosts[0]=${CI_PROJECT_NAME}-mr-${CI_MERGE_REQUEST_IID}.staging.deltixhub.io,fullnameOverride=mr-${CI_MERGE_REQUEST_IID},image.tag=mr-${CI_MERGE_REQUEST_IID}"
review_RELEASE: ${CI_PROJECT_NAME}-mr-${CI_MERGE_REQUEST_IID}
review_SECRET_NAME: "epm-rtc-registry-test"
review_DOCKER_REGISTRY_SERVER: "registry-test.deltixhub.com"
# review_HELM_EXTRA_ARGS: "-f ${HELM_SECRET_FILE_review}"

stages:
- tag
- lint
- test
- publish # publish docker images
- deploy
- promote # copy docker image to public repo
- production # Stage name used in include. Not used. ToDo - delete this

lint:
image: python:3.11-slim
stage: lint
before_script:
- apt-get update && apt-get install -y make
script:
- pip install poetry==1.6.1
- make lint
rules:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development"
- if: $CI_COMMIT_BRANCH == "development"
tags:
- kubernetes

test:
image: python:3.11-slim
stage: test
before_script:
- apt-get update && apt-get install -y make
script:
- pip install poetry==1.6.1
- make test
rules:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development"
- if: $CI_COMMIT_BRANCH == "development"
tags:
- kubernetes

deploy_development:
image: "registry.deltixhub.com/deltix.docker/devops/kubernetes-tools:0.17.1"
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "development"

destroy_development:
image: "registry.deltixhub.com/deltix.docker/devops/kubernetes-tools:0.17.1"
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "development"
when: manual
allow_failure: true

deploy_staging:
stage: deploy

destroy_staging:
stage: deploy

deploy_review:
image: "registry.deltixhub.com/deltix.docker/devops/kubernetes-tools:0.17.1"
stage: deploy
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $review_DEPLOY_ENV == "true"'

destroy_review:
image: "registry.deltixhub.com/deltix.docker/devops/kubernetes-tools:0.17.1"
stage: deploy
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $review_DEPLOY_ENV == "true"'
when: manual
allow_failure: true

publish:
image: dockerhub.deltixhub.com/docker:23.0.6
stage: publish
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
cache: {}
services:
- docker:23.0.6-dind
before_script:
- mkdir -p $HOME/.docker
# Use DOCKER_AUTH_CONFIG for login to deltix repo
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
script:
- imageUrl=$REPOSITORY/${DOCKER_PATH}
- docker build -t $imageUrl:${DOCKER_TAG} -t $imageUrl:${DOCKER_ADDITIONAL_TAG} .
- docker push $imageUrl:${DOCKER_TAG}
- docker push $imageUrl:${DOCKER_ADDITIONAL_TAG}
rules:
- if: $CI_COMMIT_TAG
variables:
DOCKER_TAG: ${CI_COMMIT_TAG}
DOCKER_ADDITIONAL_TAG: latest
REPOSITORY: ${ARTIFACTORY_DOCKER_DEV_REPOSITORY}
- if: $CI_COMMIT_BRANCH == "development"
variables:
DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
DOCKER_ADDITIONAL_TAG: alpha
REPOSITORY: ${ARTIFACTORY_DOCKER_DEV_REPOSITORY}
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development"'
variables:
DOCKER_TAG: gitlab-mr${CI_MERGE_REQUEST_ID}
DOCKER_ADDITIONAL_TAG: mr-${CI_MERGE_REQUEST_IID}
REPOSITORY: ${ARTIFACTORY_DOCKER_TEST_REPOSITORY}
tags:
- AWS
- DockerExecutor

"Tag branch":
image: alpine/git:v2.32.0
stage: tag
script:
- ver=$(echo -n $CI_COMMIT_REF_NAME | cut -f 2 -d '-') || ver=0.0
- patch_tag=$(git describe --abbrev=0 --tags | cut -f 3 -d '.') || patch_tag=-1
- release_tag=${ver}.$(( patch_tag+1 ))
- git remote set-url origin https://$GITLAB_ROBOT_NAME:$GITLAB_ROBOT_PUSH_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
- git config user.name $GITLAB_ROBOT_NAME
- git config user.email ${GITLAB_ROBOT_EMAIL}
- git diff --quiet && git diff --staged --quiet || git commit -am "RobotBuild ${release_tag}"
- git tag ${release_tag}
- git push origin HEAD:${CI_COMMIT_REF_NAME} --tags
dependencies: []
rules:
- if: "$CI_COMMIT_REF_SLUG =~ /^release-/ && $CI_COMMIT_MESSAGE !~ /^RobotBuild/"
tags:
- kubernetes

container_scanning:
stage: promote
variables:
GIT_STRATEGY: none
CS_IMAGE: ${ARTIFACTORY_DOCKER_DEV_REPOSITORY}/${DOCKER_PATH}:$CI_COMMIT_TAG
CS_REGISTRY_USER: ${ARTIFACTORY_USER}
CS_REGISTRY_PASSWORD: ${ARTIFACTORY_PASS}
dependencies: []
rules:
- if: $CI_COMMIT_TAG
tags:
- AWS
- DockerExecutor

### Copy frontend and backend docker images to public repository. Run on git tag manually
promote:
image: dockerhub.deltixhub.com/curlimages/curl:7.88.1
stage: promote
variables:
GIT_STRATEGY: none
script:
- 'curl --retry 6 --retry-all-errors --no-progress-meter --fail -X POST "${ARTIFACTORY_URL}/api/docker/epm-rtc-docker/v2/promote" -H "Content-Type: application/json" -u${ARTIFACTORY_USER}:${ARTIFACTORY_PASS} -d ''{ "targetRepo": "epm-rtc-public-docker", "dockerRepository": "''"${DOCKER_PATH}"''", "tag" : "''"$CI_COMMIT_TAG"''", "copy": true }'''
- >
if [ ! -z "$DOCKER_ADDITIONAL_TAG" ]; then
curl --retry 6 --retry-all-errors --no-progress-meter --fail -X POST "${ARTIFACTORY_URL}/api/docker/epm-rtc-docker/v2/promote" -H "Content-Type: application/json" -u${ARTIFACTORY_USER}:${ARTIFACTORY_PASS} -d '{ "targetRepo": "epm-rtc-public-docker", "dockerRepository": '\"${DOCKER_PATH}\"', "tag" : '\"$DOCKER_ADDITIONAL_TAG\"', "copy": true }';
fi
dependencies: []
rules:
- if: $CI_COMMIT_TAG
when: manual
variables:
DOCKER_ADDITIONAL_TAG: latest
tags:
- AWS
- DockerExecutor
24 changes: 24 additions & 0 deletions .ort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
excludes:
scopes:
- pattern: "dev"
reason: "DEV_DEPENDENCY_OF"
comment: "Packages for development only."
- pattern: "lint"
reason: "DEV_DEPENDENCY_OF"
comment: "Packages for static code analysis only."
- pattern: "test"
reason: "TEST_DEPENDENCY_OF"
comment: "Packages for testing only."
license_choices:
repository_license_choices:
- given: FTL OR GPL-2.0-or-later
choice: FTL
resolutions:
rule_violations:
- message: ".*PyPI::httpcore:0\\.18\\.0.*"
reason: "CANT_FIX_EXCEPTION"
comment: "BSD 3-Clause New or Revised License: https://github.com/encode/httpcore/blob/0.18.0/LICENSE.md"
- message: ".*PyPI::httpx:0\\.25\\.0.*"
reason: "CANT_FIX_EXCEPTION"
comment: "BSD 3-Clause New or Revised License: https://github.com/encode/httpx/blob/0.25.0/LICENSE.md"
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-python.python",
"ms-python.black-formatter",
"ms-python.isort"
]
}
Loading

0 comments on commit 979ebc9

Please sign in to comment.