Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Canvas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sc07
Canvas
Commits
195d6928
Commit
195d6928
authored
4 months ago
by
Grant
Browse files
Options
Downloads
Patches
Plain Diff
[ci] Move to private runner instead of SSH
parent
75815b71
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#96
passed
4 months ago
Stage: publish
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+6
-33
6 additions, 33 deletions
.gitlab-ci.yml
with
6 additions
and
33 deletions
.gitlab-ci.yml
+
6
−
33
View file @
195d6928
...
...
@@ -7,12 +7,9 @@ variables:
IMAGE_NAME
:
sc07/canvas:edge
publish
:
image
:
docker
stage
:
publish
tags
:
-
docker-in-docker
services
:
-
docker:dind
-
red
before_script
:
-
echo $PAT | docker login $REGISTRY -u $GITLAB_USER_LOGIN --password-stdin
script
:
...
...
@@ -20,36 +17,12 @@ publish:
-
docker push $REGISTRY/$IMAGE_NAME
deploy
:
image
:
ubuntu:latest
stage
:
deploy
tags
:
-
red
only
:
-
main
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)
##
-
"
command
-v
ssh-agent
>/dev/null
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)"
##
## Run ssh-agent (inside the build environment)
##
-
eval $(ssh-agent -s)
##
## Give the right permissions, otherwise ssh-add will refuse to add files
## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store
##
-
chmod 400 "$SSH_PRIVATE_KEY"
-
ssh-add "$SSH_PRIVATE_KEY"
##
## Create the SSH directory and give it the right permissions
##
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts
script
:
-
ssh $SSH_USER@$SSH_HOST "cd $WORK_DIR && docker compose pull && docker compose up -d && exit"
after_script
:
-
rm -rf ~/.ssh
-
cd $WORK_DIR
-
docker compose pull
-
docker compose up -d
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment