Skip to content

Commit

Permalink
draft new drone
Browse files Browse the repository at this point in the history
  • Loading branch information
mongodben committed Jul 27, 2023
1 parent a604d83 commit 9e4ee57
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ trigger:
- promote
target:
- staging
when:
ref:
- "!refs/tags/chat-server-qa"

steps:
# Deploys docker image associated with staging build that triggered promotion
Expand All @@ -118,6 +121,76 @@ steps:
kubernetes_token:
from_secret: staging_kubernetes_token

---
depends_on: ["test-all"]
kind: pipeline
type: kubernetes
name: qa-build-chat-server

trigger:
event:
- tag
ref:
include:
- refs/tags/chat-server-qa

steps:
# Builds and publishes Docker image for qa
- name: publish-qa-chat-server
image: plugins/kaniko-ecr
settings:
dockerfile: chat-server.dockerfile
create_repository: true
registry: 795250896452.dkr.ecr.us-east-1.amazonaws.com
repo: docs/${DRONE_REPO_NAME}-chat-server
tags:
- git-${DRONE_COMMIT_SHA:0:7}-qa
- latest-qa
access_key:
from_secret: ecr_access_key
secret_key:
from_secret: ecr_secret_key

# Promotes current drone build to staging environment (QA server is in staging namespace)
- name: promote-qa-chat-server
image: drone/cli:1.4.0-alpine
commands:
- drone build promote mongodb/docs-chatbot ${DRONE_BUILD_NUMBER} staging
environment:
DRONE_SERVER: ${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}
DRONE_TOKEN:
from_secret: drone_token

---
kind: pipeline
type: kubernetes
name: qa-deploy-chat-server

trigger:
event:
- promote
target:
- staging
when:
ref:
- refs/tags/chat-server-qa

steps:
# Deploys docker image associated with staging build that triggered promotion
- name: deploy-qa-chat-server
image: quay.io/mongodb/drone-helm:v3
settings:
chart: mongodb/web-app
chart_version: 4.12.3
add_repos: [mongodb=https://10gen.github.io/helm-charts]
namespace: docs
release: chat-server
values: image.tag=git-${DRONE_COMMIT_SHA:0:7}-qa,image.repository=795250896452.dkr.ecr.us-east-1.amazonaws.com/docs/${DRONE_REPO_NAME}-chat-server,ingress.enabled=true,ingress.hosts[0]=chat-qa.docs.staging.corp.mongodb.com
values_files: ["chat-server/environments/qa.yml"]
api_server: https://api.staging.corp.mongodb.com
kubernetes_token:
from_secret: staging_kubernetes_token

---
depends_on: ["test-all"]
kind: pipeline
Expand Down
29 changes: 29 additions & 0 deletions chat-server/environments/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
service:
targetPort: 3000

env:
PORT: 3000
OPENAI_EMBEDDING_MODEL: text-embedding-ada-002
OPENAI_EMBEDDING_MODEL_VERSION: 2023-03-15-preview
MONGODB_DATABASE_NAME: docs-chatbot-qa
VECTOR_SEARCH_INDEX_NAME: default
OPENAI_CHAT_COMPLETION_MODEL_VERSION: 2023-06-01-preview
ENVIRONMENT: qa

envSecrets:
MONGODB_CONNECTION_URI: docs-chatbot-staging
OPENAI_ENDPOINT: docs-chatbot-staging
OPENAI_API_KEY: docs-chatbot-staging
OPENAI_EMBEDDING_DEPLOYMENT: docs-chatbot-staging
OPENAI_CHAT_COMPLETION_DEPLOYMENT: docs-chatbot-staging

ingress:
enabled: true
hosts:
- chat-qa.docs.staging.corp.mongodb.com

resources:
limits:
memory: 1300Mi
requests:
memory: 1100Mi

0 comments on commit 9e4ee57

Please sign in to comment.