Skip to content

Commit

Permalink
fix: add new ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-koontz committed Apr 22, 2024
1 parent 168bf5b commit 1c206d7
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 108 deletions.
50 changes: 0 additions & 50 deletions .github/actions/build-push-ecr/action.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/actions/setup-env/action.yml

This file was deleted.

59 changes: 43 additions & 16 deletions .github/workflows/dev-build-deploy-on-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,67 @@ name: Dev - Build and Deploy on main
on:
push:
branches:
- master
- main

defaults:
run:
shell: bash

jobs:

build-hashnode-starter-kit:
runs-on: [self-hosted, dev]
jobs:
build:
runs-on: mdb-dev
env:
AWS_REGION: us-east-2
steps:
- uses: actions/checkout@v2
- name: Generate token
# Use the Github App private key to request an installation
# token with read-only access to the organization's private
# repositories. This token is then used in the checkout step
# (but not in subsequent steps that create releases and upload
# assets, those still use the default token that has write
# access to the current repository).
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.ACTION_APP_ID }}
private_key: ${{ secrets.ACTION_APP_KEY }}
- name: Checkout tag
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build-push-ecr
submodules: recursive
token: ${{ steps.generate_token.outputs.token }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
module-name: ${{ env.CI_REPOSITORY_NAME_SLUG }}
build-for-environment: dev
# extra-build-args: "-f docker/mindsdb.Dockerfile"
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: ./github-actions/build-push-ecr
with:
module-name: ${{ env.CI_REPOSITORY_SLUG }}
build-for-environment: development
# extra-build-args: -f docker/Dockerfile

deploy:
runs-on: [self-hosted, dev]
needs: [build-hashnode-starter-kit]
runs-on: mdb-dev
needs: build
environment:
name: dev
url: https://hashnode.dev.mindsdb.com/blog
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-env
- uses: actions/checkout@v4
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: DevOps-Nirvana/aws-helm-multi-deploy-nodocker@v2
with:
environment-slug: dev
k8s-namespace: dev
image-tag: dev-${{ env.SLUG }}
image-tag: development-${{ env.SLUG }}
timeout: 600s
61 changes: 46 additions & 15 deletions .github/workflows/prod-build-deploy-on-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,69 @@ name: Prod - Build and Deploy on release
on:
release:
types: [published]
workflow_dispatch:

defaults:
run:
shell: bash


jobs:

build-hashnode-starter-kit:
runs-on: [self-hosted, dev]
build:
runs-on: mdb-dev
env:
AWS_REGION: us-east-2
steps:
- uses: actions/checkout@v2
- name: Generate token
# Use the Github App private key to request an installation
# token with read-only access to the organization's private
# repositories. This token is then used in the checkout step
# (but not in subsequent steps that create releases and upload
# assets, those still use the default token that has write
# access to the current repository).
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.ACTION_APP_ID }}
private_key: ${{ secrets.ACTION_APP_KEY }}
- name: Checkout tag
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build-push-ecr
submodules: recursive
token: ${{ steps.generate_token.outputs.token }}
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
module-name: ${{ env.CI_REPOSITORY_NAME_SLUG }}
build-for-environment: prod
# extra-build-args: "-f docker/mindsdb.Dockerfile"
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: ./github-actions/build-push-ecr
with:
module-name: ${{ env.CI_REPOSITORY_SLUG }}
build-for-environment: production
extra-build-args: -f docker/Dockerfile
image-ref: ${{ env.CI_REF_SLUG }}

deploy:
runs-on: [self-hosted, prod]
needs: [build-hashnode-starter-kit]
deploy-prod:
runs-on: mdb-prod
needs: [build]
environment:
name: prod
url: https://mindsdb.com/blog
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-env
- uses: actions/checkout@v4
- name: Pull MindsDB Github Actions
uses: actions/checkout@v4
with:
repository: mindsdb/github-actions
path: github-actions
ssh-key: ${{ secrets.GH_ACTIONS_PULL_SSH }}
- uses: ./github-actions/setup-env
- uses: DevOps-Nirvana/aws-helm-multi-deploy-nodocker@v2
with:
environment-slug: prod
k8s-namespace: prod
image-tag: prod-${{ env.SLUG }}
image-tag: production-${{ env.CI_REF_SLUG }}
timeout: 600s
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/out/

# production
/build
build/

# misc
.DS_Store
Expand All @@ -41,6 +41,14 @@ next-env.d.ts
.vscode/*
!.vscode/extensions.json

# Kubernetes / DevOps Nirvana
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Kubernetes / Gitlab CI Automation / Helm
requirements.lock
deployment/*/deployment/*/charts
deployment/*/charts
2 changes: 1 addition & 1 deletion deployment/hashnode-starter-kit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ deployment:

# Where the image comes from. This should be the ECR Repo / Gitlab Group / Repo Name
image:
repository: 454861456664.dkr.ecr.us-east-2.amazonaws.com/hashnode-starter-kit
repository: 454861456664.dkr.ecr.us-east-2.amazonaws.com/mindsdb-hashnode-starter-kit
# Uncomment these two temporarily (and disable probes below) to debug manually in Kubernetes
# command: ["/bin/sh"]
# args: ["-c", "while true; do echo hello; sleep 10;done"]
Expand Down

0 comments on commit 1c206d7

Please sign in to comment.