Commit 081d7e31 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

CI/CD pipeline

- updated pipeline to meet requirements and dependencies
parent 6ead3e74
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -110,28 +110,28 @@ unit_test service:
      reports:
        junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml

# Deployment of the service in Kubernetes Cluster
deploy service:
  variables:
    IMAGE_NAME: 'service' # name of the microservice
    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
  stage: deploy
  needs:
    - unit test service
    # - integ_test execute
  script:
    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml'
    - kubectl version
    - kubectl get all
    - kubectl apply -f "manifests/${IMAGE_NAME}service.yaml"
    - kubectl get all
  # environment:
  #   name: test
  #   url: https://example.com
  #   kubernetes:
  #     namespace: test
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
      when: manual    
    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
      when: manual
## Deployment of the service in Kubernetes Cluster
#deploy service:
#  variables:
#    IMAGE_NAME: 'service' # name of the microservice
#    IMAGE_TAG: 'latest' # tag of the container image (production, development, etc)
#  stage: deploy
#  needs:
#    - unit test service
#    # - integ_test execute
#  script:
#    - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml'
#    - kubectl version
#    - kubectl get all
#    - kubectl apply -f "manifests/${IMAGE_NAME}service.yaml"
#    - kubectl get all
#  # environment:
#  #   name: test
#  #   url: https://example.com
#  #   kubernetes:
#  #     namespace: test
#  rules:
#    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)'
#      when: manual    
#    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
#      when: manual