diff --git a/README.md b/README.md index b7c017d3..0a08d782 100644 --- a/README.md +++ b/README.md @@ -801,9 +801,15 @@ include: stages: - notify + +variables: + SENTRY_AUTH_TOKEN: my-sentry-user-token + SENTRY_URL: my-sentry.example.net + SENTRY_PROJECT: my-sentry-project + SENTRY_ORG: my-sentry-org ``` -This stage makes an API call to the project-specific sentry webhook, in order to announce a new release [as per the docs](https://docs.sentry.io/workflow/releases/?platform=javascript#using-the-api). +This stage uses `getsentry/sentry-cli:1.52.3`, in order to announce a new release [as per the docs](https://docs.sentry.io/workflow/releases/?platform=javascript#using-the-cli). # General advices diff --git a/bucket-production.yml b/bucket-production.yml index fe022dee..7ef45189 100644 --- a/bucket-production.yml +++ b/bucket-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/bucket-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/bucket-quality.yml' deploy:production: extends: .deploy diff --git a/bucket-quality.yml b/bucket-quality.yml index 97d57bb6..a8419c3f 100644 --- a/bucket-quality.yml +++ b/bucket-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/bucket.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/bucket.yml' deploy:quality: extends: .deploy diff --git a/cloudrun-production.yml b/cloudrun-production.yml index b4dc3277..2a7001bc 100644 --- a/cloudrun-production.yml +++ b/cloudrun-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/cloudrun-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/cloudrun-quality.yml' deploy:production: extends: deploy:quality diff --git a/cloudrun-quality.yml b/cloudrun-quality.yml index c38c1d49..770bdf73 100644 --- a/cloudrun-quality.yml +++ b/cloudrun-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/cloudrun.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/cloudrun.yml' deploy:quality: extends: .cloudrun:deploy diff --git a/docker.yml b/docker.yml index e698137d..6aa3b8e7 100644 --- a/docker.yml +++ b/docker.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml' build: stage: build diff --git a/helm-multiregion.yml b/helm-multiregion.yml index e458f5d4..cdb2a5e6 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml' # EUROPE deploy:production:europe:helm: diff --git a/helm-quality.yml b/helm-quality.yml index 43c567fd..720b0d9d 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/helm.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/helm.yml' deploy:quality:helm: variables: diff --git a/helm-regional.yml b/helm-regional.yml index e73c3e0a..a79d0a2f 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml' deploy:production:helm: extends: .deploy:production:helm diff --git a/kubernetes-multiregion.yml b/kubernetes-multiregion.yml index cc6b9346..77bc2d91 100644 --- a/kubernetes-multiregion.yml +++ b/kubernetes-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml' # EUROPE deploy:production:europe:image: diff --git a/kubernetes-quality.yml b/kubernetes-quality.yml index 63e19ba3..97ce715e 100644 --- a/kubernetes-quality.yml +++ b/kubernetes-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/kubernetes.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/kubernetes.yml' deploy:quality:image: variables: diff --git a/kubernetes-regional.yml b/kubernetes-regional.yml index c6bff43a..315a59dc 100644 --- a/kubernetes-regional.yml +++ b/kubernetes-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml' deploy:production:image: extends: .deploy:production:image diff --git a/kubernetes-task-production.yml b/kubernetes-task-production.yml index 6e167a8e..7a051871 100644 --- a/kubernetes-task-production.yml +++ b/kubernetes-task-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-task-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-task-quality.yml' task:production: extends: .task diff --git a/kubernetes-task-quality.yml b/kubernetes-task-quality.yml index 237e46b1..5061fdf2 100644 --- a/kubernetes-task-quality.yml +++ b/kubernetes-task-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/kubernetes-task.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/kubernetes-task.yml' task:quality: extends: .task diff --git a/sentry.yml b/sentry.yml index 472fe9ed..c8433629 100644 --- a/sentry.yml +++ b/sentry.yml @@ -1,36 +1,68 @@ -notify_sentry: - image: gdiener/ci-image-gcp:v1.0.1 - stage: notify +.sentry: + image: getsentry/sentry-cli:1.52.3 + only: + - /^v.+$/i + - master + allow_failure: true + when: on_success script: - - | - if [ -z "${SENTRY_API_URL}" ]; then - echo - echo "-> [WARNING] Missing 'SENTRY_API_URL' variable!" - echo - exit 1 - fi + - &check-set-variables | + # CHECK VARIABLES PHASE + for var in "SENTRY_AUTH_TOKEN" "SENTRY_URL" "SENTRY_ORG" "SENTRY_PROJECT"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + ENVIRONMENT="production" if [ -z "${CI_COMMIT_TAG}" ]; then CI_COMMIT_TAG=${CI_COMMIT_SHA} + ENVIRONMENT="quality" fi - PAYLOAD="{ \"version\": \"${CI_COMMIT_TAG}\" }" + sentry-cli info - STATUS_CODE=$(curl -sS -o /tmp/response.txt --write-out "%{http_code}" -H 'Content-Type: application/json' -X POST -d "${PAYLOAD}" "${SENTRY_API_URL}") +sentry:release:set: + extends: .sentry + stage: build + script: + - *check-set-variables + - | + #SET NEW RELEASE - if [[ "${STATUS_CODE}" -ne 201 ]] ; then - echo "Sentry webhook returned '${STATUS_CODE}' error!" + sentry-cli releases new "${CI_COMMIT_TAG}" + + if [ -n "${FEAT_SENTRY_SETCOMMITS}" ]; then echo - echo "Response:" - cat /tmp/response.txt + echo "-> [INFO] variable 'FEAT_SENTRY_SETCOMMITS' for experimental feature enabled!" echo - echo "Payload: ${PAYLOAD}" - exit 1 + sentry-cli releases set-commits "${CI_COMMIT_TAG}" --auto fi - echo "Sentry was notified of the change!" - when: on_success - allow_failure: true - only: - - /^v.+$/i - - master + echo "Sentry release set to ${CI_COMMIT_TAG}!" + + +sentry:release:finalize: + extends: .sentry + stage: deploy + script: + - *check-set-variables + - | + #FINALISE RELEASE + + sentry-cli releases finalize "${CI_COMMIT_TAG}" + + echo "Sentry release finalized to ${CI_COMMIT_TAG}!" + +sentry:notify: + extends: .sentry + stage: notify + script: + - *check-set-variables + - | + #SET NEW DEPLOY + + sentry-cli releases deploys "${CI_COMMIT_TAG}" new -e "${ENVIRONMENT}" + + echo "Sentry was notified that release ${CI_COMMIT_TAG} was set for ${ENVIRONMENT}!" diff --git a/serverless-multiregion.yml b/serverless-multiregion.yml index 524f0160..33206662 100644 --- a/serverless-multiregion.yml +++ b/serverless-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' # EUROPE deploy:production:europe: diff --git a/serverless-quality.yml b/serverless-quality.yml index d071dfca..1935bc1e 100644 --- a/serverless-quality.yml +++ b/serverless-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' deploy:quality: extends: .serverless:deploy diff --git a/serverless-regional.yml b/serverless-regional.yml index 6c166e6a..ba6c7b8e 100644 --- a/serverless-regional.yml +++ b/serverless-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' deploy:production: extends: .serverless:deploy diff --git a/ssh-production.yml b/ssh-production.yml index 3a9a5f5b..91bbcd71 100644 --- a/ssh-production.yml +++ b/ssh-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/ssh-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/ssh-quality.yml' ssh:production: extends: .ssh:exec diff --git a/ssh-quality.yml b/ssh-quality.yml index 0a6c9a55..bd787f3c 100644 --- a/ssh-quality.yml +++ b/ssh-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/ssh.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/ssh.yml' ssh:quality: extends: .ssh:exec diff --git a/test-unit.yml b/test-unit.yml index d6384872..c4811f86 100644 --- a/test-unit.yml +++ b/test-unit.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml' test:unit: extends: .docker