Updated pipeline
This commit is contained in:
@@ -9,6 +9,9 @@ stages:
|
||||
- verify
|
||||
|
||||
variables:
|
||||
# Use stable clone path instead of runner-specific path
|
||||
GIT_CLONE_PATH: $CI_BUILDS_DIR/motovaultpro
|
||||
DEPLOY_PATH: $CI_BUILDS_DIR/motovaultpro
|
||||
DOCKER_COMPOSE_FILE: docker-compose.yml
|
||||
DOCKER_COMPOSE_PROD_FILE: docker-compose.prod.yml
|
||||
|
||||
@@ -44,9 +47,6 @@ build:
|
||||
- echo "Building Docker images..."
|
||||
- echo "=========================================="
|
||||
- cd "$DEPLOY_PATH"
|
||||
- echo "Pulling latest code..."
|
||||
- git fetch origin main
|
||||
- git reset --hard origin/main
|
||||
- echo "Building images..."
|
||||
- docker compose -f $DOCKER_COMPOSE_FILE build --no-cache
|
||||
- echo "=========================================="
|
||||
|
||||
@@ -91,11 +91,12 @@ These variables use GitLab's **File** type, which writes the value to a temporar
|
||||
|
||||
| Variable Name | Type | Protected | Masked | Value |
|
||||
|--------------|------|-----------|--------|-------|
|
||||
| `DEPLOY_PATH` | Variable | No | No | `/opt/motovaultpro` |
|
||||
| `VITE_AUTH0_DOMAIN` | Variable | No | No | `motovaultpro.us.auth0.com` |
|
||||
| `VITE_AUTH0_CLIENT_ID` | Variable | No | No | Your Auth0 client ID |
|
||||
| `VITE_AUTH0_AUDIENCE` | Variable | No | No | `https://api.motovaultpro.com` |
|
||||
|
||||
Note: `DEPLOY_PATH` is automatically set in `.gitlab-ci.yml` using `GIT_CLONE_PATH` for a stable path.
|
||||
|
||||
### Setting Up a File Type Variable
|
||||
|
||||
1. Go to **Settings > CI/CD > Variables**
|
||||
@@ -448,10 +449,12 @@ curl http://localhost:3001/health
|
||||
|
||||
| Path | Description |
|
||||
|------|-------------|
|
||||
| `/opt/motovaultpro` | Application root |
|
||||
| `/opt/motovaultpro/secrets/app/` | Secrets directory |
|
||||
| `/opt/motovaultpro/data/documents/` | Document storage |
|
||||
| `/opt/motovaultpro/config/` | Configuration files |
|
||||
| `$CI_BUILDS_DIR/motovaultpro` | Application root (stable clone path) |
|
||||
| `$CI_BUILDS_DIR/motovaultpro/secrets/app/` | Secrets directory |
|
||||
| `$CI_BUILDS_DIR/motovaultpro/data/documents/` | Document storage |
|
||||
| `$CI_BUILDS_DIR/motovaultpro/config/` | Configuration files |
|
||||
|
||||
Note: `CI_BUILDS_DIR` is typically `/opt/gitlab-runner/builds` for shell executors.
|
||||
|
||||
### Container Names
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@ echo "Injecting secrets..."
|
||||
echo " Deploy path: $DEPLOY_PATH"
|
||||
echo " Secrets dir: $SECRETS_DIR"
|
||||
|
||||
# Create secrets directory if it doesn't exist
|
||||
# Clean up any incorrectly created directories and create secrets directory
|
||||
if [ -e "$SECRETS_DIR" ] && [ ! -d "$SECRETS_DIR" ]; then
|
||||
echo " Removing invalid secrets path..."
|
||||
rm -rf "$SECRETS_DIR"
|
||||
fi
|
||||
mkdir -p "$SECRETS_DIR"
|
||||
chmod 700 "$SECRETS_DIR"
|
||||
|
||||
@@ -48,6 +52,11 @@ inject_secret() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Remove if exists as directory (cleanup from bad previous runs)
|
||||
if [ -d "$target_path" ]; then
|
||||
rm -rf "$target_path"
|
||||
fi
|
||||
|
||||
# Copy the secret file
|
||||
cp "$source_path" "$target_path"
|
||||
chmod 600 "$target_path"
|
||||
|
||||
Reference in New Issue
Block a user