mirror of
https://github.com/freedbygrace/ActiveDirectoryManager.git
synced 2026-08-28 03:27:06 +00:00
Reorganize infrastructure as code and implement versioning schema
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Script to update the Kubernetes deployment with the current version
|
||||
|
||||
# Get the directory of this script
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# Read the version from version.txt
|
||||
VERSION_FILE="$PARENT_DIR/version.txt"
|
||||
if [ ! -f "$VERSION_FILE" ]; then
|
||||
echo "Error: version.txt not found at $VERSION_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(cat "$VERSION_FILE" | tr -d '[:space:]')
|
||||
echo "Using version: $VERSION"
|
||||
|
||||
# Update the deployment.yaml file
|
||||
DEPLOYMENT_FILE="$SCRIPT_DIR/deployment.yaml"
|
||||
if [ ! -f "$DEPLOYMENT_FILE" ]; then
|
||||
echo "Error: deployment.yaml not found at $DEPLOYMENT_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use sed to replace the image version
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macOS requires a different sed syntax
|
||||
sed -i '' "s|image: ActiveDirectoryManager:[0-9]\{4\}\.[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{4\}|image: ActiveDirectoryManager:$VERSION|g" "$DEPLOYMENT_FILE"
|
||||
sed -i '' "s|image: ActiveDirectoryManager:latest|image: ActiveDirectoryManager:$VERSION|g" "$DEPLOYMENT_FILE"
|
||||
else
|
||||
# Linux
|
||||
sed -i "s|image: ActiveDirectoryManager:[0-9]\{4\}\.[0-9]\{2\}\.[0-9]\{2\}\.[0-9]\{4\}|image: ActiveDirectoryManager:$VERSION|g" "$DEPLOYMENT_FILE"
|
||||
sed -i "s|image: ActiveDirectoryManager:latest|image: ActiveDirectoryManager:$VERSION|g" "$DEPLOYMENT_FILE"
|
||||
fi
|
||||
|
||||
echo "Updated deployment.yaml with version $VERSION"
|
||||
Reference in New Issue
Block a user