Commit 122a3213 authored by Andres Anaya Amariels's avatar Andres Anaya Amariels 🚀
Browse files

deploy_ocf_main

parent 7b6d0de7
Loading
Loading
Loading
Loading
+0 −63
Original line number Diff line number Diff line
@@ -592,69 +592,6 @@ main_build_and_push:
#    SECURE_LOG_LEVEL: debug
#  <<: *main_dnd

deploy_ocf_main:
  stage: deploy_ocf_main
  needs:
    - main_build_and_push
  <<: *main_common
  environment:
    name: review/main
    url: https://$NAMESPACE_STAGING.$DOMAIN_STAGING
    on_stop: delete_ocf_main
    auto_stop_in: 3 day
#  rules:
#    - if: $CI_COMMIT_BRANCH == "staging"
#      when: never
#    - if: $CI_COMMIT_BRANCH == "main"
  script:
#    - echo "### git clone OCF repo ###" 
#    - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git
    - echo "### install helm###"
    - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
#    - chmod 700 get_helm.sh
#    - ./get_helm.sh
#    - helm version
#    - echo "### install kubectl###" 
#    - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
#    - chmod +x kubectl
#    - sudo mv kubectl /usr/local/bin
#    - kubectl version --output=yaml
#    - echo "### setting kubeconfig###"
#    - echo $KUBECONFIG | base64 -d > ~/cluster.kubeconfig
#    - kubectl get nodes --kubeconfig ~/cluster.kubeconfig
#    - kubectl cluster-info --kubeconfig ~/cluster.kubeconfig #comment that when is working
#    - echo "### install yq###"
#    - sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
#    - sudo chmod a+x /usr/local/bin/yq
#    - yq --version
#    - yq e -i '.version = "$IMAGE_TAG_STAGING"' helm/capif/Chart.yaml
#    - yq e -i '.appVersion = "$IMAGE_TAG_STAGING"' helm/capif/Chart.yaml
#    - cat helm/capif/Chart.yaml
#    - echo "### download dependencies###"
#    - helm dependency build helm/capif
#    - echo "### updating capif###"
#    - helm uninstall -n $NAMESPACE_STAGING ocf --kubeconfig ~/cluster.kubeconfig || true
#    - helm upgrade --install -n $NAMESPACE_STAGING ocf helm/capif/ \
#      --set nginx.nginx.env.capifHostname=capif.$DOMAIN_STAGING \
#      --set ingress_ip.oneke="$INGRESS" --atomic \
#      --set monitoring.prometheus.enable="" \
#      --set monitoring.grafana.ingress.hosts[0].host="grafana.$DOMAIN_STAGING" \
#      --set monitoring.grafana.ingress.hosts[0].paths[0].path="/" \
#      --set monitoring.grafana.ingress.hosts[0].paths[0].pathType="Prefix" \
#      --wait --timeout=10m \
#      --create-NAMESPACE_STAGING --kubeconfig ~/cluster.kubeconfig


delete_ocf_main:
  stage: delete_ocf_main
  <<: *main_common
  script:
    - echo "### deleting environment $NAMESPACE_STAGING###"
#    - helm uninstall -n $NAMESPACE_STAGING ocf --kubeconfig ~/cluster.kubeconfig
  when: manual
  environment:
    name: review/main
    action: stop
robot_framework_testing:
  needs: ["deploy_ocf_main"]
  stage: testing
+67 −1
Original line number Diff line number Diff line
stages:
  - deploy_ocf_main
  - delete_ocf_main
  - deploy_ocf_staging
  - delete_ocf_staging
  - deploy_ocf_dev
@@ -20,7 +22,7 @@ variables:
  except:
    variables:
#      - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "main"
      - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "stagin"
      - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "staging"
  tags:
    - shell

@@ -37,6 +39,70 @@ variables:
  tags:
    - shell

deploy_ocf_main:
  stage: deploy_ocf_main
  needs:
    - main_build_and_push
  <<: *main_common
  environment:
    name: review/main
    url: https://$NAMESPACE_STAGING.$DOMAIN_STAGING
    on_stop: delete_ocf_main
    auto_stop_in: 3 day
#  rules:
#    - if: $CI_COMMIT_BRANCH == "staging"
#      when: never
#    - if: $CI_COMMIT_BRANCH == "main"
  script:
#    - echo "### git clone OCF repo ###" 
#    - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git
    - echo "### install helm###"
    - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
#    - chmod 700 get_helm.sh
#    - ./get_helm.sh
#    - helm version
#    - echo "### install kubectl###" 
#    - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
#    - chmod +x kubectl
#    - sudo mv kubectl /usr/local/bin
#    - kubectl version --output=yaml
#    - echo "### setting kubeconfig###"
#    - echo $KUBECONFIG | base64 -d > ~/cluster.kubeconfig
#    - kubectl get nodes --kubeconfig ~/cluster.kubeconfig
#    - kubectl cluster-info --kubeconfig ~/cluster.kubeconfig #comment that when is working
#    - echo "### install yq###"
#    - sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
#    - sudo chmod a+x /usr/local/bin/yq
#    - yq --version
#    - yq e -i '.version = "$IMAGE_TAG_STAGING"' helm/capif/Chart.yaml
#    - yq e -i '.appVersion = "$IMAGE_TAG_STAGING"' helm/capif/Chart.yaml
#    - cat helm/capif/Chart.yaml
#    - echo "### download dependencies###"
#    - helm dependency build helm/capif
#    - echo "### updating capif###"
#    - helm uninstall -n $NAMESPACE_STAGING ocf --kubeconfig ~/cluster.kubeconfig || true
#    - helm upgrade --install -n $NAMESPACE_STAGING ocf helm/capif/ \
#      --set nginx.nginx.env.capifHostname=capif.$DOMAIN_STAGING \
#      --set ingress_ip.oneke="$INGRESS" --atomic \
#      --set monitoring.prometheus.enable="" \
#      --set monitoring.grafana.ingress.hosts[0].host="grafana.$DOMAIN_STAGING" \
#      --set monitoring.grafana.ingress.hosts[0].paths[0].path="/" \
#      --set monitoring.grafana.ingress.hosts[0].paths[0].pathType="Prefix" \
#      --wait --timeout=10m \
#      --create-NAMESPACE_STAGING --kubeconfig ~/cluster.kubeconfig


delete_ocf_main:
  stage: delete_ocf_main
  <<: *main_common
  script:
    - echo "### deleting environment $NAMESPACE_STAGING###"
#    - helm uninstall -n $NAMESPACE_STAGING ocf --kubeconfig ~/cluster.kubeconfig
  when: manual
  environment:
    name: review/main
    action: stop

deploy_ocf_staging:
  stage: deploy_ocf_staging
  <<: *staging_common