diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json new file mode 100644 index 0000000..bd52ea3 --- /dev/null +++ b/.github/pr-title-checker-config.json @@ -0,0 +1,14 @@ +{ + "LABEL": { + "name": "", + "color": "EEEEEE" + }, + "CHECKS": { + "prefixes": ["fix: ", "feat: ", "feature: ", "chore: ", "hotfix: "] + }, + "MESSAGES": { + "success": "All OK", + "failure": "Missing prefix", + "notice": "" + } +} diff --git a/.github/workflows/pr_check_tests.yml b/.github/workflows/pr_check_tests.yml new file mode 100644 index 0000000..814ac63 --- /dev/null +++ b/.github/workflows/pr_check_tests.yml @@ -0,0 +1,16 @@ +name: Code checks - tests + +on: + push: + branches: [ development, release-* ] #TODO: drop once debug finished + pull_request: + branches: + - development + - release-* + +jobs: + run_tests: + uses: epam/ai-dial-ci/.github/workflows/test_python_docker.yml@feat/test-ci + with: + bypass_checks: false + python_version: 3.11 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9202a77 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,12 @@ +name: Release version + +on: + push: + branches: [ development, release-* ] + +env: + IMAGE_NAME: ${{ github.repository }} + +jobs: + release: + uses: epam/ai-dial-ci/.github/workflows/publish_docker.yml@feat/test-ci \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index ce71802..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,205 +0,0 @@ -include: - - template: Jobs/Container-Scanning.gitlab-ci.yml - - project: Gitlab/ci - ref: 0.2.22 - file: helm/helm-environment.gitlab-ci.yml - -variables: - DOCKER_PATH: "ai/dial/bedrock-open-ai-adapter" - DOCKER_REGISTRY_SERVER: "registry-dev.deltixhub.com" - HELM_REPO: https://nexus.deltixhub.com/repository/epm-rtc-helm - SECRET_NAME: "epm-rtc-registry-dev" - CHART: "openai-bedrock-adapter" # Helm chart name, e.g. "gitlab-runner" - VERSION: "0.0.1" # Helm chart version - NAMESPACE: "openai-bedrock-adapter" - HELM_EXTRA_ARGS: "-f ${HELM_SECRET_FILE}" - - development_AWS_ACCESS_KEY_ID: ${staging_AWS_ACCESS_KEY_ID} - development_AWS_SECRET_ACCESS_KEY: ${staging_AWS_SECRET_ACCESS_KEY} - development_ENV_ID: "staging" - development_HELM_VALUES_FILE: "helm/development.yaml" - development_ENV_URL: "https://bedrock.staging.deltixhub.io" - # development_HELM_EXTRA_ARGS: "-f ${HELM_SECRET_FILE_dev}" - - 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: ${CHART}-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 - - make install - - source .venv/bin/activate - script: - - make lint - rules: - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $review_DEPLOY_ENV == "true" - - 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 - - make install - - source .venv/bin/activate - script: - - make test - rules: - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $review_DEPLOY_ENV == "true" - - 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: - - | - if git tag --contains HEAD; then - echo "Current commit is already tagged. Exiting..." - exit 0 - fi - - ver=$(echo -n $CI_COMMIT_REF_NAME | cut -f 2 -d '-') || ver=0.0 - - minor_tag=$(git describe --abbrev=0 --tags | cut -f 3 -d '.') || minor_tag=0 - - release_tag=${ver}.$(( minor_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