Track k8s manifest; teach make sync to mirror deployment/
The flights-front deploy repo ships k8s manifests at deployment/k8s/, a sibling of Aeroflot.Flights.Front/. Previously the sync script only copied the app source, so any env change landed on the k8s side had to be hand-edited in the deploy repo and was never reflected back. - Bring deployment/k8s/flights-ui.yaml into this repo (with the new MAP_TILE_URL env pointing at flights.test.aeroflot.ru) so the cluster config lives next to the code that reads it. - sync-to-flights-front.sh resolves the deploy-repo root from the target path and mirrors this repo's deployment/ directory there, mkdir'ing and copying contents without wiping unrelated files. - Bump step numbering (1/6..6/6) and the summary now lists the synced deployment files in addition to the app files.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: $AFL_PRJ_NAME
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: $AFL_PRJ_NAME
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: $AFL_PRJ_NAME
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/os: linux
|
||||
containers:
|
||||
- name: $AFL_PRJ_NAME
|
||||
image: $REGISTRY_SERVER/aeroflot.$K8NAMESPACE.$ENVIRONMENT/$AFL_PRJ_NAME:v$VERSION.$BUILD_NUMBER
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
resources:
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "1000m"
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "100m"
|
||||
env:
|
||||
- name: NODE_ENV
|
||||
value: production
|
||||
- name: ENVIRONMENT
|
||||
value: $ENVIRONMENT
|
||||
# flights-ui.devwebzavod.ru has no /map/api/** ingress rule, so
|
||||
# point Leaflet at the upstream tile service that the real
|
||||
# Aeroflot ingress serves (flights.test.aeroflot.ru terminates
|
||||
# /map/api/** correctly). Override per-cluster if a different
|
||||
# tile source is required.
|
||||
- name: MAP_TILE_URL
|
||||
value: https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg
|
||||
$IMAGE_PULL_SECRETS
|
||||
@@ -7,9 +7,18 @@ set -euo pipefail
|
||||
# ./scripts/sync-to-flights-front.sh [target-dir]
|
||||
#
|
||||
# Default target: /Users/gnezim/_projects/tims/flights-front/Aeroflot.Flights.Front
|
||||
#
|
||||
# The deploy repo has the shape:
|
||||
# flights-front/
|
||||
# Aeroflot.Flights.Front/ ← app source (target of this sync)
|
||||
# deployment/ ← k8s manifests, ci scripts, etc.
|
||||
# Anything under this repo's top-level deployment/ is copied to the
|
||||
# sibling deployment/ in the deploy repo so cluster config lives with
|
||||
# the source that consumes its env vars.
|
||||
|
||||
SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TARGET_DIR="${1:-/Users/gnezim/_projects/tims/flights-front/Aeroflot.Flights.Front}"
|
||||
DEPLOY_ROOT="$(cd "$TARGET_DIR/.." && pwd)"
|
||||
|
||||
if [ ! -d "$TARGET_DIR" ]; then
|
||||
echo "Error: target directory does not exist: $TARGET_DIR"
|
||||
@@ -17,11 +26,12 @@ if [ ! -d "$TARGET_DIR" ]; then
|
||||
fi
|
||||
|
||||
echo "Syncing: $SRC_DIR → $TARGET_DIR"
|
||||
echo " $SRC_DIR/deployment → $DEPLOY_ROOT/deployment"
|
||||
echo ""
|
||||
|
||||
# ── Step 1: Clean target (preserve node_modules, .git, .dockerignore) ────────
|
||||
|
||||
echo "1/5 Cleaning target directory..."
|
||||
echo "1/6 Cleaning target directory..."
|
||||
find "$TARGET_DIR" -mindepth 1 -maxdepth 1 \
|
||||
! -name "node_modules" \
|
||||
! -name ".dockerignore" \
|
||||
@@ -29,7 +39,7 @@ find "$TARGET_DIR" -mindepth 1 -maxdepth 1 \
|
||||
|
||||
# ── Step 2: Copy source files ────────────────────────────────────────────────
|
||||
|
||||
echo "2/5 Copying source files..."
|
||||
echo "2/6 Copying source files..."
|
||||
|
||||
# App source & config
|
||||
cp -r "$SRC_DIR/src" "$TARGET_DIR/src"
|
||||
@@ -54,9 +64,23 @@ cp "$SRC_DIR/AGENTS.md" "$TARGET_DIR/AGENTS.md"
|
||||
# Dockerfile — use the SSR-specific one
|
||||
cp "$SRC_DIR/Dockerfile.react" "$TARGET_DIR/Dockerfile"
|
||||
|
||||
# ── Step 3: Clean up artifacts that shouldn't be in the target ────────────────
|
||||
# ── Step 3: Copy deployment configs to the sibling deployment/ dir ──────────
|
||||
|
||||
echo "3/5 Cleaning up artifacts..."
|
||||
echo "3/6 Copying deployment configs..."
|
||||
|
||||
if [ -d "$SRC_DIR/deployment" ]; then
|
||||
mkdir -p "$DEPLOY_ROOT/deployment"
|
||||
# Mirror deployment/ without nuking unrelated files under the deploy
|
||||
# repo's deployment dir — copy contents, don't wipe the target.
|
||||
cp -R "$SRC_DIR/deployment/." "$DEPLOY_ROOT/deployment/"
|
||||
echo " copied $(find "$SRC_DIR/deployment" -type f | wc -l | tr -d ' ') file(s) into $DEPLOY_ROOT/deployment"
|
||||
else
|
||||
echo " (no deployment/ dir in source repo — skipping)"
|
||||
fi
|
||||
|
||||
# ── Step 4: Clean up artifacts that shouldn't be in the target ────────────────
|
||||
|
||||
echo "4/6 Cleaning up artifacts..."
|
||||
|
||||
# Remove debug screenshots
|
||||
find "$TARGET_DIR" -maxdepth 1 -name "*.png" -delete 2>/dev/null || true
|
||||
@@ -81,9 +105,9 @@ rm -f "$TARGET_DIR/playwright-angular.config.ts" 2>/dev/null || true
|
||||
rm -rf "$TARGET_DIR/tests/e2e-angular" 2>/dev/null || true
|
||||
rm -rf "$TARGET_DIR/tests/parity" 2>/dev/null || true
|
||||
|
||||
# ── Step 4: Ensure .dockerignore exists ──────────────────────────────────────
|
||||
# ── Step 5: Ensure .dockerignore exists ──────────────────────────────────────
|
||||
|
||||
echo "4/5 Ensuring .dockerignore..."
|
||||
echo "5/6 Ensuring .dockerignore..."
|
||||
|
||||
if [ ! -f "$TARGET_DIR/.dockerignore" ]; then
|
||||
cat > "$TARGET_DIR/.dockerignore" << 'DOCKERIGNORE'
|
||||
@@ -101,15 +125,20 @@ playwright-report
|
||||
DOCKERIGNORE
|
||||
fi
|
||||
|
||||
# ── Step 5: Summary ─────────────────────────────────────────────────────────
|
||||
# ── Step 6: Summary ─────────────────────────────────────────────────────────
|
||||
|
||||
echo "5/5 Done!"
|
||||
echo "6/6 Done!"
|
||||
echo ""
|
||||
echo "Synced files:"
|
||||
echo "Synced app files:"
|
||||
ls -1 "$TARGET_DIR" | grep -v node_modules
|
||||
if [ -d "$DEPLOY_ROOT/deployment" ]; then
|
||||
echo ""
|
||||
echo "Synced deployment files:"
|
||||
(cd "$DEPLOY_ROOT" && find deployment -type f | sort)
|
||||
fi
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " cd $TARGET_DIR"
|
||||
echo " pnpm install # if lock file changed"
|
||||
echo " make check # typecheck + lint + test"
|
||||
echo " git diff # review changes"
|
||||
echo " cd $DEPLOY_ROOT && git diff # review changes"
|
||||
|
||||
Reference in New Issue
Block a user