Skip to content

Kratix

Kratix #4

Workflow file for this run

name: Kratix
on:
workflow_dispatch:
inputs:
sha:
description: 'Commit sha of Kratix'
required: true
message:
description: 'Commit message'
required: false
jobs:
unit-tests-and-lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Unit Tests
run: |
make test
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.63.4
./bin/golangci-lint run --config=.golangci-required.yml
system-test:
runs-on: ubuntu-latest
needs: [unit-tests-and-lint]
steps:
- name: Check out kratix
uses: actions/checkout@v4
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Install Go
uses: actions/setup-go@v5
- name: Install Kind
uses: helm/kind-action@v1
with:
install_only: true
- name: Setup Flux CLI
uses: fluxcd/flux2/action@main
with:
version: '2.4.0'
- name: System Tests
run: |
DOCKER_BUILDKIT=1 ACK_GINKGO_RC=true make system-test core-test
integration-test:
runs-on: ubuntu-latest
needs: [unit-tests-and-lint]
steps:
- name: Check out kratix
uses: actions/checkout@v4
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Checkout out kratix helm charts
uses: actions/checkout@v4
with:
repository: syntasso/helm-charts
path: charts
- name: Install Go
uses: actions/setup-go@v5
- name: Install Kind
uses: helm/kind-action@v1
with:
install_only: true
- name: Install Helm
uses: azure/setup-helm@v3
- name: e2e-demo-test-helm-bucket
run: |
STATE_STORE="bucket" ./scripts/helm-e2e-test.sh
- name: e2e-demo-test-helm-git
run: |
STATE_STORE="git" ./scripts/helm-e2e-test.sh
tag-new-version:
needs: [system-test, integration-test]
runs-on: ubuntu-latest
steps:
- name: Check out kratix
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.ACTION_PUSH }}
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Tag new version
env:
LAST_SHA: ${{ github.event.inputs.sha }}
run: |
latest_tag="latest"
current_commit=${LAST_SHA:-$(git rev-parse HEAD)}
commit_list=$(git rev-list "$latest_tag".."$current_commit")
git config user.name "syntassodev"
git config user.email "kratix@syntasso.io"
echo "checking if there are new commits from main compared to the latest tag"
if [ -n "$commit_list" ]; then
echo "Current commit is ahead of the previous tag; pushing a new tag"
git tag -a $latest_tag -m "${latest_tag}" --force
git push origin $latest_tag --force
else
echo "Current commit is not ahead of the previous tag; not pushing a new tag"
fi
build-and-push-kratix-platform:
runs-on: ubuntu-latest
needs: [tag-new-version]
steps:
- name: Check out kratix
uses: actions/checkout@v4
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Docker login to GHCR
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Kratix Platform
run: |
make docker-build-and-push
build-and-push-pipeline-adapter:
runs-on: ubuntu-latest
needs: [tag-new-version]
steps:
- name: Check out kratix
uses: actions/checkout@v4
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Docker login to GHCR
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Pipeline
run: |
make build-and-push-work-creator
publish-release:
runs-on: ubuntu-latest
needs:
- build-and-push-kratix-platform
- build-and-push-pipeline-adapter
steps:
- name: Check out kratix
uses: actions/checkout@v4
id: checkout
with:
repository: syntasso/kratix
ref: ${{ github.event.inputs.sha }}
- name: Checkout out kratix helm charts
uses: actions/checkout@v4
with:
repository: syntasso/helm-charts
path: charts
ssh-key: ${{ secrets.HELM_REPO_SSH_KEY }}
- name: Create Kratix Distribution and Helm Template
run: |
./scripts/make-distribution
./charts/scripts/generate-templates-and-crds ./distribution/kratix.yaml
env:
VERSION: ${{ steps.checkout.outputs.commit }}
- name: Create Github Release
run: |
gh config set prompt disabled
gh release delete latest || true
gh release create latest --title latest ./distribution/**/*.yaml ./distribution/*.yaml
env:
GH_TOKEN: ${{ secrets.ACTION_PUSH }}
- name: push-to-helm-charts
run: |
cd charts
git config user.name “syntassodev”
git config user.email “kratix@syntasso.io”
git add kratix/
git diff --cached --quiet && exit 0 || true
git commit -m"update kratix package"
git push origin main