An open API service indexing awesome lists of open source software.

https://github.com/zkfmapf123/cicd-pipeline

cicd-pipeline
https://github.com/zkfmapf123/cicd-pipeline

Last synced: 11 months ago
JSON representation

cicd-pipeline

Awesome Lists containing this project

README

          

# CICD-pipeline

![vpc](./public/vpc.png)

![pipeline](./public/cicd-pipeline.png)

## Todo

- [x] GitHub -> Jenkins -> Push ECR -> EventBridge -> Lambda

- [x] EventBridge에서 Lambda에 함수전달

![9](./public/9.png)
![10](./public/10.png)

- [ ] Lambda는 오래된 이미지 삭제하고, ECS에 배포
- [ ] aws-cli를 활용해서 오래된 이미지 삭제
- [ ] 최근 이미지를 ecs에 배포

## Jenkins install

```
host에 Docker에 접근하는 방식 (DooD)을 사용하기 때문에,
host에 user, group을 먼저 설정해줘야 함

useradd ...
groupadd ...
```

- install docker (util_file/docker.sh)
- build docker images (util_file/Dockerfil.jenkins)

```
docker build -f Dockerfile.jenkins -t jenkins:1.0
```

- run jenkins container

```
docker run -d --name jenkins_container \
-v /var/run/docker.sock:/var/run/docker.sock \
-v jenkins_volume:/var/jenkins_home \
--restart=always \
-p 8080:8080 jenkins:1.0

chmod 777 /var/run/docker.sock
```

## Slack 추가하는 법

### 1. Slack에서 App 추가 (Admin이 해줘야 함)

![1](./public/1.png)

### 2. Slack Channel 추가 (Admin이 해줘야 함)

![2](./public/2.png)

### 3. Jenkins Plugin 추가 (Slack Notification)

![3](./public/3.png)

### 4. Jenkins Management -> System Setting

![4](./public/4.png)

### 5. Slack 추가 & Credential 설정

![5](./public/5.png)

![6](./public/6.png)

### 6. Test Connection

![7](./public/7.png)

### 7. Check To Notification

![8](./public/8.png)

## Reference

- t2.micro로 하니까 Docker가 못버텨주네... -> t3.small 정도는 해야함 (시간 애뺐김)
- Jenkins AmazonECR Registry 입력하는 법
- Jenkins Credentials withAWS 설정
- Jenkins Registry 설정 -> AWS Credentials (Global) Plugin 설정해야 함
- Slack Notification