Added deploy to stage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
stages:
|
||||
- run
|
||||
- build
|
||||
- deploy
|
||||
|
||||
run_flask_app:
|
||||
stage: run
|
||||
@@ -25,3 +26,21 @@ build_docker_image:
|
||||
--dockerfile "$CI_PROJECT_DIR/Dockerfile"
|
||||
--destination "$CI_REGISTRY_IMAGE:latest"
|
||||
--destination "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
|
||||
|
||||
deploy_stage:
|
||||
stage: deploy
|
||||
image:
|
||||
name: bitnami/kubectl:latest
|
||||
entrypoint: [""]
|
||||
before_script:
|
||||
- mkdir -p ~/.kube
|
||||
- echo "$KUBECONFIGCONTENT" > ~/.kube/config
|
||||
- chmod 600 ~/.kube/config
|
||||
script:
|
||||
- kubectl apply -f k8s/stage/
|
||||
- kubectl set image deployment/flask-app flask-app=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA -n stage
|
||||
- kubectl rollout status deployment/flask-app -n stage
|
||||
environment:
|
||||
name: stage
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||
|
||||
Reference in New Issue
Block a user