Advertisement
vitvayti

deploy-qa

Nov 5th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.27 KB | None | 0 0
  1. deploy-qa:
  2. needs: ["build"]
  3. stage: qa
  4. image:
  5.   name: dtzar/helm-kubectl:latest
  6.   entrypoint: [""]
  7. before_script:
  8.  - wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64.tar.gz -O - | tar xz && mv yq_linux_amd64 /usr/bin/yq
  9. script:
  10.  - export COMMIT_DATE=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S')
  11.   - export IMAGE_NAME=${CI_REPOSITORY}:${IMAGE_TAG}-${COMMIT_DATE}
  12.   - chmod +x ./scripts/update-values.sh
  13.   - ./scripts/update-values.sh
  14.   - kubectl config use-context $KUBECTL_CONTEXT
  15.   - kubectl create namespace ${CI_COMMIT_REF_SLUG} --dry-run=client -o yaml | kubectl apply -f - || true
  16.   - kubectl create secret docker-registry gitlabregistry -n ${CI_COMMIT_REF_SLUG} --docker-server $CI_REGISTRY --docker-username $CI_REGISTRY_USER --docker-password $CI_REGISTRY_PASSWORD --docker-email $CI_REGISTRY_EMAIL --dry-run=client -o yaml | kubectl apply -f - || true
  17.   - helm upgrade --install -n ${CI_COMMIT_REF_SLUG} ${RELEASE_NAME} ./deploy/k8s --values ./deploy/k8s/values.yaml
  18. environment:
  19.   name: qa/$CI_COMMIT_REF_SLUG
  20.   url: https://${CI_COMMIT_REF_SLUG}.${DEV_DOMAIN}
  21.   on_stop: finish-qa
  22. rules:
  23.   - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
  24.     when: always
  25.   - when: never
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement