Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into tedi/mockpluginrunner
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 authored Sep 5, 2024
2 parents 938e2f1 + f4a8441 commit 1854eba
Show file tree
Hide file tree
Showing 57 changed files with 1,747 additions and 473 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ jobs:
with:
# relax sandbox due impure kontrol-service tests during build
extra_nix_config: |
sandbox = relaxed
extra-platforms = aarch64-linux
sandbox = relaxed
- name: Magic cache
uses: DeterminateSystems/magic-nix-cache-action@v7

- name: Build ${{ matrix.component }}
run: |
nix build .#${{ matrix.component }} --no-link --print-out-paths --print-build-logs
nix build .#${{ matrix.component }} --no-link --print-out-paths
- name: Build ${{ matrix.component }} for ${{ matrix.arch }}
run: |
nix build ./#containers.x86_64-linux.${{ matrix.component }}.${{ matrix.arch }} --no-link --print-out-paths --print-build-logs
nix build ./#containers.x86_64-linux.${{ matrix.component }}.${{ matrix.arch }} --no-link --print-out-paths
114 changes: 114 additions & 0 deletions .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Our desired pipeline using only a Nix shell environment
name: E2E tests

permissions:
id-token: write
contents: read

on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main

jobs:
e2e_tests:
name: E2E tests
runs-on: ubuntu-22.04
steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v27
# relax sandbox due impure kontrol-service tests during build
with:
extra_nix_config: |
sandbox = relaxed
- name: Magic cache
uses: DeterminateSystems/magic-nix-cache-action@v7

- name: Build and load kontrol service image
run: |
docker load < $(nix build ./#kontrol-service-container --no-link --print-out-paths)
- name: Start kontrol service and Postgres
run: |
docker version
docker compose -f ci/docker-compose.yml up -d
docker ps
- name: Wait for docker network to be ready
run: sleep 10s
shell: bash

- name: Install CLI
run: curl get.kardinal.dev -sL | sh

- name: Verify kardinal command
run: bash -c 'source ~/.bashrc; if kardinal | grep -q "Kardinal CLI"; then exit 0; else exit 1; fi'

- name: Retrieve the tenant UUID
id: tenant
run: |
tenant_id=$(kardinal tenant show)
echo "id=${tenant_id}" >> "$GITHUB_OUTPUT"
- name: Deploy boutique demo manifest
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal deploy -k ci/obd-demo.yaml
- name: Validate cluster resources endpoint
run: |
tenant_id=${{ steps.tenant.outputs.id }}
services=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.services[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${services}" != "cartservice frontend postgres productcatalogservice" ]; then exit 1; fi
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi
- name: Validate topology endpoint
run: |
tenant_id=${{ steps.tenant.outputs.id }}
nodes=$(curl http://localhost:8080/tenant/${tenant_id}/topology | jq -r '.nodes[].id' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${nodes}" != "cartservice free-currency-api frontend frontend-external postgres productcatalogservice" ]; then exit 1; fi
- name: Create, validate and delete flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-frontend > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
tenant_id=${{ steps.tenant.outputs.id }}
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-prod" ]; then exit 1; fi
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}
- name: Create, validate and delete a more complex flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-on-sale -s productcatalogservice=kurtosistech/productcatalogservice:demo-on-sale > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
tenant_id=${{ steps.tenant.outputs.id }}
deployments=$(curl http://localhost:8080/tenant/${tenant_id}/cluster-resources | jq -r '.deployments[].metadata.name' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${deployments}" != "cartservice-prod frontend-${flow_id} frontend-prod postgres-prod productcatalogservice-${flow_id} productcatalogservice-prod" ]; then exit 1; fi
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}
- name: Create template
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal template create extra-item-shared --template-yaml ci/template.yaml --description "Extra item and postgres is shared"
KARDINAL_CLI_DEV_MODE=TRUE kardinal template ls | grep "extra-item-shared"
- name: Create flow with template and delete flow
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow create frontend kurtosistech/frontend:demo-frontend --template-args ci/template_args.yaml --template extra-item-shared > kardinal.out
flow_id=$(grep "Flow.*created" kardinal.out | cut -d ' ' -f2 | tr -d "\"")
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow ls | grep ${flow_id}
KARDINAL_CLI_DEV_MODE=TRUE kardinal flow delete ${flow_id}
- name: Delete template
run: |
KARDINAL_CLI_DEV_MODE=TRUE kardinal template delete extra-item-shared
8 changes: 4 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:

- name: Publish images to AWS
run: |
nix run ./#publish-kontrol-frontend-container
nix run ./#publish-kontrol-service-container
nix run ./#publish-aws-kontrol-frontend-container
nix run ./#publish-aws-kontrol-service-container
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -73,8 +73,8 @@ jobs:

- name: Publish images to DockerHub
run: |
nix run ./#publish-kontrol-frontend-container
nix run ./#publish-kontrol-service-container
nix run ./#publish-dockerhub-kontrol-frontend-container
nix run ./#publish-dockerhub-kontrol-service-container
deploy:
name: Update Cluster Deployment
Expand Down
Loading

0 comments on commit 1854eba

Please sign in to comment.