Commit 451be43b authored by Andres Anaya Amariels's avatar Andres Anaya Amariels 🚀
Browse files

cd release deploy

parent 22d9bb6a
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
stages:
  - deploy_ocf_prod

variables:
  CI_JOB_TOKEN: $CI_JOB_TOKEN
  CI_DEBUG_TRACE: "false"
  CI_REGISTRY_USER: $CI_REGISTRY_USER
  CI_REGISTRY: $CI_REGISTRY
  CAPIF_DOCKER_REGISTRY: $CAPIF_DOCKER_REGISTRY
  INGRESS: "10.43.32.232"
  NAMESPACE_PROD: "ocf-prod"
  DOMAIN_PROD: prod.int
  IMAGE_TAG_PROD: $CI_COMMIT_REF_SLUG

# it will only run when a new tag that starts with ‘release-’ is pushed
# to the repository.
.release_common: &relase_common
  only:
    - /^release-.*$/
  tags:
    - shell

deploy_ocf_staging:
  stage: deploy_ocf_staging
  <<: *relase_common
  environment:
    name: review/production
    url: https://$NAMESPACE_PROD.$DOMAIN_PROD
  script: 
    - echo "------ A release has been created! -------"
    - 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
 No newline at end of file