Skip to content

Commit

Permalink
Migrate from AZDO to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
baksetercx committed Jan 21, 2025
1 parent 009de7a commit fe7eac6
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 174 deletions.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions .github/workflows/chart-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Chart testing

on:
pull_request:
branches: [master]

jobs:
chart-testing:
name: Chart testing
runs-on: elvia-runner
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Kubernetes cluster
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
sudo service docker restart
kind create cluster --wait 5m
- name: Install kube-prometheus-stack with Helm
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack
- name: Get events
if: failure()
run: kubectl get events

- name: Install Traefik
run: |
helm repo add traefik https://helm.traefik.io/traefik
helm install --version '26.*' traefik traefik/traefik
- name: Create namespace core
run: kubectl create namespace core

- name: Create service accounts
run: |
kubectl -n core create sa pushreceiver-chart-testing
kubectl -n core create sa webapi-chart-testing
kubectl -n core create sa worker-chart-testing
- name: Test kubectl
run: |
kubectl get namespace
kubectl get servicemonitor --all-namespaces
- name: Install yamllint
run: |
sudo apt-get update
sudo apt-get install yamllint -y
- name: Install yamale
run: pipx install yamale

- name: Configure ct config
run: |
mkdir "$HOME/.ct"
mv ct/etc/* "$HOME/.ct/"
- name: Run ct lint
run: ./ct/bin/ct lint --config ct.yaml

- name: Run ct install --upgrade
run: ./ct/bin/ct install --upgrade --config ct.yaml
78 changes: 78 additions & 0 deletions .github/workflows/deploy-demo-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy demo-api

on:
pull_request:
branches: [master]
push:
branches: [master]

env:
APPLICATION_NAME: 'demo-api'
SYSTEM_NAME: 'core'

concurrency:
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true

jobs:
set-env:
name: Set environment variables
runs-on: ubuntu-latest
outputs:
helm-chart-repository-url: ${{ steps.set-env.outputs.helm-chart-repository-url }}
steps:
- name: Set environment variables
id: set-env
run: |
# We only set for PR, meaning on push it will be empty, making it default to default URL.
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
echo 'helm-chart-repository-url=https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/${{ github.head_ref }}' >> "$GITHUB_OUTPUT"
fi
deploy-stable:
name: Deploy Stable
needs: [set-env]
runs-on: elvia-runner
permissions:
contents: read
id-token: write
env:
HELM_VALUES_FILE: '.github/deploy/values-demo-api-stable.yml'
environment: dev
steps:
- name: Deploy
uses: 3lvia/core-github-actions-templates/deploy@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
environment: 'dev'
AZURE_CLIENT_ID: ${{ vars.AKS_CLIENT_ID }}
helm-values-file: ${{ matrix.helm-values-file }}
helm-chart-repository-url: ${{ needs.set-env.outputs.helm-chart-repository-url }}

- name: Rollback
run: helm -n "$SYSTEM_NAME" rollback "$APPLICATION_NAME"

deploy-progressive:
name: Deploy Stable
needs: [set-env, deploy-stable]
runs-on: elvia-runner
permissions:
contents: read
id-token: write
env:
HELM_VALUES_FILE: '.github/deploy/values-demo-api-progressive.yml'
environment: dev
steps:
- name: Deploy
uses: 3lvia/core-github-actions-templates/deploy@trunk
with:
name: ${{ env.APPLICATION_NAME }}
namespace: ${{ env.SYSTEM_NAME }}
environment: 'dev'
AZURE_CLIENT_ID: ${{ vars.AKS_CLIENT_ID }}
helm-values-file: ${{ matrix.helm-values-file }}
helm-chart-repository-url: ${{ needs.set-env.outputs.helm-chart-repository-url }}

- name: Rollback
run: helm -n "$SYSTEM_NAME" rollback "$APPLICATION_NAME"
48 changes: 0 additions & 48 deletions CI/demo-api-azure-pipeline.yaml

This file was deleted.

43 changes: 0 additions & 43 deletions CI/templates/deploy.yaml

This file was deleted.

83 changes: 0 additions & 83 deletions azure-pipeline.yaml

This file was deleted.

Empty file modified ct/bin/ct
100644 → 100755
Empty file.

0 comments on commit fe7eac6

Please sign in to comment.