Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Goals

  • goal

Results

  • resultYou will have gitlab-ci.yml configured to start deployments.

Tasks / Procedure

...

  1. Delete the next code from your gitlab-ci.yml
    Expand
    Code Block
    deploy-uat:
      extends: .deploy
      script:
        - export DEPLOYMENT=uat
        - export LE_ENVIRONMENT=letsencrypt-prod
        - cat values.yml | gomplate > ${DEPLOYMENT}.yml
        - cat ${DEPLOYMENT}.yml
        - helm upgrade -i ${DEPLOYMENT} mironet/magnolia-helm --version ${HELM_CHART_VERSION} -f ${DEPLOYMENT}.yml --create-namespace -n ${DEPLOYMENT}
        - kubectl annotate --overwrite namespace ${DEPLOYMENT} field.cattle.io/projectId=`kubectl get namespace default --output="jsonpath={.metadata.annotations.field\.cattle\.io/projectId}"`
        - kubectl -n default get secret activation-key -o json | jq 'del(.metadata.annotations,.metadata.labels,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.metadata.namespace,.metadata.creationTimestamp)' | kubectl apply -n ${DEPLOYMENT}  -f -
        - kubectl -n default get secret gitlab -o json | jq 'del(.metadata.annotations,.metadata.labels,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.metadata.namespace,.metadata.creationTimestamp)' | kubectl apply -n ${DEPLOYMENT}  -f -
        - kubectl -n default get secret s3-backup-key -o json | jq 'del(.metadata.annotations,.metadata.labels,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.metadata.namespace,.metadata.creationTimestamp)' | kubectl apply -n ${DEPLOYMENT}  -f -
      environment:
        name: dev
      when: manual


2. Add your deployment configuration at the end of your gitlab-ci.yml

    1. Add the name of the branch you created as deployment name
      Example: Francisco Gonzalez - fgonzalez
      Expand
      Code Block
      deploy-<YourBranchName>:
        extends: .deploy
        script:
          - export DEPLOYMENT=<YourBranchName>
          - export LE_ENVIRONMENT=letsencrypt-prod
          - cat values.yml | gomplate > ${DEPLOYMENT}.yml
          - cat ${DEPLOYMENT}.yml
          - helm upgrade -i ${DEPLOYMENT} mironet/magnolia-helm --version ${HELM_CHART_VERSION} -f ${DEPLOYMENT}.yml --create-namespace -n ${DEPLOYMENT}
          - kubectl annotate --overwrite namespace ${DEPLOYMENT} field.cattle.io/projectId=`kubectl get namespace default --output="jsonpath={.metadata.annotations.field\.cattle\.io/projectId}"`
          - kubectl -n default get secret gitlab -o json | jq 'del(.metadata.annotations,.metadata.labels,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.metadata.namespace,.metadata.creationTimestamp)' | kubectl apply -n ${DEPLOYMENT}  -f -
          - kubectl -n default get secret s3-backup-key -o json | jq 'del(.metadata.annotations,.metadata.labels,.metadata.namespace,.metadata.resourceVersion,.metadata.uid,.metadata.namespace,.metadata.creationTimestamp)' | kubectl apply -n ${DEPLOYMENT}  -f -
        environment:
          name: dev
        when: manual
      
      
  1. Add new and needed Variables.→ KUBE_CONFIG (for this we need to talk about Rancher before) Expanda)expand