Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Image Data Explorer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Jean-Karim Heriche
Image Data Explorer
Commits
397ff409
Commit
397ff409
authored
1 year ago
by
Jean-Karim Heriche
Browse files
Options
Downloads
Patches
Plain Diff
Remove deploy stage
parent
f197021e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+0
-33
0 additions, 33 deletions
.gitlab-ci.yml
with
0 additions
and
33 deletions
.gitlab-ci.yml
+
0
−
33
View file @
397ff409
...
...
@@ -14,17 +14,9 @@ workflow:
-
if
:
$CI_COMMIT_BRANCH == 'master'
# To run deploy after build
stages
:
-
build
-
deploy
before_script
:
-
echo "Registry info:"
-
echo $CI_REGISTRY
-
echo $CI_REGISTRY_IMAGE
-
echo $CI_REGISTRY_NAME
-
echo $CI_REGISTRY_USER
build
:
stage
:
build
...
...
@@ -39,28 +31,3 @@ build:
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
/kaniko/executor --registry-mirror regmirror.embl.de --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
deploy
:
image
:
ubuntu:focal
stage
:
deploy
only
:
-
tags
script
:
# Check if ssh-agent is present, install if not
-
'
command
-v
ssh-agent
>/dev/null
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)'
# Run ssh-agent in the deploy environment
-
eval $(ssh-agent -s)
# Add the SSH key from the SSH_PRIVATE_KEY variable to the agent store
# Use tr to fix line endings
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan cbbcs-01.embl.de >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
# Pull new container on server cbbcs-01
# User cbbcs needs to be member of the docker group
# to run the docker command
# Docker needs to log into the project's registry first
-
ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
-
ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
# Tag the new image as latest
-
ssh -o StrictHostKeyChecking=no cbbcs@cbbcs-01.embl.de "docker image tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest"
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