I use gitlab, gitab-ci, and I'm brand new for continuous integration. I am trying to test and deploy a bash script when I press a key.
that my .gitlab-ci.yml looks like when I deploy, I try to change the user, but I wonβt work
before_script:
- composer install
stages:
- build
- test
- deploy
unitTesting:
stage: test
script:
- echo "Running PHPUnit Tests"
- php vendor/bin/phpunit
job_deploy_master:
stage: deploy
only:
- master
script:
- /bin/su - myuser -c "deploy.sh" //here I try to change linux user to be able to checkout code but fails with **su: must be run from a terminal**
tags:
- php
and here I have bash that should pull codes at the production site if the tests pass
#!/bin/bash
echo "Starting Deploy"
printf '%s\n' "${SUDO_USER:-$USER}" //I'm interested to see which user try to run this script outputs gitlab-runner
cd /home/builds/gpx-convertor
git pull
composer install --prefer-dist > /dev/null
I tried google to find some php related examples, but without success. Can someone show how this should work
source
share