diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b0d4cc3..4f1bab52 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,16 +12,6 @@ variables: CONTAINER_REPO: "" DOCKERFILE_DIRECTORY: "" - # Deploy Variables (Mandatory) - HELM_NAMESPACE: "substrate-telemetry" - HELM_RELEASE_NAME: "substrate-telemetry" - HELM_CHART: "parity/substrate-telemetry" - - # Deploy Variables (Optional) - HELM_REPO_NAME: "parity" - HELM_REPO_URL: "https://paritytech.github.io/helm-charts/" - HELM_CONFIGMAP_NAME: "helm-custom-values" - HELM_CONFIGMAP_KEYNAME: "values-parity.yaml" # Manual Variables (Optional) ## Could be used in the webconsole when triggering the pipeline manually @@ -114,37 +104,22 @@ stages: - kubernetes-parity-build .deploy: &deploy - image: paritytech/kubetools:3.5.3 + image: quay.io/argoproj/argocd:v2.7.9 + variables: + ARGOCD_OPTS: --grpc-web --grpc-web-root-path /$ENVIRONMENT + APP: substrate-telemetry + environment: + name: $ENVIRONMENT script: - - |- - echo generating an empty custom-values.yaml file - touch custom-values.yaml - - |- - echo fetching the custom values file from the configmap if HELM_CONFIGMAP_NAME is specified - if [[ $HELM_CONFIGMAP_NAME ]]; then - # escape dot characters - HELM_CONFIGMAP_KEYNAME=`echo $HELM_CONFIGMAP_KEYNAME | sed 's/\./\\\./g'` - kubectl get cm $HELM_CONFIGMAP_NAME -n $HELM_NAMESPACE -o jsonpath="{.data.$HELM_CONFIGMAP_KEYNAME}" \ - > custom-values.yaml - fi - - |- - echo adding the helm repository if HELM_REPO_URL is specified - if [[ $HELM_REPO_URL ]]; then - helm repo add $HELM_REPO_NAME $HELM_REPO_URL - helm repo update - fi - - echo installing the helm chart - - helm upgrade - --install - --atomic - --timeout 300s - --namespace $HELM_NAMESPACE - --values custom-values.yaml - --set image.backend.repository="${CONTAINER_REPO_BACKEND}" - --set image.backend.tag="${DOCKER_IMAGE_TAG}" - --set image.frontend.repository="${CONTAINER_REPO_FRONTEND}" - --set image.frontend.tag="${DOCKER_IMAGE_TAG}" - ${HELM_RELEASE_NAME} ${HELM_CHART} + - argocd app list + - argocd app set $APP + --helm-set substrate-telemetry.image.backend.repository="${CONTAINER_REPO_BACKEND}" + --helm-set substrate-telemetry.image.backend.tag="${DOCKER_IMAGE_TAG}" + --helm-set substrate-telemetry.image.frontend.repository="${CONTAINER_REPO_FRONTEND}" + --helm-set substrate-telemetry.image.frontend.tag="${DOCKER_IMAGE_TAG}" + - argocd app sync $APP + # uncomment after https://github.com/paritytech/devops/issues/3141 is done + # - argocd app wait $APP --timeout 180 tags: - kubernetes-parity-build @@ -205,10 +180,9 @@ deploy-commit-to-staging: variables: CONTAINER_REPO_BACKEND: "docker.io/paritypr/substrate-telemetry-backend" CONTAINER_REPO_FRONTEND: "docker.io/paritypr/substrate-telemetry-frontend" + ENVIRONMENT: "parity-stg" stage: deploy-commit-to-staging - <<: *deploy - environment: - name: parity-stg + extends: .deploy rules: - if: '$CI_COMMIT_BRANCH =~ /^[0-9]+/' when: manual @@ -218,10 +192,9 @@ deploy-master-to-staging: variables: CONTAINER_REPO_BACKEND: "docker.io/parity/substrate-telemetry-backend" CONTAINER_REPO_FRONTEND: "docker.io/parity/substrate-telemetry-frontend" + ENVIRONMENT: "parity-stg" stage: deploy-master-to-staging - <<: *deploy - environment: - name: parity-stg + extends: .deploy rules: - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+.*$/' # i.e. v1.0, v2.1rc1 - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' @@ -231,10 +204,9 @@ deploy-production: variables: CONTAINER_REPO_BACKEND: "docker.io/parity/substrate-telemetry-backend" CONTAINER_REPO_FRONTEND: "docker.io/parity/substrate-telemetry-frontend" + ENVIRONMENT: "parity-prod" stage: deploy-production - <<: *deploy - environment: - name: parity-prod + extends: .deploy rules: - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+.*$/' # i.e. v1.0, v2.1rc1 when: manual