10 Commits

Author SHA1 Message Date
b64abe3a3a harbor test v2 2026-03-10 12:11:40 +03:00
abdelbari
54dcb584d6 test: trigger harbor push for backend
Some checks failed
sgeUpdated CI/CD / deploy (pull_request) Has been cancelled
2026-03-10 08:30:33 +00:00
b6a4f0e303 Merge pull request 'fix: use internal IP for Harbor and add network-resilient fetch' (#16) from fix/harbor-connection-port into main
Reviewed-on: #16
2026-03-10 11:25:25 +03:00
abdelbari
e0c8286475 fix: use internal IP for Harbor and add network-resilient fetch
All checks were successful
sgeUpdated CI/CD / deploy (pull_request) Successful in 7s
2026-03-10 08:19:13 +00:00
1ebf2f2f9d Merge pull request 'fix/harbor-connection-port' (#15) from fix/harbor-connection-port into main
Reviewed-on: #15
2026-03-10 10:42:58 +03:00
abdelbari
4ddffb6fff chore: update harbor registry to 10.150.1.166:8085
Some checks failed
sgeUpdated CI/CD / deploy (pull_request) Failing after 5m7s
2026-03-10 07:38:21 +00:00
abdelbari
59b37a64f5 Update Harbor registry IP and port for the pipeline 2026-03-10 07:29:31 +00:00
a0041afce9 Merge pull request 'harbor test v' (#14) from testv into main
Reviewed-on: #14
2026-03-09 14:07:36 +03:00
d4ffcb9438 harbor test v
Some checks failed
sgeUpdated CI/CD / deploy (pull_request) Failing after 10m33s
2026-03-09 14:06:23 +03:00
7a948f3b7e harbor+ 2025-12-17 18:17:53 +03:00
3 changed files with 50 additions and 16 deletions

View File

@@ -22,8 +22,6 @@ jobs:
- name: Run deploy script on server
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
echo "✅ PR merged into main — running deploy script..."
cd /home/ubuntu/Bgreen/sgeUpdated
./deploy.sh
EOF
# We add -tt to force a pseudo-terminal (fixes that stdin error)
# We call bash -lc to force a Login Shell, which loads your credentials
ssh -tt ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} "bash -lc 'cd /home/ubuntu/Bgreen/sgeUpdated && ./deploy.sh'"

View File

@@ -3,6 +3,18 @@ set -euo pipefail
cd /home/ubuntu/Bgreen/sgeUpdated
# -----------------------
# Harbor settings
# -----------------------
HARBOR_REGISTRY="10.10.100.110:8085"
HARBOR_PROJECT="bgreen"
BACKEND_IMAGE_REPO="${HARBOR_REGISTRY}/${HARBOR_PROJECT}/bgreen-backend"
FRONTEND_IMAGE_REPO="${HARBOR_REGISTRY}/${HARBOR_PROJECT}/bgreen-frontend"
# Tag images within git commit (better than latest; enables rollback)
VERSION="$(git rev-parse --short HEAD)"
echo "📦 Fetching latest changes from origin/main..."
git fetch myfork main
@@ -22,12 +34,12 @@ git reset --hard myfork/main
BACKEND_CHANGED=false
FRONTEND_CHANGED=false
# Check if backend folder changed
# Check if backend folder changed (excluding README.md)
if echo "$CHANGED_FILES" | grep "^sge-backend/" | grep -qv "README.md$"; then
BACKEND_CHANGED=true
fi
# Check if frontend folder changed
# Check if frontend folder changed (excluding README.md)
if echo "$CHANGED_FILES" | grep "^sge-frontend/" | grep -qv "README.md$"; then
FRONTEND_CHANGED=true
fi
@@ -37,12 +49,25 @@ fi
# -----------------------
if [ "$BACKEND_CHANGED" = true ]; then
echo "⚡ Backend changes detected."
cd sge-backend
echo "Running Maven build..."
/opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests
cd ../..
echo "Rebuilding backend Docker container..."
docker compose up -d --build bgreen-backend
echo "🐳 Building backend Docker image..."
docker build -t "${BACKEND_IMAGE_REPO}:${VERSION}" .
echo "📤 Pushing backend image to Harbor..."
docker push "${BACKEND_IMAGE_REPO}:${VERSION}"
echo "📥 Pulling backend image from Harbor (to ensure registry is source of truth)..."
docker pull "${BACKEND_IMAGE_REPO}:${VERSION}"
cd ..
echo "🚀 Recreating backend container using Harbor image..."
VERSION="$VERSION" docker compose up -d bgreen-backend
else
echo "✅ No backend changes."
fi
@@ -56,7 +81,7 @@ if [ "$FRONTEND_CHANGED" = true ]; then
# Check if package.json or package-lock.json changed
if echo "$CHANGED_FILES" | grep -qE "^sge-frontend/(package\.json|package-lock\.json)$"; then
echo "📦 package.json changed. Running 'npm instal' and 'npm run build'..."
echo "📦 package.json changed. Running 'npm install' and 'npm run build'..."
npm install
npm run build
else
@@ -64,9 +89,20 @@ if [ "$FRONTEND_CHANGED" = true ]; then
npm run build
fi
cd ../..
echo "Rebuilding frontend Docker container..."
docker compose up -d --build bgreen-frontend
echo "🐳 Building frontend Docker image..."
docker build -t "${FRONTEND_IMAGE_REPO}:${VERSION}" .
echo "📤 Pushing frontend image to Harbor..."
docker push "${FRONTEND_IMAGE_REPO}:${VERSION}"
echo "📥 Pulling frontend image from Harbor (to ensure registry is source of truth)..."
docker pull "${FRONTEND_IMAGE_REPO}:${VERSION}"
cd ..
echo "🚀 Recreating frontend container using Harbor image..."
VERSION="$VERSION" docker compose up -d bgreen-frontend
else
echo "✅ No frontend changes."
fi

View File

@@ -11,7 +11,7 @@
</parent>
<groupId>com.sgs</groupId>
<artifactId>sgs</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.3-SNAPSHOT</version>
<name>sgs</name>
<description>SGS project for Spring Boot</description>
<properties>