Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci: Move deployment to argocd #266

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 14 additions & 47 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,9 @@ variables:
# BUILDAH_IMAGE is defined in group variables
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
DOCKER_TAG: ${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}
DATA_PATH: /data
PING_PORT: 3001
TASK_DB_VERSION: v3
DOCKERFILE: Dockerfile
VAULT_ADDR: "https://vault.parity-mgmt-vault.parity.io"
VAULT_AUTH_PATH: "gitlab-parity-io-jwt-oidc"
VAULT_AUTH_ROLE: "gitlab_oidc_${CI_PROJECT_NAME}"
HELM_SECRETS_DRIVER: vals

default:
id_tokens:
VAULT_ID_TOKEN:
aud: https://gitlab.parity.io
image: $CI_IMAGE
tags:
- kubernetes-parity-build
Expand Down Expand Up @@ -129,53 +119,30 @@ push-docker-image-description:
#### App deployment

.deploy-k8s: &deploy-k8s
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: command-bot
environment:
name: $ENVIRONMENT
script:
# Change the app version during build so that Kubernetes is able to update
# the deployment even if the images' tags did not change
# $CI_PIPELINE_ID is guaranteed to be unique
- export KUBERNETES_VERSION_TAG="$CI_PIPELINE_ID"
# Those values are embedded in the annotations and that's how the change is
# noticed
- |-
sed -i "s/appVersion:.*/appVersion: $KUBERNETES_VERSION_TAG/" helm/Chart.yaml
# https://docs.gitlab.com/ee/ci/examples/authenticating-with-hashicorp-vault/#example
- export VAULT_TOKEN="$(vault write -field=token auth/$VAULT_AUTH_PATH/login role=$VAULT_AUTH_ROLE jwt=$VAULT_ID_TOKEN)"
- helm dependency update helm/
- helm secrets --version
- helm secrets upgrade
--install
--atomic
--timeout 600s
--namespace ${CI_PROJECT_NAME}
--values helm/values.yaml
--values helm/values-$ENVIRONMENT.yaml
--set common.image.repository="$IMAGE_NAME"
--set common.image.tag="$DOCKER_TAG"
--set common.persistence.mountPath="$DATA_PATH"
--set env.DATA_PATH="$DATA_PATH"
--set env.IS_DEPLOYMENT="true"
--set env.TMPDIR="$DATA_PATH/tmp"
--set env.TASK_DB_VERSION="$TASK_DB_VERSION"
--set env.PING_PORT="$PING_PORT"
--set env.LOG_FORMAT=json
--set env.MIN_LOG_LEVEL=debug
$CI_PROJECT_NAME helm/
- argocd app list
- argocd app set $APP --helm-set common.image.tag="$DOCKER_TAG"
- argocd app sync $APP
- argocd app wait $APP --timeout 180
tags:
- kubernetes-parity-build

deploy-stg:
stage: staging
<<: *deploy-k8s
extends: .deploy-k8s
<<: *publish-refs
variables:
ENVIRONMENT: parity-stg
tags:
- cmd-bot-stg

deploy-production:
stage: production
<<: *deploy-k8s
extends: .deploy-k8s
<<: *production-refs
variables:
ENVIRONMENT: parity-prod
tags:
- cmd-bot-prod
3 changes: 0 additions & 3 deletions helm/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions helm/Chart.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions helm/values-parity-prod.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions helm/values-parity-stg.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions helm/values.yaml

This file was deleted.

Loading