Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
79a453ad
Commit
79a453ad
authored
Mar 10, 2021
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitlab-runner, devel_com
parent
cfdff929
Pipeline
#5154
passed with stages
in 4 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
README.md
DEVELOPMENT/CI_CD/GITLAB/README.md
+99
-0
gitlab_ci_cd_devel.png
DEVELOPMENT/CI_CD/GITLAB/images/gitlab_ci_cd_devel.png
+0
-0
gitlab_ci_cd_devel_com.png
DEVELOPMENT/CI_CD/GITLAB/images/gitlab_ci_cd_devel_com.png
+0
-0
No files found.
DEVELOPMENT/CI_CD/GITLAB/README.md
View file @
79a453ad
...
...
@@ -93,3 +93,102 @@ Token의 정보는 GitLAB에서 확인할 수 있다.
![
runner_register
](
./images/gitlab-runner.png
)
## GitLAB .gitlab-ci.yml 파일의 작성
```
python
# cat .gitlab-ci.yml
stages
:
-
devel
-
deploy
-
backup
variables
:
GIT_STRATEGY
:
clone
GIT_SSL_NO_VERIFY
:
"1"
TARGET_SERVICE_DIR
:
/
var
/
lib
/
libvirt
/
SERVICE
/
home
/
hongsnet
TARGET_DEVEL_DIR
:
/
DATA
/
SERVICE
TARGET_DEPLOY_DIR
:
/
WEB_SRC
/
home
devel
:
stage
:
devel
only
:
-
devel
#master 브랜치의 devel만 해당
script
:
-
rsync
-
ar
--
delete
$
{
CI_PROJECT_DIR
}
$
{
TARGET_DEVEL_DIR
}
tags
:
-
devel
#gitlab runner에서 지정한 tag 이름
deploy
:
stage
:
deploy
only
:
-
master
#backup 브랜치의 deploy만 해당
script
:
-
rsync
-
ar
--
delete
$
{
CI_PROJECT_DIR
}
/
public_html
$
{
TARGET_DEPLOY_DIR
}
/
hongsnet
/
tags
:
-
backup
#gitlab runner에서 지정한 tag 이름
tb2
:
stage
:
backup
only
:
-
master
#master 브랜치의 deploy만 해당
script
:
-
(
if
[[
!
-
d
$
{
CI_PROJECT_DIR
}
/
public_html
]];
then
mkdir
-
p
$
{
CI_PROJECT_DIR
}
/
public_html
;
fi
);
-
rsync
-
ar
--
delete
$
{
CI_PROJECT_DIR
}
/
public_html
$
{
TARGET_SERVICE_DIR
}
tags
:
-
tb2
#gitlab runner에서 지정한 tag 이름
tb3
:
stage
:
backup
only
:
-
master
#master 브랜치의 deploy만 해당
script
:
-
(
if
[[
!
-
d
$
{
CI_PROJECT_DIR
}
/
public_html
]];
then
mkdir
-
p
$
{
CI_PROJECT_DIR
}
/
public_html
;
fi
);
-
rsync
-
ar
--
delete
$
{
CI_PROJECT_DIR
}
/
public_html
$
{
TARGET_SERVICE_DIR
}
tags
:
-
tb3
#gitlab runner에서 지정한 tag 이름
```
## 소스배포 절차
-
**STEP 1**
: devel 브랜치를 Checkout 한다.
```
bash
# git checkout devel
# git branch
*
devel
master
```
-
**STEP 2**
: 특정 페이지에 다음과 같은 코딩을 수행한다.
```
php
echo
"<script type=
\"
text/javascript
\"
>
alert('개발서버 테스트입니다!');
location.href='/';
</script>"
;
exit
;
```
-
**STEP 3**
: devel 브랜치에 commit 하고, Push 한다.
```
bash
# git add public_html/freehosting_jsp.html
# git commmit -m "개발서버의 배포 테스트"
# git push -u origin devel
```
GitLAB의 pipeline을 보면, 다음과 같이 진행된 것을 확인할 수 있다.
![
cicd_devel
](
./images/gitlab_ci_cd_devel.png
)
또한 상세내용은 다음과 같다.
![
cicd_devel_com
](
./images/gitlab_ci_cd_devel_com.png
)
-
**STEP 4**
: Stag 서버에서 변경된 내역을 확인한다.
DEVELOPMENT/CI_CD/GITLAB/images/gitlab_ci_cd_devel.png
0 → 100644
View file @
79a453ad
14.3 KB
DEVELOPMENT/CI_CD/GITLAB/images/gitlab_ci_cd_devel_com.png
0 → 100644
View file @
79a453ad
24.8 KB
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