Skip to content

Commit

Permalink
Update Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
meanmail committed Oct 19, 2023
1 parent 09aef3f commit 7bb9e68
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 8 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/actions/helm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Prepare helm'
description: 'Prepare helm'

inputs:
resource_group:
required: true
description: Resource name
cluster_name:
required: true
description: Cluster name
client_id:
required: true
description: Azure client id
client_secret:
required: true
description: Azure client secret
subscription_id:
required: true
description: Azure subscription id
tenant_id:
required: true
description: Azure tenant id
helm_version:
default: 'v3.11.1'
description: 'Helm version'
kubectl_version:
default: 'v1.28.2'
description: 'kubectl version'

runs:
using: "composite"
steps:
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: ${{ inputs.helm_version }}

- uses: hyperskill/[email protected]
with:
client_id: ${{ inputs.client_id }}
client_secret: ${{ inputs.client_secret }}
subscription_id: ${{ inputs.subscription_id }}
tenant_id: ${{ inputs.tenant_id }}

- uses: azure/setup-kubectl@v3
with:
version: ${{ inputs.kubectl_version }}

- name: Azure Kubernetes set context
uses: Azure/aks-set-context@v3
with:
resource-group: ${{ inputs.resource_group }}
cluster-name: ${{ inputs.cluster_name }}
36 changes: 28 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,51 @@ jobs:
runs-on: [self-hosted, small]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
run: python -m pip install --upgrade poetry==1.5.1

- name: Config poetry
run: poetry config virtualenvs.create false

- name: Install dependencies
run: poetry install --only main,dev --no-interaction --no-ansi --no-cache
working-directory: ./slack_bot

- name: Lint
run: ruff .
working-directory: ./slack_bot

type_checking:
name: Static type checking
runs-on: [ self-hosted, small ]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
run: python -m pip install --upgrade poetry==1.5.1

- name: Config poetry
run: poetry config virtualenvs.create false

- name: Install dependencies
run: poetry install --only main,dev --no-interaction --no-ansi --no-cache
working-directory: ./slack_bot

- name: Lint
run: mypy .
working-directory: ./slack_bot

deploy:
name: Deploy
needs:
Expand All @@ -52,15 +64,18 @@ jobs:
runs-on: [self-hosted, small]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: hyperskill.azurecr.io/hyperskill
username: ${{ secrets.AZ_REGISTRY_USERNAME }}
password: ${{ secrets.AZ_REGISTRY_PASSWORD }}

- name: Build
uses: docker/build-push-action@v3
with:
Expand All @@ -69,12 +84,17 @@ jobs:
tags: hyperskill.azurecr.io/hyperskill/dataslackbot:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha
- uses: tale/kubectl-action@v1

- name: Set up Helm
uses: ./.github/workflows/actions/helm
with:
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
- uses: azure/setup-helm@v3
with:
version: 'v3.10.1'
resource_group: ${{ vars.RESOURCE_GROUP }}
cluster_name: ${{ vars.CLUSTER_NAME }}
client_id: ${{ secrets.CLIENT_ID }}
client_secret: ${{ secrets.CLIENT_SECRET }}
subscription_id: ${{ secrets.SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.TENANT_ID }}

- name: Deploy
run: |
helm upgrade data-slack-bot ./deploy/slack_bot \
Expand Down

0 comments on commit 7bb9e68

Please sign in to comment.