Add initial files

This commit is contained in:
gitea_admin_user 2025-04-09 16:46:05 +00:00
commit 2b82c4cd8d
7 changed files with 238 additions and 0 deletions

View File

@ -0,0 +1,3 @@
{}

View File

@ -0,0 +1,74 @@
name: Build and Push Docker Image
on:
push:
branches:
- '*'
branches-ignore:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; else echo "requirements.txt not found, skipping installation."; fi
- name: Run Unit Tests
run: python -m unittest discover -s . -p 'test_*.py'
build_and_push:
runs-on: ubuntu-latest
needs: test # Ensures `build_and_push` runs only if `test` succeeds
env:
DOCKER_HOST: unix:///var/run/docker.sock
steps:
- name: Identify Repository
id: extract_repo
run: echo "::set-output name=repo_name::${GITHUB_REPOSITORY##*/}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Auth to Container Registry
uses: docker/login-action@v2
with:
registry: centurion-version-control.default.svc.cluster.local:3000
username: ${{ secrets.CI_USER }}
password: ${{ secrets.CI_USER_TOKEN }}
- name: Pull flow_wrapper Image
run: |
docker pull centurion-version-control.default.svc.cluster.local:3000/centurion/system/flows-wrapper:latest
- name: Build and push Container Image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:${{ github.sha }}
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:latest
build-args: |
CONTAINER_REGISTRY=centurion-version-control.default.svc.cluster.local:3000/centurion/system
REPO_NAME=${{ steps.extract_repo.outputs.repo_name }}
BRANCH_NAME=${{ github.ref_name }}
VERSION=${{ github.sha }}
NAMESPACE=default

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
ARG CONTAINER_REGISTRY=version-control.centurion.localhost
# User Dockerfile
FROM ${CONTAINER_REGISTRY}/flows-wrapper:latest
ARG REPO_NAME=default
ARG BRANCH_NAME=default
ARG VERSION=default
ARG NAMESPACE=default
# Set up working directory
WORKDIR /app
# Copy user-specific files (flows.json, schemas, requirements)
COPY . .
# Install dependencies specific to the flow if requirements.txt exists
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
ENV REPO_NAME=$REPO_NAME
ENV BRANCH_NAME=$BRANCH_NAME
ENV VERSION=$VERSION
ENV NAMESPACE=$NAMESPACE
# Run the generator to create the workflow.py
RUN python generator.py --input-file /app/flows.json --output-file /app/workflow.py
# Set the entry point to the worker with the generated workflow
ENTRYPOINT ["python", "/app/flow_wrapper.py"]

1
README.md Normal file
View File

@ -0,0 +1 @@
**Hello world!!!**

19
flows.json Normal file
View File

@ -0,0 +1,19 @@
{
"nodes": [
{
"id": "c2w3wcw04fjyio9un4f",
"data": { "label": "Request" },
"position": { "x": 0, "y": 150 },
"type": "requestNode"
},
{
"id": "c2xjc7k07ahdxoi7ad7",
"data": { "label": "+" },
"position": { "x": 0, "y": 150 },
"type": "placeholder"
}
],
"edges": [
{ "id": "c2w3wcw04fjyio9un4f=>c2xjc7k07ahdxoi7ad7", "source": "c2w3wcw04fjyio9un4f", "target": "c2xjc7k07ahdxoi7ad7", "type": "placeholder" }
]
}

1
request_schema.json Normal file
View File

@ -0,0 +1 @@
{}

111
response_schema.json Normal file
View File

@ -0,0 +1,111 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "HybridWorkflow Schema",
"type": "object",
"properties": {
"request": {
"type": "object",
"description": "Inputs for the workflow"
},
"workflow_output": {
"type": "object",
"description": "Output of the workflow",
"properties": {
"workflow_id": {
"type": "string",
"description": "ID of the workflow instance"
},
"run_id": {
"type": "string",
"description": "ID of the workflow run"
},
"name": {
"type": "string",
"description": "Name of the workflow"
},
"status": {
"type": "string",
"description": "Current status of the workflow",
"enum": [
"in_progress",
"completed",
"failed"
]
},
"blocks": {
"type": "array",
"description": "Details of executed blocks",
"items": {
"type": "object",
"properties": {
"activity_id": {
"type": "string",
"description": "ID of the activity"
},
"name": {
"type": "string",
"description": "Name of the activity"
},
"status": {
"type": "string",
"description": "Status of the activity",
"enum": [
"completed",
"skipped",
"failed"
]
},
"input": {
"type": "object",
"description": "Input parameters for the activity"
},
"result": {
"type": [
"object",
"null"
],
"description": "Result of the activity"
},
"error": {
"type": [
"object",
"null"
],
"description": "Error details if activity failed",
"properties": {
"code": {
"type": "string",
"description": "Error code"
},
"description": {
"type": "string",
"description": "Error description"
},
"details": {
"type": "object",
"description": "Additional error details"
}
}
}
}
}
},
# "root_input": {
# "type": "object",
# "description": "Original root inputs passed to the workflow"
# }
},
"required": [
"workflow_id",
"run_id",
"name",
"status",
"blocks",
"root_input"
]
}
},
"required": [
"root_inputs"
]
}