Skip to content

Commit

Permalink
Update .gitlab-ci.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiddo Nees committed Nov 3, 2024
1 parent 7964e15 commit 97746ed
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ stages:
- deploy

variables:
COMPOSER_HOME: $CI_PROJECT_DIR/.composer
COMPOSER_HOME: "$CI_PROJECT_DIR/.composer"
NO_PROXY: "gitlab.vtk.be"

# Build job
build:
stage: build
script:
- echo "Starting Composer update and install..."
- composer update --no-dev
- composer install --no-dev
- echo $CI_COMMIT_SHA > COMMIT
- echo "Saving commit SHA to COMMIT file..."
- echo "$CI_COMMIT_SHA" > COMMIT
- echo "Creating tarball of project files..."
- tar czf litus.tar.gz bin/ config/ data/ migrations/ module/ public/ shibboleth/ vendor/ COMMIT LICENSE.md NOTICE.md README.md
only:
- master
Expand All @@ -23,22 +27,27 @@ build:
paths:
- litus.tar.gz


# Common deploy settings
.deploy: &deploy
stage: deploy
before_script:
- echo "Setting up SSH agent and adding key..."
- eval $(ssh-agent -s)
- ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d)
- echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add -
script:
- echo "Setting Sentry log level to debug..."
- export SENTRY_LOG_LEVEL=debug
- scp -o StrictHostKeyChecking=no litus.tar.gz root@$SSH_HOSTNAME:/tmp
- ssh -o StrictHostKeyChecking=no root@$SSH_HOSTNAME /usr/local/sbin/deploy.sh
- echo "Copying tarball to remote host..."
- scp -o StrictHostKeyChecking=no litus.tar.gz root@"$SSH_HOSTNAME":/tmp
- echo "Running deployment script on remote host..."
- ssh -o StrictHostKeyChecking=no root@"$SSH_HOSTNAME" /usr/local/sbin/deploy.sh
only:
- master
when: manual
dependencies:
- build

# Deploy job for leia
deploy_leia:
<<: *deploy
variables:
Expand All @@ -47,10 +56,11 @@ deploy_leia:
name: leia
url: https://liv.vtk.be

# Deploy job for liv
deploy_liv:
<<: *deploy
variables:
SSH_HOSTNAME: liv.vtk.be
environment:
name: liv
url: https://vtk.be
url: https://vtk.be

0 comments on commit 97746ed

Please sign in to comment.