ci: full CI/CD pipeline with build, push, deploy
CI/CD Pipeline / build-and-deploy (push) Failing after 0s
CI/CD Pipeline / build-and-deploy (push) Failing after 0s
This commit is contained in:
+27
-3
@@ -5,8 +5,32 @@ on:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
build-and-deploy:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Hello
|
||||
run: echo "CI Pipeline triggered successfully on ${GITHUB_SHA}"
|
||||
- name: Clone
|
||||
run: |
|
||||
git clone https://git.plfai.cn/test/fastapi-demo.git .
|
||||
git checkout ${GITHUB_SHA}
|
||||
|
||||
- name: Docker Build
|
||||
run: |
|
||||
docker build --network host \
|
||||
-t registry.plfai.cn/fastapi-demo:${GITHUB_SHA:0:7} \
|
||||
-t registry.plfai.cn/fastapi-demo:latest \
|
||||
.
|
||||
|
||||
- name: Docker Push
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.plfai.cn -u k3s --password-stdin
|
||||
docker push registry.plfai.cn/fastapi-demo:${GITHUB_SHA:0:7}
|
||||
docker push registry.plfai.cn/fastapi-demo:latest
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
k3s kubectl rollout restart deployment/fastapi-app -n fastapi-demo
|
||||
|
||||
- name: Health Check
|
||||
run: |
|
||||
sleep 5
|
||||
curl -sk --connect-timeout 10 --retry 3 https://fastapi.plfai.cn/health
|
||||
|
||||
Reference in New Issue
Block a user