-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.ci-gitlab 2.yml
107 lines (95 loc) · 3.49 KB
/
.ci-gitlab 2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
image: registry.gitlab.com/dbsetyawan/3permata:latest
services:
- mysql:5.7
variables:
MYSQL_DATABASE: sys3permatacoid
MYSQL_ROOT_PASSWORD: 3psdev??
DB_HOST: mysql
DB_USERNAME: root
stages:
- test
- deploy
unit_test:
stage: test
script:
- composer install
- vendor/bin/phpunit
deploy_production:
stage: deploy
image: composer:latest
only:
- master
# before_script:s
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - mkdir -p ~/.ssh
# - eval $(ssh-agent -s)
# - echo "${SSH_PRIVATE_KEY}" | ssh-add -
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# - export COMPOSER_HOME=`pwd`/composer && mkdir -pv $COMPOSER_HOME
# - composer global require --prefer-dist laravel/envoy=~1.0 --no-interaction --prefer-dist --quiet
# script:
# - eval $(ssh-agent -s)
# - bash -c 'echo "${SSH_PRIVATE_KEY}" | ssh-add -'
# - mkdir -p ~/.ssh
# - echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
# - rsync -hrvz --delete-before -e "ssh -p ${SSH_HOST_PORT}" public/ "${SSH_USER_HOST_LOCATION}"
# before_script:
# - mkdir -p ~/.ssh
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# - chmod 700 ~/.ssh/id_rsa
# - eval "$(ssh-agent -s)"
# - ssh-add <(echo "$SSH_PRIVATE_KEY")
# - ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
##- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
##
## Run ssh-agent (inside the build environment)
##
##- eval $(ssh-agent -s)
##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
##- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
##
## Create the SSH directory and give it the right permissions
##
##- mkdir -p ~/.ssh
##- chmod 700 ~/.ssh
##
## Optionally, if you will be using any Git commands, set the user name and
## and email.
##
#- git config --global user.email "user@example.com"
#- git config --global user.name "User name"
# before_script:
# - git submodule update --init
# - php -v
# - composer --version
# - git --version
# - ls -lah
# - composer self-update
# - composer install --no-interaction
# - php artisan env
script:
# Add the private SSH kesy to the build environment
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" > /tmp/id_rsa && chmod 400 /tmp/id_rsa && ssh-add /tmp/id_rsa && mkdir -p ~/.ssh
# - ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# - ${COMPOSER_HOME}/vendor/laravel/envoy/envoy run deploy --commit="$CI_COMMIT_SHA"
# - /vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
- composer global require --prefer-dist laravel/envoy=~1.0 --no-interaction --prefer-dist --quiet
- /tmp/vendor/bin/envoy run deploy
# - ~/.composer/vendor/bin/envoy run deploy
environment:
name: production
url: http://3ps-devsys.labx #environment host on local.
# when: manual