Skip to content

Commit

Permalink
Merge pull request #5 from konstellation-io/feat/KAI-140-add-scripts-…
Browse files Browse the repository at this point in the history
…images

Feat/kai 140, 141, 139
  • Loading branch information
kafkaphoenix authored Dec 18, 2024
2 parents fc18f05 + cbc73b4 commit 5362dcd
Show file tree
Hide file tree
Showing 29 changed files with 1,553 additions and 144 deletions.
56 changes: 28 additions & 28 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# name: "Linter"
name: "Linter"

# on:
# pull_request:
# branches:
# - main
on:
pull_request:
branches:
- main

# jobs:
# quality-checks:
# runs-on: ubuntu-latest
jobs:
quality-checks:
runs-on: ubuntu-latest

# permissions:
# contents: read
# pull-requests: read
# checks: write
permissions:
contents: read
pull-requests: read
checks: write

# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# persist-credentials: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.23.2
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.2

# - name: API Go Lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: v1.62.2
# working-directory: ./src
# args: --config ../.github/.golangci.yml
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: API Go Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
working-directory: ./src/demo-workflow/triggers/rest-trigger
args: --config ../../../../.github/.golangci.yml
github-token: ${{ secrets.GITHUB_TOKEN }}
48 changes: 0 additions & 48 deletions .kai/dev/.kai-project-template.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .kai/local/kai-project-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: v0.1.4
description: kai-project-template
config: {}
workflows:
- name: demo-workflow
type: training
config: {}
processes:
- name: trigger
type: trigger
image: registry.kai.local/kai-project-template_rest-trigger:v0.0.1
replicas: 1
gpu: false
config:
path: /rest-trigger
port: "8080"
objectStore: null
secrets: []
subscriptions:
- exit
networking:
targetPort: 8080
destinationPort: 8080
protocol: HTTP
resourceLimits:
CPU:
request: "0.5"
limit: "1"
memory:
request: 400M
limit: 800M
- name: training
type: task
image: registry.kai.local/kai-project-template_training:v0.0.4
replicas: 1
gpu: false
objectStore: null
secrets: []
subscriptions:
- trigger
networking: null
resourceLimits:
CPU:
request: "0.5"
limit: "1"
memory:
request: 400M
limit: 800M
- name: exit
type: exit
image: registry.kai.local/kai-project-template_exit:v0.0.2
replicas: 1
gpu: false
objectStore: null
secrets: []
subscriptions:
- training
networking: null
resourceLimits:
CPU:
request: "0.5"
limit: "1"
memory:
request: 400M
limit: 800M
22 changes: 17 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,20 @@ repos:
args:
- --fix
- id: ruff-format
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: golangci-lint
args: ['--config', '.github/.golangci.yml', 'src/...']
# - repo: https://github.com/dnephin/pre-commit-golang
# rev: v0.5.1
# hooks:
# - id: golangci-lint
# args:
# [
# "--config",
# ".github/.golangci.yml",
# "src/demo-workflow/triggers/rest-trigger/...",
# ]
# - repo: local
# hooks:
# - id: linter
# name: linter
# entry: make tidy
# language: system
# types: [file, python]
77 changes: 77 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This variable have the environment to use, by default is local, but you can change when you run the make command
ENV ?= local

# Read the PRODUCT_NAME variable based on the file inside the corresponding directory
PRODUCT_NAME := $(shell basename $(wildcard .kai/$(ENV)/*.yaml) .yaml)

# Read the PRODUCT_VERSION variable based on the file inside the corresponding directory
PRODUCT_VERSION := $(shell grep 'version:' .kai/$(ENV)/$(PRODUCT_NAME).yaml | awk '{print $$2}')

# Sub folders of process
SUBDIRS = src/demo-workflow/triggers/rest-trigger src/demo-workflow/tasks/training src/demo-workflow/exits/exit

# Test for the see the value of the variables
.PHONY: show-vars
show-vars:
@echo "ENV: $(ENV)"
@echo "PRODUCT_NAME: $(PRODUCT_NAME)"
@echo "PRODUCT_VERSION: $(PRODUCT_VERSION)"

# AutoDoc
# -------------------------------------------------------------------------
.PHONY: help
help: ## This help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help

.PHONY: login
login: ## Login to the aio platform
kli server login --client-id kai-kli-oidc --realm konstellation

.PHONY: update-process-env
update-process-env: ## Update process environment
./scripts/update_process_env.sh

.PHONY: create-product
create-product: ## Push processes images
kli product create $(PRODUCT_NAME) --description "Kai Project Template"

.PHONY: push-all-process-images
push-all-process-images: ## Push all process image by default
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir push-image; \admin/master/console/#/konstellation/users/2cb1e3b2-3ffd-4cda-84e7-a0c16d042706/credentials
done

.PHONY: push-product-version
push-product-version: ## Push new product version
kli product version push .kai/$(ENV)/$(PRODUCT_NAME).yaml

.PHONY: start-product-version
start-product-version: ## Start the product version
kli product version start $(PRODUCT_NAME) $(PRODUCT_VERSION) "starting $(PRODUCT_VERSION) version..."

.PHONY: stop-product-version
stop-product-version: ## Stop the product version
kli product version stop $(PRODUCT_NAME) $(PRODUCT_VERSION) "stopping $(PRODUCT_VERSION) version..."

.PHONY: publish-product-version
publish-product-version: ## Publish the product version skipping the unpublished step
kli product version publish $(PRODUCT_NAME) $(PRODUCT_VERSION) "publishing $(PRODUCT_VERSION) version..." --force

.PHONY: send-request
send-request: ## Send a request to the product version
./scripts/send_request.sh

.PHONY: unpublish-product-version
unpublish-product-version: ## Unpublish the product version
kli product version unpublish $(PRODUCT_NAME) $(PRODUCT_VERSION) "unpublishing $(PRODUCT_VERSION) version..."

##### HELPERS #####

.PHONY: list-processes-images #
list-processes-images: ## List workflow processes
kli process-registry ls $(PRODUCT_NAME)

.PHONY: list-product-versions
list-product-versions: ## List product versions
kli product version list $(PRODUCT_NAME)
Loading

0 comments on commit 5362dcd

Please sign in to comment.