Add initial files
This commit is contained in:
commit
1a68abcdb5
1
.gitea/workflows/cd_workflows.yml
Normal file
1
.gitea/workflows/cd_workflows.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
70
.gitea/workflows/ci_workflows.yml
Normal file
70
.gitea/workflows/ci_workflows.yml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
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
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
- 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 activity_block_wrapper Image
|
||||||
|
run: |
|
||||||
|
docker pull centurion-version-control.default.svc.cluster.local:3000/centurion/system/blocks-activity-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
|
||||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
ARG CONTAINER_REGISTRY=version-control.centurion.localhost
|
||||||
|
# User Dockerfile
|
||||||
|
FROM ${CONTAINER_REGISTRY}/blocks-activity-wrapper:latest
|
||||||
|
|
||||||
|
# Set up working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy user-specific files (block.py, schemas, requirements)
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Install dependencies specific to block.py
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
RUN ls ./
|
||||||
|
|
||||||
|
# Set CMD to execute the symbolic link, making it look like block.py is the entry
|
||||||
|
CMD ["python", "/app/block_wrapper.py"]
|
||||||
11
block.py
Normal file
11
block.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
@flowx_block
|
||||||
|
def example_function(request: dict):
|
||||||
|
case = request["case"]
|
||||||
|
|
||||||
|
switch_dict = {
|
||||||
|
# Define your cases here
|
||||||
|
}
|
||||||
|
|
||||||
|
variable = switch_dict.get(case, "Invalid option")
|
||||||
|
|
||||||
|
return variable
|
||||||
16
input_schema.json
Normal file
16
input_schema.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"properties": {
|
||||||
|
"": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "",
|
||||||
|
"items": {
|
||||||
|
"type": "",
|
||||||
|
"enum": [
|
||||||
|
"// provide your possible options here..."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
output_schema.json
Normal file
16
output_schema.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"properties": {
|
||||||
|
"": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "",
|
||||||
|
"items": {
|
||||||
|
"type": "",
|
||||||
|
"enum": [
|
||||||
|
"// provide your possible options here..."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
request_schema.json
Normal file
1
request_schema.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
jsonschema==4.23.0
|
||||||
1
response_schema.json
Normal file
1
response_schema.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
Loading…
x
Reference in New Issue
Block a user