Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Communications
embl-grav
Commits
c8c9dfb3
Commit
c8c9dfb3
authored
Jun 22, 2018
by
Ken Hawkins
Browse files
Add CI file
parent
cd6fd627
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
c8c9dfb3
image
:
ubuntu
Test SSH
:
##
## Only deploy when commits made to the CI branch
##
only
:
-
g5_embl-ci
##
## Also only deploy when a tag has been made
##
only
:
-
tags
before_script
:
##
## 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
install
openssh-client
git
-y
)'
## If you want to run apt-get update first...
## - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
##
## Run ssh-agent (inside the build environment)
##
-
eval $(ssh-agent -s)
##
## Create the SSH directory and give it the right permissions
##
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
##
## Set SSH_ASKPASS passphrase for private key
##
-
echo "$SSH_PRIVATE_KEY" > ~/.ssh/private_key && chmod 400 ~/.ssh/private_key
-
ssh-keygen -p -P $SSH_ASKPASS -N "" -f ~/.ssh/private_key
-
ssh-add ~/.ssh/private_key
##
## Use ssh-keyscan to scan the keys of your private server. Replace gitlab.com
## with your own domain name. You can copy and repeat that command if you have
## more than one server to connect to.
##
-
ssh-keyscan stratcom-dev01.embl.de >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
##
## Get on the server (using private variables) and pull in the git repo
##
script
:
# try to connect to GitLab.com
-
"
ssh
-T
-i
~/.ssh/private_key
root@stratcom-dev01.embl.de
<<-'ENDSSH'
\n
ENDSSH
\n
"
# the ENDSSH command set isn't needed, but somehow it allos the shell connection to be maintained
# it needs review
-
echo -e "\033[$i;7m Starting EMBL theme update \033[0m"
-
cd /var/www/grav/user/themes
-
echo -e "\033[$i;7m Making a backup \033[0m"
-
tar -pvczf "g5_embl_backup-$(date '+%Y-%m-%d_%s').tar.gz" g5_embl
-
cd g5_embl
-
echo -e "\033[$i;7m Pulling in repo \033[0m"
-
git clone -b g5_embl-ci https://git.embl.de/grp-stratcom/embl-grav.git
-
cd embl-grav/
-
echo -e "\033[$i;7m Updating \033[0m"
-
yes | cp -a * ..
-
echo -e "\033[$i;7m Clean up \033[0m"
-
cd ..
-
rm -rf embl-grav
-
echo -e "\033[$i;7m All done \033[0m"
-
exit
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment