Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
my_first_pipeline
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
priyaranjan.dr
my_first_pipeline
Commits
f99cb512
Commit
f99cb512
authored
Mar 31, 2021
by
priyaranjan.dr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update .gitlab-ci.yml
parent
d2b2c337
Pipeline
#11932
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
.gitlab-ci.yml
.gitlab-ci.yml
+30
-16
No files found.
.gitlab-ci.yml
View file @
f99cb512
build-job
:
stages
:
stage
:
build
-
publish
script
:
-
deploy
-
echo "Hello, $GITLAB_USER_LOGIN!"
test-job1
:
variables
:
stage
:
test
TAG_LATEST
:
$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
script
:
TAG_COMMIT
:
$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
-
echo "This job tests something"
test-job2
:
publish
:
stage
:
test
image
:
docker:latest
stage
:
publish
services
:
-
docker:dind
script
:
script
:
-
echo "This job tests something, but takes more time than test-job1."
-
docker build -t $TAG_COMMIT -t $TAG_LATEST .
-
echo "After the echo commands complete, it runs the sleep command for 20 seconds"
-
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
-
echo "which simulates a test that runs 20 seconds longer than test-job1"
-
docker push $TAG_COMMIT
-
sleep
20
-
docker push $TAG_LATEST
deploy-prod
:
deploy
:
image
:
alpine:latest
stage
:
deploy
stage
:
deploy
tags
:
-
deployment
script
:
script
:
-
echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
-
chmod og= $ID_RSA
\ No newline at end of file
-
apk update && apk add openssh-client
-
ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
-
ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker pull $TAG_COMMIT"
-
ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker container rm -f my-app ||
true
"
-
ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker run -d -p 80:80 --name my-app $TAG_COMMIT"
environment
:
name
:
production
url
:
http://your_server_IP
only
:
-
master
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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