-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci-build-demo.yml
48 lines (47 loc) · 1.77 KB
/
.gitlab-ci-build-demo.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
variables:
DEV_INTERNAL_DEMO_SSH_KEY: ""
update-internal-demo:
stage: build
image: alpine
when: manual
before_script:
- apk update
- apk add openssh-client
script:
# Make sure the SSH key has proper permissions
- chmod 600 "${DEV_INTERNAL_DEMO_SSH_KEY}"
# Create a temporary directory on the demo machine (using commit ref
# as its name, rather than a random name, because shell variables
# set in script are not available in after_script, and we
# need to remove the temporary directory in after_script)
- export TMP_DIR="/tmp/${CI_COMMIT_SHA}"
- >
ssh -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
"mkdir ${TMP_DIR}"
# Copy the source code to the temporary directory
- >
scp -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
-r "${CI_PROJECT_DIR}/"* "${CI_PROJECT_DIR}/".* \
"[email protected]:${TMP_DIR}"
# Make sure OTRS CE files have correct permissions
- >
ssh -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
"/opt/otrs/bin/otrs.SetPermissions.pl"
# Perform OTRS CE update
- >
ssh -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
"sudo -u otrs perl /usr/local/bin/update.pl \"${TMP_DIR}\""
# Restart Apache
- >
ssh -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
"apachectl restart"
after_script:
# Remove temporary directory
- >
ssh -i "${DEV_INTERNAL_DEMO_SSH_KEY}" -o StrictHostKeyChecking=no \
"rm -r /tmp/${CI_COMMIT_SHA}"