Compare commits
11 Commits
bfeb43f38a
...
v0.1.18
Author | SHA1 | Date | |
---|---|---|---|
5d00f072d8 | |||
9072e253ec | |||
063ad113d7 | |||
097be0f555 | |||
c7b8e24a54 | |||
fb1d016b36 | |||
89d58e9696 | |||
45c6e8180c | |||
c395885bbd | |||
75494e2a71 | |||
8e6e291f6a |
105
.github/workflows/build.yml
vendored
105
.github/workflows/build.yml
vendored
@@ -3,10 +3,8 @@ name: Rust Cross-Platform Build
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ "development", "main", "feature/*", "bugfix/*", "enhancement/*" ]
|
branches: [ "development", "main", "staging" ]
|
||||||
tags: [ "v*.*.*" ]
|
tags: [ "v*.*.*" ]
|
||||||
pull_request:
|
|
||||||
branches: [ "development", "main" ]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: git.triggermeelmo.com
|
REGISTRY: git.triggermeelmo.com
|
||||||
@@ -76,44 +74,6 @@ jobs:
|
|||||||
# working-directory: ${{ needs.detect-project.outputs.project-dir }}
|
# working-directory: ${{ needs.detect-project.outputs.project-dir }}
|
||||||
# run: cargo clippy -- -D warnings
|
# run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
set-tag:
|
|
||||||
name: Set Tag Name
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Determine next semantic version tag
|
|
||||||
id: set_tag
|
|
||||||
run: |
|
|
||||||
git fetch --tags
|
|
||||||
|
|
||||||
# Find latest tag matching vX.Y.Z
|
|
||||||
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
|
||||||
if [[ -z "$latest_tag" ]]; then
|
|
||||||
major=0
|
|
||||||
minor=0
|
|
||||||
patch=0
|
|
||||||
else
|
|
||||||
version="${latest_tag#v}"
|
|
||||||
IFS='.' read -r major minor patch <<< "$version"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
|
||||||
major=$((major + 1))
|
|
||||||
minor=0
|
|
||||||
patch=0
|
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
|
||||||
minor=$((minor + 1))
|
|
||||||
patch=0
|
|
||||||
else
|
|
||||||
patch=$((patch + 1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_tag="v${major}.${minor}.${patch}"
|
|
||||||
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# audit:
|
# audit:
|
||||||
# name: Security Audit
|
# name: Security Audit
|
||||||
# needs: [detect-project]
|
# needs: [detect-project]
|
||||||
@@ -189,14 +149,66 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
${{ needs.detect-project.outputs.project-dir }}/target/${{ matrix.target }}/release/${{ needs.detect-project.outputs.project-name }}${{ matrix.os == 'windows' && '.exe' || '' }}
|
${{ needs.detect-project.outputs.project-dir }}/target/${{ matrix.target }}/release/${{ needs.detect-project.outputs.project-name }}${{ matrix.os == 'windows' && '.exe' || '' }}
|
||||||
|
|
||||||
|
set-tag:
|
||||||
|
name: Set Tag Name
|
||||||
|
needs: [detect-project, build]
|
||||||
|
#if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
||||||
|
should_tag: ${{ steps.set_tag.outputs.should_tag }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Determine next semantic version tag
|
||||||
|
id: set_tag
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
|
||||||
|
# Find latest tag matching vX.Y.Z
|
||||||
|
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
||||||
|
if [[ -z "$latest_tag" ]]; then
|
||||||
|
major=0
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
else
|
||||||
|
version="${latest_tag#v}"
|
||||||
|
IFS='.' read -r major minor patch <<< "$version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
||||||
|
major=$((major + 1))
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new major version tag: ${new_tag}"
|
||||||
|
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new minor version tag: ${new_tag}"
|
||||||
|
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new patch version tag: ${new_tag}"
|
||||||
|
fi
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
name: Build and Push Docker Image
|
name: Build and Push Docker Image
|
||||||
needs: [detect-project, build, set-tag]
|
needs: [detect-project, build, set-tag]
|
||||||
#if: |
|
if: |
|
||||||
# always() &&
|
needs.detect-project.result == 'success' &&
|
||||||
# needs.detect-project.result == 'success' &&
|
needs.build.result == 'success' &&
|
||||||
# needs.build.result == 'success' &&
|
needs.set-tag.outputs.should_tag == 'true' &&
|
||||||
# github.event_name != 'pull_request'
|
github.event_name != 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
steps:
|
steps:
|
||||||
@@ -251,7 +263,6 @@ jobs:
|
|||||||
git tag ${{ needs.set-tag.outputs.tag_name }}
|
git tag ${{ needs.set-tag.outputs.tag_name }}
|
||||||
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
||||||
|
|
||||||
|
|
||||||
summary:
|
summary:
|
||||||
name: Workflow Summary
|
name: Workflow Summary
|
||||||
needs: [test, build, docker-build]
|
needs: [test, build, docker-build]
|
||||||
|
@@ -68,7 +68,7 @@ pub async fn register_with_server(
|
|||||||
// Try to register (will retry on failure)
|
// Try to register (will retry on failure)
|
||||||
loop {
|
loop {
|
||||||
println!("Attempting to register with server...");
|
println!("Attempting to register with server...");
|
||||||
let url = format!("{}/monitoring/register-agent-by-id", base_url);
|
let url = format!("{}/monitoring/hardware-info", base_url);
|
||||||
match client.post(&url).json(®istration).send().await {
|
match client.post(&url).json(®istration).send().await {
|
||||||
Ok(resp) if resp.status().is_success() => {
|
Ok(resp) if resp.status().is_success() => {
|
||||||
println!("✅ Successfully registered with server.");
|
println!("✅ Successfully registered with server.");
|
||||||
@@ -108,7 +108,7 @@ async fn get_server_id_by_ip(
|
|||||||
.danger_accept_invalid_certs(true)
|
.danger_accept_invalid_certs(true)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let url = format!("{}/monitoring/server-id-by-ip?ipAddress={}", base_url, ip);
|
let url = format!("{}/monitoring/register?ipAddress={}", base_url, ip);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
println!("Attempting to fetch server ID for IP {}...", ip);
|
println!("Attempting to fetch server ID for IP {}...", ip);
|
||||||
|
@@ -90,7 +90,10 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||||||
|
|
||||||
// Registration with backend server
|
// Registration with backend server
|
||||||
let (server_id, ip) = match api::register_with_server(&server_url).await {
|
let (server_id, ip) = match api::register_with_server(&server_url).await {
|
||||||
Ok((id, ip)) => (id, ip),
|
Ok((id, ip)) => {
|
||||||
|
println!("Registered with server. ID: {}, IP: {}", id, ip);
|
||||||
|
(id, ip)
|
||||||
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Fehler bei der Registrierung am Server: {e}");
|
eprintln!("Fehler bei der Registrierung am Server: {e}");
|
||||||
return Err(e);
|
return Err(e);
|
||||||
|
Reference in New Issue
Block a user