Initial commit
This commit is contained in:
commit
1521c137dc
|
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Initializes a git repository and pushes to a remote using credentials from arguments
|
||||||
|
#
|
||||||
|
# Usage: ./git-init-from-config.sh <git-url> <git-user> <git-token>
|
||||||
|
#
|
||||||
|
# Arguments:
|
||||||
|
# git-url - Repository URL (e.g., https://gitea.example.com/user/repo.git)
|
||||||
|
# git-user - Git username
|
||||||
|
# git-token - Git token or password
|
||||||
|
#
|
||||||
|
# The branch name will be read from the VERSION file (first line)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$#" -lt 3 ]; then
|
||||||
|
echo "Usage: $0 <git-url> <git-user> <git-token>"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " git-url - Repository URL (e.g., https://gitea.example.com/user/repo.git)"
|
||||||
|
echo " git-user - Git username"
|
||||||
|
echo " git-token - Git token or password"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
GIT_URL="$1"
|
||||||
|
GIT_USER="$2"
|
||||||
|
GIT_TOKEN="$3"
|
||||||
|
|
||||||
|
if [ -z "$GIT_URL" ]; then
|
||||||
|
echo "Error: git-url is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$GIT_USER" ]; then
|
||||||
|
echo "Error: git-user is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$GIT_TOKEN" ]; then
|
||||||
|
echo "Error: git-token is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "VERSION" ]; then
|
||||||
|
echo "Error: VERSION file not found in current directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
GIT_BRANCH=$(head -n 1 VERSION | tr -d '[:space:]')
|
||||||
|
|
||||||
|
if [ -z "$GIT_BRANCH" ]; then
|
||||||
|
echo "Error: VERSION file is empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Version detected: $GIT_BRANCH"
|
||||||
|
|
||||||
|
if [[ "$GIT_URL" == https://* ]]; then
|
||||||
|
URL_WITHOUT_PROTOCOL="${GIT_URL#https://}"
|
||||||
|
AUTH_URL="https://${GIT_USER}:${GIT_TOKEN}@${URL_WITHOUT_PROTOCOL}"
|
||||||
|
elif [[ "$GIT_URL" == http://* ]]; then
|
||||||
|
URL_WITHOUT_PROTOCOL="${GIT_URL#http://}"
|
||||||
|
AUTH_URL="http://${GIT_USER}:${GIT_TOKEN}@${URL_WITHOUT_PROTOCOL}"
|
||||||
|
else
|
||||||
|
echo "Error: URL must start with http:// or https://"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Initializing git repository..."
|
||||||
|
git init
|
||||||
|
|
||||||
|
echo "Adding all files..."
|
||||||
|
git add .
|
||||||
|
|
||||||
|
echo "Creating initial commit..."
|
||||||
|
git commit -m "Initial commit" || echo "Nothing to commit or already committed"
|
||||||
|
|
||||||
|
echo "Setting branch to $GIT_BRANCH..."
|
||||||
|
git branch -M "$GIT_BRANCH"
|
||||||
|
|
||||||
|
echo "Adding remote origin..."
|
||||||
|
git remote remove origin 2>/dev/null || true
|
||||||
|
git remote add origin "$AUTH_URL"
|
||||||
|
|
||||||
|
echo "Pushing to remote..."
|
||||||
|
git push -u origin "$GIT_BRANCH"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Done! Repository pushed to $GIT_URL on branch $GIT_BRANCH"
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
store_name: SUSE Store
|
||||||
|
version: 1
|
||||||
|
models:
|
||||||
|
- linear
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
name: linear
|
||||||
|
file: linear.py
|
||||||
|
class: Linear
|
||||||
|
requirements:
|
||||||
|
- pandas
|
||||||
|
version: 0.0.1
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
from models.linear.operations import operate
|
||||||
|
|
||||||
|
|
||||||
|
class Linear:
|
||||||
|
def __init__(self):
|
||||||
|
self.weight = 0.2
|
||||||
|
self.bias = 5
|
||||||
|
|
||||||
|
def predict(self, x: DataFrame) -> DataFrame:
|
||||||
|
return operate(x, self.weight, self.bias)
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
|
||||||
|
def operate(x: DataFrame, weight: float, bias: float) -> DataFrame:
|
||||||
|
return x * weight + bias
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
# SUSE Store Store Package Instructions
|
||||||
|
|
||||||
|
This archive contains the files required to use the **SUSE Store** model store.
|
||||||
|
|
||||||
|
## Contents
|
||||||
|
|
||||||
|
- Compressed archive: `suse-store.tar.gz`
|
||||||
|
- Base64-encoded archive: `suse-store.tar.gz.base64`
|
||||||
|
- Store directory (inside the archive): `suse-store/`
|
||||||
|
- Store metadata index: `suse-store/index.yaml`
|
||||||
|
- Individual model definitions under: `suse-store/models/<model-name>/`
|
||||||
|
|
||||||
|
## How to use the tar.gz archive
|
||||||
|
|
||||||
|
1. Make sure you have `tar` installed on your system.
|
||||||
|
2. Download or copy the file `suse-store.tar.gz` to your target machine.
|
||||||
|
3. Extract the archive:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tar -xzf suse-store.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
4. After extraction, you will have a directory named `suse-store/` containing:
|
||||||
|
- The store index at `suse-store/index.yaml`.
|
||||||
|
- The selected model folders under `suse-store/models/`.
|
||||||
|
|
||||||
|
## How to reconstruct from the base64 file
|
||||||
|
|
||||||
|
If you only have the base64 file (`suse-store.tar.gz.base64`), you can recreate the archive with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
base64 -d suse-store.tar.gz.base64 > suse-store.tar.gz
|
||||||
|
tar -xzf suse-store.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
The resulting directory structure will be the same as described above.
|
||||||
Loading…
Reference in New Issue