From c549544cc4c92c34a8ec1146122bbc7c9ab16a3e Mon Sep 17 00:00:00 2001 From: Alessandro Date: Tue, 21 Apr 2020 11:30:49 +0200 Subject: [PATCH 01/17] Added Docker pipeline documentation --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8841a580..eb5555f1 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,10 @@ variables: SKIP_DOCKER_CACHE: "false" ``` +All stages in Docker file should be named (e.g. `AS buildes`, `AS prod`...). These need to be added to `STAGES` variable. `IMAGES` variable defines the images that will be built, just delete the variable if a single image will be created. In this case the image will be named as `CI_REGISTRY_IMAGE`, othewise `CI_REGISTRY_IMAGE` will be a folder containing `IMAGES`. +`DOCKERFILES_DIR` is used to specify a different folder containing Dockerfiles instead of the default root directory. + + ## Kubernetes quality pipeline ```yaml From 3080c13a96c2cf3571c4f9f21ffdd92a305e56d5 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Tue, 21 Apr 2020 16:14:52 +0200 Subject: [PATCH 02/17] feat: add helm testing, follow by rollback on fail --- README.md | 5 +++-- helm-quality.yml | 45 ++++++++++++++++++++++++++++++++++++++- helm-regional.yml | 48 +++++++++++++++++++++++++++++++++++++++++- templates/helm.yml | 52 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 138 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8841a580..85481b01 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,8 @@ With Kubernetes: With Helm: -`lint -> build -> test -> push -> deploy -> notify` +`lint -> build -> test -> push -> deploy -> verify -> rollback -> notify` -Rollback is not necessary thanks to Helm's atomic operations (if the installing fails, Helm cleans up by itself) Our workflow: - A commit on master goes to quality @@ -458,6 +457,8 @@ stages: - build - push - deploy + - verify + - rollback variables: IMAGES: "app nginx" diff --git a/helm-quality.yml b/helm-quality.yml index f64a62f8..f4f248b6 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -16,9 +16,52 @@ deploy:quality:helm: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY"; do + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 fi done + only: + - master + +verify:quality: + extends: .verify + stage: verify + variables: + GOOGLE_KEY: ${GOOGLE_KEY_QUALITY} + CLUSTER_NAME: ${CLUSTER_NAME_QUALITY} + CLUSTER_ZONE: ${CLUSTER_ZONE_QUALITY} + NAMESPACE: ${NAMESPACE_QUALITY} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY" "APP_NAME"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + only: + - master + +rollback:quality: + extends: .rollback + stage: rollback + variables: + GOOGLE_KEY: ${GOOGLE_KEY_QUALITY} + CLUSTER_NAME: ${CLUSTER_NAME_QUALITY} + CLUSTER_ZONE: ${CLUSTER_ZONE_QUALITY} + NAMESPACE: ${NAMESPACE_QUALITY} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY" "APP_NAME"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - master diff --git a/helm-regional.yml b/helm-regional.yml index 5aadc253..7683c451 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -15,9 +15,55 @@ deploy:production:helm: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION"; do + for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION" "NAMESPACE_PRODUCTION"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 fi done + +verify:production: + extends: .verify + stage: verify + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION} + NAMESPACE: ${NAMESPACE_PRODUCTION} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION" "NAMESPACE_PRODUCTION"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - /^v.+$/i + except: + - branches + +rollback:production: + extends: .rollback + stage: rollback + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION} + NAMESPACE: ${NAMESPACE_PRODUCTION} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION" "NAMESPACE_PRODUCTION"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - /^v.+$/i + except: + - branches \ No newline at end of file diff --git a/templates/helm.yml b/templates/helm.yml index a1f1241d..a25ca13f 100644 --- a/templates/helm.yml +++ b/templates/helm.yml @@ -5,8 +5,10 @@ .helm:deploy: extends: .helm stage: deploy + variables: + GIT_DEPTH: 1 script: - - | + - &checkvars | #CHECKING VARIABLES PHASE for var in "GOOGLE_KEY" "CLUSTER_ZONE" "CLUSTER_NAME" "NAMESPACE" "APP_NAME" "PART_OF" "GOOGLE_PROJECT" "CHARTS_URL" "CHART_NAME"; do if [ -z "${!var}" ]; then @@ -16,7 +18,7 @@ exit 1 fi done - - | + - &activate | # ACTIVATION PHASE echo "${GOOGLE_KEY}" > /tmp/key.json @@ -28,7 +30,7 @@ echo echo "-> Google project '${GOOGLE_PROJECT}' configured!" echo - - | + - &connect | # CLUSTER CONNECTION PHASE gcloud container clusters get-credentials --zone "${CLUSTER_ZONE}" "${CLUSTER_NAME}" @@ -106,11 +108,6 @@ helm upgrade --install --atomic "${APP_NAME}" "current-repo/${CHART_NAME}" --wait --timeout "${TIMEOUT}" -f /tmp/values.yaml --namespace "${NAMESPACE}" --version ${CHART_VERSION} sleep 5 - # echo - # echo "-> App ${APP_NAME} up! Chart version is ${CHART_VERSION}" - # echo - - # helm test "${APP_NAME}" echo echo "-> App ${APP_NAME} released! Chart version is ${CHART_VERSION}" @@ -143,3 +140,42 @@ deploy:quality:helm: environment: name: ${ENVIRONMENT_NAME} url: https://${DOMAIN} + +.verify: + extends: .helm + stage: verify + variables: + GIT_STRATEGY: none + script: + - *checkvars #NO + - *activate + - *connect + - | + # HELM TEST + + echo + echo "-> Testing ${APP_NAME} ! Version of the tests: ${CHART_VERSION}" + echo + + helm test "${APP_NAME}" --logs --timeout "${TIMEOUT}" --namespace "${NAMESPACE}" + + +.rollback: + extends: .helm + variables: + GIT_STRATEGY: none + script: + - *activate + - *connect + - | + # ROLLBACK PHASE + + echo + echo "-> Rolling back ${APP_NAME} !" + echo + + if [ -z "${TIMEOUT}" ]; then + TIMEOUT=600s + fi + + helm rollback "${APP_NAME}" --wait --timeout "${TIMEOUT}" From c27b1fff9a984b83a3cbc02aff12ee780cb89a48 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 22 Apr 2020 14:07:49 +0200 Subject: [PATCH 03/17] chore: remove unused operation, remove stage steps --- templates/helm.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/templates/helm.yml b/templates/helm.yml index a1f1241d..7fd38d0c 100644 --- a/templates/helm.yml +++ b/templates/helm.yml @@ -67,7 +67,7 @@ echo fi fi - - | + # SECRETS APPLICATION if [ -n "${SECRET_YAML}" ]; then @@ -87,7 +87,6 @@ echo fi - - | # HELM APPLICATION helm repo add current-repo "${CHARTS_URL}" helm repo update @@ -116,15 +115,6 @@ echo "-> App ${APP_NAME} released! Chart version is ${CHART_VERSION}" echo - - | - # POST-DEPLOY HOOK - - if [ -n "${AFTER_CUSTOM_APPLY_FILE_PATH}" ]; then - kubectl apply -f "${AFTER_CUSTOM_APPLY_FILE_PATH}" \ - && echo "-> Custom post-job deployed!" - echo - fi - deploy:quality:helm: extends: .helm:deploy only: From ababcdd410bffecd83256e82db04caaf2d2f7811 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 22 Apr 2020 14:27:27 +0200 Subject: [PATCH 04/17] fix: variables checking --- helm-quality.yml | 6 +++--- helm-regional.yml | 3 +-- templates/helm.yml | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/helm-quality.yml b/helm-quality.yml index f4f248b6..83a414ca 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -16,7 +16,7 @@ deploy:quality:helm: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY"; do + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY" "DOMAIN_QUALITY"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 @@ -36,7 +36,7 @@ verify:quality: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY" "APP_NAME"; do + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 @@ -56,7 +56,7 @@ rollback:quality: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY" "APP_NAME"; do + for var in "GOOGLE_KEY_QUALITY" "CLUSTER_NAME_QUALITY" "CLUSTER_ZONE_QUALITY" "NAMESPACE_QUALITY"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 diff --git a/helm-regional.yml b/helm-regional.yml index 7683c451..dc70f3c7 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -15,7 +15,7 @@ deploy:production:helm: before_script: - | # CHECK VARIABLES PHASE - for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION" "NAMESPACE_PRODUCTION"; do + for var in "GOOGLE_KEY_PRODUCTION" "CLUSTER_NAME_PRODUCTION" "CLUSTER_ZONE_PRODUCTION" "NAMESPACE_PRODUCTION" "DOMAIN_PRODUCTION"; do if [ -z "${!var}" ]; then echo "Missing '${var}' variable!" exit 1 @@ -39,7 +39,6 @@ verify:production: exit 1 fi done - when: on_failure only: - /^v.+$/i except: diff --git a/templates/helm.yml b/templates/helm.yml index a25ca13f..04ca910e 100644 --- a/templates/helm.yml +++ b/templates/helm.yml @@ -147,7 +147,7 @@ deploy:quality:helm: variables: GIT_STRATEGY: none script: - - *checkvars #NO + - *checkvars - *activate - *connect - | @@ -165,6 +165,7 @@ deploy:quality:helm: variables: GIT_STRATEGY: none script: + - *checkvars - *activate - *connect - | From 9e07a57f0e6c7e13b2dceadd62fa01c2c3b5b800 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 22 Apr 2020 14:27:46 +0200 Subject: [PATCH 05/17] feat: add multiregional helm jobs --- helm-multiregion.yml | 135 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/helm-multiregion.yml b/helm-multiregion.yml index 59b6f236..f5657e2c 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -24,6 +24,51 @@ deploy:production:europe:helm: fi done +verify:production:europe: + extends: .verify + stage: verify + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_EUROPE} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_EUROPE} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_EUROPE} + NAMESPACE: ${NAMESPACE_PRODUCTION_EUROPE} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_EUROPE" "CLUSTER_NAME_PRODUCTION_EUROPE" "CLUSTER_ZONE_PRODUCTION_EUROPE" "NAMESPACE_PRODUCTION_EUROPE"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + only: + - /^v.+$/i + except: + - branches + +rollback:production:europe: + extends: .rollback + stage: rollback + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_EUROPE} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_EUROPE} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_EUROPE} + NAMESPACE: ${NAMESPACE_PRODUCTION_EUROPE} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_EUROPE" "CLUSTER_NAME_PRODUCTION_EUROPE" "CLUSTER_ZONE_PRODUCTION_EUROPE" "NAMESPACE_PRODUCTION_EUROPE"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - /^v.+$/i + except: + - branches + # AMERICA deploy:production:america:helm: extends: .deploy:production:helm @@ -47,6 +92,51 @@ deploy:production:america:helm: fi done +verify:production:america: + extends: .verify + stage: verify + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_AMERICA} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_AMERICA} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_AMERICA} + NAMESPACE: ${NAMESPACE_PRODUCTION_AMERICA} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_AMERICA" "CLUSTER_NAME_PRODUCTION_AMERICA" "CLUSTER_ZONE_PRODUCTION_AMERICA" "NAMESPACE_PRODUCTION_AMERICA"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + only: + - /^v.+$/i + except: + - branches + +rollback:production:america: + extends: .rollback + stage: rollback + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_AMERICA} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_AMERICA} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_AMERICA} + NAMESPACE: ${NAMESPACE_PRODUCTION_AMERICA} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_AMERICA" "CLUSTER_NAME_PRODUCTION_AMERICA" "CLUSTER_ZONE_PRODUCTION_AMERICA" "NAMESPACE_PRODUCTION_AMERICA"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - /^v.+$/i + except: + - branches + # ASIA deploy:production:asia:helm: extends: .deploy:production:helm @@ -69,3 +159,48 @@ deploy:production:asia:helm: exit 1 fi done + +verify:production:asia: + extends: .verify + stage: verify + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_ASIA} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_ASIA} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_ASIA} + NAMESPACE: ${NAMESPACE_PRODUCTION_ASIA} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_ASIA" "CLUSTER_NAME_PRODUCTION_ASIA" "CLUSTER_ZONE_PRODUCTION_ASIA" "NAMESPACE_PRODUCTION_ASIA"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + only: + - /^v.+$/i + except: + - branches + +rollback:production:asia: + extends: .rollback + stage: rollback + variables: + GOOGLE_KEY: ${GOOGLE_KEY_PRODUCTION_ASIA} + CLUSTER_NAME: ${CLUSTER_NAME_PRODUCTION_ASIA} + CLUSTER_ZONE: ${CLUSTER_ZONE_PRODUCTION_ASIA} + NAMESPACE: ${NAMESPACE_PRODUCTION_ASIA} + before_script: + - | + # CHECK VARIABLES PHASE + for var in "GOOGLE_KEY_PRODUCTION_ASIA" "CLUSTER_NAME_PRODUCTION_ASIA" "CLUSTER_ZONE_PRODUCTION_ASIA" "NAMESPACE_PRODUCTION_ASIA"; do + if [ -z "${!var}" ]; then + echo "Missing '${var}' variable!" + exit 1 + fi + done + when: on_failure + only: + - /^v.+$/i + except: + - branches From f67c15d4222751f774ba7acefb57dd16351fa305 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 22 Apr 2020 14:32:37 +0200 Subject: [PATCH 06/17] chore: bump version --- bucket-production.yml | 2 +- bucket-quality.yml | 2 +- cloudrun-production.yml | 2 +- cloudrun-quality.yml | 4 ++-- docker.yml | 2 +- helm-multiregion.yml | 2 +- helm-quality.yml | 4 ++-- helm-regional.yml | 2 +- kubernetes-multiregion.yml | 2 +- kubernetes-quality.yml | 4 ++-- kubernetes-regional.yml | 2 +- kubernetes-task-production.yml | 2 +- kubernetes-task-quality.yml | 2 +- serverless-multiregion.yml | 2 +- serverless-quality.yml | 2 +- serverless-regional.yml | 2 +- ssh-production.yml | 2 +- ssh-quality.yml | 2 +- test-unit.yml | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bucket-production.yml b/bucket-production.yml index 31479ce5..ee23c18a 100644 --- a/bucket-production.yml +++ b/bucket-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/bucket-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/bucket-quality.yml' deploy:production: extends: .deploy diff --git a/bucket-quality.yml b/bucket-quality.yml index 194ba8e0..56512a5c 100644 --- a/bucket-quality.yml +++ b/bucket-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/bucket.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/bucket.yml' deploy:quality: extends: .deploy diff --git a/cloudrun-production.yml b/cloudrun-production.yml index dda40525..0129e548 100644 --- a/cloudrun-production.yml +++ b/cloudrun-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/cloudrun-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/cloudrun-quality.yml' deploy:production: extends: deploy:quality diff --git a/cloudrun-quality.yml b/cloudrun-quality.yml index 25346264..4b9a4fd9 100644 --- a/cloudrun-quality.yml +++ b/cloudrun-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/cloudrun.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/cloudrun.yml' deploy:quality: extends: .cloudrun:deploy diff --git a/docker.yml b/docker.yml index ae137d94..ff759a4b 100644 --- a/docker.yml +++ b/docker.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' build: stage: build diff --git a/helm-multiregion.yml b/helm-multiregion.yml index f5657e2c..2b8a9aeb 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' # EUROPE deploy:production:europe:helm: diff --git a/helm-quality.yml b/helm-quality.yml index 83a414ca..4538845c 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/helm.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/helm.yml' deploy:quality:helm: variables: diff --git a/helm-regional.yml b/helm-regional.yml index dc70f3c7..d0f824fc 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' deploy:production:helm: extends: .deploy:production:helm diff --git a/kubernetes-multiregion.yml b/kubernetes-multiregion.yml index 0a6e1b89..5f6f2a5b 100644 --- a/kubernetes-multiregion.yml +++ b/kubernetes-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' # EUROPE deploy:production:europe:image: diff --git a/kubernetes-quality.yml b/kubernetes-quality.yml index 2e557e60..7901761d 100644 --- a/kubernetes-quality.yml +++ b/kubernetes-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/kubernetes.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/kubernetes.yml' deploy:quality:image: variables: diff --git a/kubernetes-regional.yml b/kubernetes-regional.yml index 8bfc2556..947ed16f 100644 --- a/kubernetes-regional.yml +++ b/kubernetes-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' deploy:production:image: extends: .deploy:production:image diff --git a/kubernetes-task-production.yml b/kubernetes-task-production.yml index c96dd268..393407ce 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.8.0/kubernetes-task-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-task-quality.yml' task:production: extends: .task diff --git a/kubernetes-task-quality.yml b/kubernetes-task-quality.yml index 4635765b..ea313f63 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.8.0/templates/kubernetes-task.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/kubernetes-task.yml' task:quality: extends: .task diff --git a/serverless-multiregion.yml b/serverless-multiregion.yml index a7bde644..f28775e9 100644 --- a/serverless-multiregion.yml +++ b/serverless-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' # EUROPE deploy:production:europe: diff --git a/serverless-quality.yml b/serverless-quality.yml index 20b86665..68ac9b8d 100644 --- a/serverless-quality.yml +++ b/serverless-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' deploy:quality: extends: .serverless:deploy diff --git a/serverless-regional.yml b/serverless-regional.yml index b4a886f2..ed8096bf 100644 --- a/serverless-regional.yml +++ b/serverless-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' deploy:production: extends: .serverless:deploy diff --git a/ssh-production.yml b/ssh-production.yml index 3f95990d..02c6c97a 100644 --- a/ssh-production.yml +++ b/ssh-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/ssh-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/ssh-quality.yml' ssh:production: extends: .ssh:exec diff --git a/ssh-quality.yml b/ssh-quality.yml index a3bcf1cd..8ccc2a76 100644 --- a/ssh-quality.yml +++ b/ssh-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/ssh.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/ssh.yml' ssh:quality: extends: .ssh:exec diff --git a/test-unit.yml b/test-unit.yml index 62c33d63..034b0ac6 100644 --- a/test-unit.yml +++ b/test-unit.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.8.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' test:unit: extends: .docker From 249473fb60974a2283fc6dccb99a7b6d4b85340f Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Thu, 23 Apr 2020 11:35:05 +0200 Subject: [PATCH 07/17] feat: add shellcheck lint --- README.md | 16 ++++++++++++++++ lint-shell.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 lint-shell.yml diff --git a/README.md b/README.md index f925ece7..b7c017d3 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,22 @@ See [here](https://github.com/zegl/kube-score/blob/master/README_CHECKS.md) for NB: The test `label_values` needs to be skipped because of the values `${CI_COMMIT_TAG}` (which will be replaced by `envsubst` later in the pipeline) causing validation fail. +### Linting shell files + +```yaml +include: + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates//lint-shell.yml' + +stages: + - lint + +variables: + # optional, used to enable reviewdog + ENABLE_REVIEWDOG: 1 + REVIEWDOG_GITLAB_API_TOKEN: + REVIEWDOG_LEVEL: warning # optional, values: info, warning, error +``` + # Unit test stage ```yaml diff --git a/lint-shell.yml b/lint-shell.yml new file mode 100644 index 00000000..c2aea259 --- /dev/null +++ b/lint-shell.yml @@ -0,0 +1,42 @@ +lint:shell: + stage: lint + image: linuxbandit/shellcheck-reviewdog:v1.0.0 + variables: + GITLAB_API: ${CI_API_V4_URL} + script: + - | + + if [[ -z "${LINT_PATH}" ]]; then + LINT_PATH="." + fi + + echo + echo "-> Linting shell files:" + echo + + if [ "${ENABLE_REVIEWDOG}" = "1" ]; then + echo + echo "-> Enabled Review Dog!" + echo + + if [ -z "${REVIEWDOG_GITLAB_API_TOKEN}" ]; then + echo + echo "-> [WARNING] Missing 'REVIEWDOG_GITLAB_API_TOKEN' variable!" + echo + exit 1 + fi + + if [ -z "${REVIEWDOG_LEVEL}" ]; then + REVIEWDOG_LEVEL="warning" + fi + + shellcheck -f json $(find "${LINT_PATH}" -type f -name "*.sh") | reviewdog -name="Shellcheck linter" \ + -efm="%f:%l:%c: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" + + else + shellcheck -f json $(find "${LINT_PATH}" -type f -name "*.sh") + fi + + echo + echo "-> Shell files checked!" + echo \ No newline at end of file From baede5e7a835e4a0f2945ba00df9f1a479a83b72 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Thu, 23 Apr 2020 14:48:02 +0200 Subject: [PATCH 08/17] chore: bump version --- bucket-production.yml | 2 +- bucket-quality.yml | 2 +- cloudrun-production.yml | 2 +- cloudrun-quality.yml | 4 ++-- docker.yml | 2 +- helm-multiregion.yml | 2 +- helm-quality.yml | 4 ++-- helm-regional.yml | 2 +- kubernetes-multiregion.yml | 2 +- kubernetes-quality.yml | 4 ++-- kubernetes-regional.yml | 2 +- kubernetes-task-production.yml | 2 +- kubernetes-task-quality.yml | 2 +- lint-shell.yml | 2 +- serverless-multiregion.yml | 2 +- serverless-quality.yml | 2 +- serverless-regional.yml | 2 +- ssh-production.yml | 2 +- ssh-quality.yml | 2 +- test-unit.yml | 2 +- 20 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bucket-production.yml b/bucket-production.yml index ee23c18a..fe022dee 100644 --- a/bucket-production.yml +++ b/bucket-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/bucket-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/bucket-quality.yml' deploy:production: extends: .deploy diff --git a/bucket-quality.yml b/bucket-quality.yml index 56512a5c..97d57bb6 100644 --- a/bucket-quality.yml +++ b/bucket-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/bucket.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/bucket.yml' deploy:quality: extends: .deploy diff --git a/cloudrun-production.yml b/cloudrun-production.yml index 0129e548..b4dc3277 100644 --- a/cloudrun-production.yml +++ b/cloudrun-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/cloudrun-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/cloudrun-quality.yml' deploy:production: extends: deploy:quality diff --git a/cloudrun-quality.yml b/cloudrun-quality.yml index 4b9a4fd9..c38c1d49 100644 --- a/cloudrun-quality.yml +++ b/cloudrun-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/cloudrun.yml' + - 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' deploy:quality: extends: .cloudrun:deploy diff --git a/docker.yml b/docker.yml index ff759a4b..e698137d 100644 --- a/docker.yml +++ b/docker.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' build: stage: build diff --git a/helm-multiregion.yml b/helm-multiregion.yml index 2b8a9aeb..e458f5d4 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' # EUROPE deploy:production:europe:helm: diff --git a/helm-quality.yml b/helm-quality.yml index 4538845c..43c567fd 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/helm.yml' + - 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' deploy:quality:helm: variables: diff --git a/helm-regional.yml b/helm-regional.yml index d0f824fc..e73c3e0a 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' deploy:production:helm: extends: .deploy:production:helm diff --git a/kubernetes-multiregion.yml b/kubernetes-multiregion.yml index 5f6f2a5b..cc6b9346 100644 --- a/kubernetes-multiregion.yml +++ b/kubernetes-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' # EUROPE deploy:production:europe:image: diff --git a/kubernetes-quality.yml b/kubernetes-quality.yml index 7901761d..63e19ba3 100644 --- a/kubernetes-quality.yml +++ b/kubernetes-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/kubernetes.yml' + - 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' deploy:quality:image: variables: diff --git a/kubernetes-regional.yml b/kubernetes-regional.yml index 947ed16f..c6bff43a 100644 --- a/kubernetes-regional.yml +++ b/kubernetes-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' deploy:production:image: extends: .deploy:production:image diff --git a/kubernetes-task-production.yml b/kubernetes-task-production.yml index 393407ce..6e167a8e 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.9.0/kubernetes-task-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-task-quality.yml' task:production: extends: .task diff --git a/kubernetes-task-quality.yml b/kubernetes-task-quality.yml index ea313f63..237e46b1 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.9.0/templates/kubernetes-task.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/kubernetes-task.yml' task:quality: extends: .task diff --git a/lint-shell.yml b/lint-shell.yml index c2aea259..56267e33 100644 --- a/lint-shell.yml +++ b/lint-shell.yml @@ -39,4 +39,4 @@ lint:shell: echo echo "-> Shell files checked!" - echo \ No newline at end of file + echo diff --git a/serverless-multiregion.yml b/serverless-multiregion.yml index f28775e9..524f0160 100644 --- a/serverless-multiregion.yml +++ b/serverless-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' # EUROPE deploy:production:europe: diff --git a/serverless-quality.yml b/serverless-quality.yml index 68ac9b8d..d071dfca 100644 --- a/serverless-quality.yml +++ b/serverless-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' deploy:quality: extends: .serverless:deploy diff --git a/serverless-regional.yml b/serverless-regional.yml index ed8096bf..6c166e6a 100644 --- a/serverless-regional.yml +++ b/serverless-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' deploy:production: extends: .serverless:deploy diff --git a/ssh-production.yml b/ssh-production.yml index 02c6c97a..3a9a5f5b 100644 --- a/ssh-production.yml +++ b/ssh-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/ssh-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/ssh-quality.yml' ssh:production: extends: .ssh:exec diff --git a/ssh-quality.yml b/ssh-quality.yml index 8ccc2a76..0a6c9a55 100644 --- a/ssh-quality.yml +++ b/ssh-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/ssh.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/ssh.yml' ssh:quality: extends: .ssh:exec diff --git a/test-unit.yml b/test-unit.yml index 034b0ac6..d6384872 100644 --- a/test-unit.yml +++ b/test-unit.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' test:unit: extends: .docker From df8c3cd4ba748929acb4e9871f7391d524f2bb33 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Fri, 24 Apr 2020 10:57:57 +0200 Subject: [PATCH 09/17] feat: sentry uses cli instead of broken api --- README.md | 8 +++++++- sentry.yml | 37 +++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f925ece7..495c5855 100644 --- a/README.md +++ b/README.md @@ -785,9 +785,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/sentry.yml b/sentry.yml index 472fe9ed..3ed3220c 100644 --- a/sentry.yml +++ b/sentry.yml @@ -1,33 +1,38 @@ notify_sentry: - image: gdiener/ci-image-gcp:v1.0.1 + image: getsentry/sentry-cli:1.52.3 stage: notify + variables: + ENVIRONMENT: "production" script: - | - if [ -z "${SENTRY_API_URL}" ]; then - echo - echo "-> [WARNING] Missing 'SENTRY_API_URL' variable!" - echo - exit 1 - fi + # 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 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}") - - if [[ "${STATUS_CODE}" -ne 201 ]] ; then - echo "Sentry webhook returned '${STATUS_CODE}' error!" + 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 new "${CI_COMMIT_TAG}" + sentry-cli releases set-commits "${CI_COMMIT_TAG}" --auto + sentry-cli releases finalize "$VERSION" + else + sentry-cli releases new --finalize "${CI_COMMIT_TAG}" fi + sentry-cli releases deploys "${CI_COMMIT_TAG}" new -e "${ENVIRONMENT}" + echo "Sentry was notified of the change!" when: on_success allow_failure: true From 27394b0ba76b7af9900f61396be2d507985ddd31 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Fri, 24 Apr 2020 11:00:56 +0200 Subject: [PATCH 10/17] chore: bump tag --- bucket-production.yml | 2 +- bucket-quality.yml | 2 +- cloudrun-production.yml | 2 +- cloudrun-quality.yml | 4 ++-- docker.yml | 2 +- helm-multiregion.yml | 2 +- helm-quality.yml | 4 ++-- helm-regional.yml | 2 +- kubernetes-multiregion.yml | 2 +- kubernetes-quality.yml | 4 ++-- kubernetes-regional.yml | 2 +- kubernetes-task-production.yml | 2 +- kubernetes-task-quality.yml | 2 +- serverless-multiregion.yml | 2 +- serverless-quality.yml | 2 +- serverless-regional.yml | 2 +- ssh-production.yml | 2 +- ssh-quality.yml | 2 +- test-unit.yml | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bucket-production.yml b/bucket-production.yml index ee23c18a..fe022dee 100644 --- a/bucket-production.yml +++ b/bucket-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/bucket-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/bucket-quality.yml' deploy:production: extends: .deploy diff --git a/bucket-quality.yml b/bucket-quality.yml index 56512a5c..97d57bb6 100644 --- a/bucket-quality.yml +++ b/bucket-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/bucket.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/bucket.yml' deploy:quality: extends: .deploy diff --git a/cloudrun-production.yml b/cloudrun-production.yml index 0129e548..b4dc3277 100644 --- a/cloudrun-production.yml +++ b/cloudrun-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/cloudrun-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/cloudrun-quality.yml' deploy:production: extends: deploy:quality diff --git a/cloudrun-quality.yml b/cloudrun-quality.yml index 4b9a4fd9..c38c1d49 100644 --- a/cloudrun-quality.yml +++ b/cloudrun-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/cloudrun.yml' + - 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' deploy:quality: extends: .cloudrun:deploy diff --git a/docker.yml b/docker.yml index ff759a4b..e698137d 100644 --- a/docker.yml +++ b/docker.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' build: stage: build diff --git a/helm-multiregion.yml b/helm-multiregion.yml index 2b8a9aeb..e458f5d4 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' # EUROPE deploy:production:europe:helm: diff --git a/helm-quality.yml b/helm-quality.yml index 4538845c..43c567fd 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/helm.yml' + - 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' deploy:quality:helm: variables: diff --git a/helm-regional.yml b/helm-regional.yml index d0f824fc..e73c3e0a 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/helm-quality.yml' deploy:production:helm: extends: .deploy:production:helm diff --git a/kubernetes-multiregion.yml b/kubernetes-multiregion.yml index 5f6f2a5b..cc6b9346 100644 --- a/kubernetes-multiregion.yml +++ b/kubernetes-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' # EUROPE deploy:production:europe:image: diff --git a/kubernetes-quality.yml b/kubernetes-quality.yml index 7901761d..63e19ba3 100644 --- a/kubernetes-quality.yml +++ b/kubernetes-quality.yml @@ -1,6 +1,6 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/docker.yml' - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/kubernetes.yml' + - 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' deploy:quality:image: variables: diff --git a/kubernetes-regional.yml b/kubernetes-regional.yml index 947ed16f..c6bff43a 100644 --- a/kubernetes-regional.yml +++ b/kubernetes-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-quality.yml' deploy:production:image: extends: .deploy:production:image diff --git a/kubernetes-task-production.yml b/kubernetes-task-production.yml index 393407ce..6e167a8e 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.9.0/kubernetes-task-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/kubernetes-task-quality.yml' task:production: extends: .task diff --git a/kubernetes-task-quality.yml b/kubernetes-task-quality.yml index ea313f63..237e46b1 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.9.0/templates/kubernetes-task.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/kubernetes-task.yml' task:quality: extends: .task diff --git a/serverless-multiregion.yml b/serverless-multiregion.yml index f28775e9..524f0160 100644 --- a/serverless-multiregion.yml +++ b/serverless-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' # EUROPE deploy:production:europe: diff --git a/serverless-quality.yml b/serverless-quality.yml index 68ac9b8d..d071dfca 100644 --- a/serverless-quality.yml +++ b/serverless-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' deploy:quality: extends: .serverless:deploy diff --git a/serverless-regional.yml b/serverless-regional.yml index ed8096bf..6c166e6a 100644 --- a/serverless-regional.yml +++ b/serverless-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/serverless.yml' deploy:production: extends: .serverless:deploy diff --git a/ssh-production.yml b/ssh-production.yml index 02c6c97a..3a9a5f5b 100644 --- a/ssh-production.yml +++ b/ssh-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/ssh-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/ssh-quality.yml' ssh:production: extends: .ssh:exec diff --git a/ssh-quality.yml b/ssh-quality.yml index 8ccc2a76..0a6c9a55 100644 --- a/ssh-quality.yml +++ b/ssh-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/ssh.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/ssh.yml' ssh:quality: extends: .ssh:exec diff --git a/test-unit.yml b/test-unit.yml index 034b0ac6..d6384872 100644 --- a/test-unit.yml +++ b/test-unit.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.9.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.10.0/templates/docker.yml' test:unit: extends: .docker From d77fcec73e775a8ab0cf1c7463d92f1ea5c0dbe8 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Fri, 24 Apr 2020 11:04:47 +0200 Subject: [PATCH 11/17] fix: remove output json when no reviewdog enabled --- lint-shell.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lint-shell.yml b/lint-shell.yml index 56267e33..6980318a 100644 --- a/lint-shell.yml +++ b/lint-shell.yml @@ -34,7 +34,7 @@ lint:shell: -efm="%f:%l:%c: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" else - shellcheck -f json $(find "${LINT_PATH}" -type f -name "*.sh") + shellcheck $(find "${LINT_PATH}" -type f -name "*.sh") fi echo From 4166699e6f1663100d4a2413e64f00a01cfbf66e Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Fri, 24 Apr 2020 11:46:24 +0200 Subject: [PATCH 12/17] feat: improve the release flow --- sentry.yml | 57 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/sentry.yml b/sentry.yml index 3ed3220c..c8433629 100644 --- a/sentry.yml +++ b/sentry.yml @@ -1,10 +1,12 @@ -notify_sentry: +.sentry: image: getsentry/sentry-cli:1.52.3 - stage: notify - variables: - ENVIRONMENT: "production" + only: + - /^v.+$/i + - master + allow_failure: true + when: on_success script: - - | + - &check-set-variables | # CHECK VARIABLES PHASE for var in "SENTRY_AUTH_TOKEN" "SENTRY_URL" "SENTRY_ORG" "SENTRY_PROJECT"; do if [ -z "${!var}" ]; then @@ -13,6 +15,7 @@ notify_sentry: fi done + ENVIRONMENT="production" if [ -z "${CI_COMMIT_TAG}" ]; then CI_COMMIT_TAG=${CI_COMMIT_SHA} ENVIRONMENT="quality" @@ -20,22 +23,46 @@ notify_sentry: sentry-cli info +sentry:release:set: + extends: .sentry + stage: build + script: + - *check-set-variables + - | + #SET NEW RELEASE + + sentry-cli releases new "${CI_COMMIT_TAG}" + if [ -n "${FEAT_SENTRY_SETCOMMITS}" ]; then echo echo "-> [INFO] variable 'FEAT_SENTRY_SETCOMMITS' for experimental feature enabled!" echo - sentry-cli releases new "${CI_COMMIT_TAG}" sentry-cli releases set-commits "${CI_COMMIT_TAG}" --auto - sentry-cli releases finalize "$VERSION" - else - sentry-cli releases new --finalize "${CI_COMMIT_TAG}" fi + 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 of the change!" - when: on_success - allow_failure: true - only: - - /^v.+$/i - - master + echo "Sentry was notified that release ${CI_COMMIT_TAG} was set for ${ENVIRONMENT}!" From 63e8c3bf0f1e57dd681b38cfab7128c257ee909d Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Mon, 27 Apr 2020 10:31:43 +0200 Subject: [PATCH 13/17] chore: bump version --- bucket-production.yml | 2 +- bucket-quality.yml | 2 +- cloudrun-production.yml | 2 +- cloudrun-quality.yml | 4 ++-- docker.yml | 2 +- helm-multiregion.yml | 2 +- helm-quality.yml | 4 ++-- helm-regional.yml | 2 +- kubernetes-multiregion.yml | 2 +- kubernetes-quality.yml | 4 ++-- kubernetes-regional.yml | 2 +- kubernetes-task-production.yml | 2 +- kubernetes-task-quality.yml | 2 +- serverless-multiregion.yml | 2 +- serverless-quality.yml | 2 +- serverless-regional.yml | 2 +- ssh-production.yml | 2 +- ssh-quality.yml | 2 +- test-unit.yml | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) 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/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 From 45348888804eb850f33b8d10dd3d0a002e139685 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 29 Apr 2020 10:59:59 +0200 Subject: [PATCH 14/17] feat: add reviewdog --- lint-docker.yml | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/lint-docker.yml b/lint-docker.yml index 0a51333c..ba59c379 100644 --- a/lint-docker.yml +++ b/lint-docker.yml @@ -1,11 +1,11 @@ lint:docker: stage: lint - image: hadolint/hadolint:v1.17.5-debian + image: linuxbandit/hadolint-reviewdog:v1.0.0 script: - | COMMAND_TO_RUN="hadolint" - COMMAND_TO_RUN+=( --trusted-registry registry.my-company.io ) + COMMAND_TO_RUN+=( --trusted-registry ${CI_REGISTRY} ) if [[ -n "${IGNORE_DOCKER_LINT}" ]]; then IGNORE_DOCKER_LINT=( DL3012 ) @@ -27,14 +27,45 @@ lint:docker: echo "-> Linting Dockerfile:" echo - "${FINAL_COMMAND[@]}" - if [[ ! -z "${EXTRA_COMMAND}" ]]; then + if [ "${ENABLE_REVIEWDOG}" = "1" ]; then + echo - echo "-> Linting support Dockerfile:" + echo "-> Enabled Review Dog!" echo - "${EXTRA_COMMAND[@]}" + + if [ -z "${REVIEWDOG_GITLAB_API_TOKEN}" ]; then + echo + echo "-> [WARNING] Missing 'REVIEWDOG_GITLAB_API_TOKEN' variable!" + echo + exit 1 + fi + + if [ -z "${REVIEWDOG_LEVEL}" ]; then + REVIEWDOG_LEVEL="warning" + fi + + "${FINAL_COMMAND[@]}" | reviewdog -name="Hadolint linter" \ + -efm="%f:%l: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" + if [[ ! -z "${EXTRA_COMMAND}" ]]; then + echo + echo "-> Linting support Dockerfile:" + echo + "${EXTRA_COMMAND[@]}" | reviewdog -name="Hadolint linter - support Dockerfile" \ + -efm="%f:%l: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" + fi + else + "${FINAL_COMMAND[@]}" + if [[ ! -z "${EXTRA_COMMAND}" ]]; then + echo + echo "-> Linting support Dockerfile:" + echo + "${EXTRA_COMMAND[@]}" + fi + + fi + echo echo "-> Dockerfile(s) checked!" echo From 2ee54ed9a11a0e84ba1de3cc228d98749516a84d Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 29 Apr 2020 11:46:37 +0200 Subject: [PATCH 15/17] refactor: find Dockerfiles same way of docker.yml --- lint-docker.yml | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/lint-docker.yml b/lint-docker.yml index ba59c379..dbfff33c 100644 --- a/lint-docker.yml +++ b/lint-docker.yml @@ -5,7 +5,7 @@ lint:docker: - | COMMAND_TO_RUN="hadolint" - COMMAND_TO_RUN+=( --trusted-registry ${CI_REGISTRY} ) + COMMAND_TO_RUN+=( --trusted-registry "${CI_REGISTRY}" ) if [[ -n "${IGNORE_DOCKER_LINT}" ]]; then IGNORE_DOCKER_LINT=( DL3012 ) @@ -14,13 +14,18 @@ lint:docker: COMMAND_TO_RUN+=( --ignore "${ign}" ) done - FINAL_COMMAND=${COMMAND_TO_RUN} + # Find docker files in a way similar to docker.yml - if [[ -f "Dockerfile" ]]; then - FINAL_COMMAND+=( ./Dockerfile ) + if [ -z "${IMAGES}" ]; then + COMMAND_TO_RUN+=( ./Dockerfile ) else - FINAL_COMMAND+=( ./docker/app/Dockerfile ) - EXTRA_COMMAND+=( ${COMMAND_TO_RUN} ./docker/nginx/Dockerfile ) + if [ -z "${DOCKERFILES_DIR}" ]; then + DOCKERFILES_DIR=docker + fi + + for image in ${IMAGES[@]}; do + COMMAND_TO_RUN+=( ./"${DOCKERFILES_DIR}/${image}"/Dockerfile ) + done fi echo @@ -44,26 +49,11 @@ lint:docker: REVIEWDOG_LEVEL="warning" fi - "${FINAL_COMMAND[@]}" | reviewdog -name="Hadolint linter" \ + "${COMMAND_TO_RUN[@]}" | reviewdog -name="Hadolint linter" \ -efm="%f:%l: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" - if [[ ! -z "${EXTRA_COMMAND}" ]]; then - echo - echo "-> Linting support Dockerfile:" - echo - "${EXTRA_COMMAND[@]}" | reviewdog -name="Hadolint linter - support Dockerfile" \ - -efm="%f:%l: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}" - fi else - - "${FINAL_COMMAND[@]}" - if [[ ! -z "${EXTRA_COMMAND}" ]]; then - echo - echo "-> Linting support Dockerfile:" - echo - "${EXTRA_COMMAND[@]}" - fi - + "${COMMAND_TO_RUN[@]}" fi echo From a455ac13a913c52b8f4aa6ebaeb1eb627fadc2a2 Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 29 Apr 2020 11:47:29 +0200 Subject: [PATCH 16/17] chore: add docker registry as trusted --- lint-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lint-docker.yml b/lint-docker.yml index dbfff33c..db7ef6b0 100644 --- a/lint-docker.yml +++ b/lint-docker.yml @@ -5,7 +5,7 @@ lint:docker: - | COMMAND_TO_RUN="hadolint" - COMMAND_TO_RUN+=( --trusted-registry "${CI_REGISTRY}" ) + COMMAND_TO_RUN+=( --trusted-registry "docker.io" --trusted-registry "${CI_REGISTRY}" ) if [[ -n "${IGNORE_DOCKER_LINT}" ]]; then IGNORE_DOCKER_LINT=( DL3012 ) From 7e42a336d858a2f1f005fb54b1d1a5e07fffaf8d Mon Sep 17 00:00:00 2001 From: linuxbandit Date: Wed, 29 Apr 2020 11:57:30 +0200 Subject: [PATCH 17/17] chore: bump version --- bucket-production.yml | 2 +- bucket-quality.yml | 2 +- cloudrun-production.yml | 2 +- cloudrun-quality.yml | 4 ++-- docker.yml | 2 +- helm-multiregion.yml | 2 +- helm-quality.yml | 4 ++-- helm-regional.yml | 2 +- kubernetes-multiregion.yml | 2 +- kubernetes-quality.yml | 4 ++-- kubernetes-regional.yml | 2 +- kubernetes-task-production.yml | 2 +- kubernetes-task-quality.yml | 2 +- serverless-multiregion.yml | 2 +- serverless-quality.yml | 2 +- serverless-regional.yml | 2 +- ssh-production.yml | 2 +- ssh-quality.yml | 2 +- test-unit.yml | 2 +- 19 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bucket-production.yml b/bucket-production.yml index 7ef45189..8ee3ec31 100644 --- a/bucket-production.yml +++ b/bucket-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/bucket-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/bucket-quality.yml' deploy:production: extends: .deploy diff --git a/bucket-quality.yml b/bucket-quality.yml index a8419c3f..730cbd31 100644 --- a/bucket-quality.yml +++ b/bucket-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/bucket.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/bucket.yml' deploy:quality: extends: .deploy diff --git a/cloudrun-production.yml b/cloudrun-production.yml index 2a7001bc..751989eb 100644 --- a/cloudrun-production.yml +++ b/cloudrun-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/cloudrun-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/cloudrun-quality.yml' deploy:production: extends: deploy:quality diff --git a/cloudrun-quality.yml b/cloudrun-quality.yml index 770bdf73..7ff077bc 100644 --- a/cloudrun-quality.yml +++ b/cloudrun-quality.yml @@ -1,6 +1,6 @@ include: - - 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' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/cloudrun.yml' deploy:quality: extends: .cloudrun:deploy diff --git a/docker.yml b/docker.yml index 6aa3b8e7..12803055 100644 --- a/docker.yml +++ b/docker.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/docker.yml' build: stage: build diff --git a/helm-multiregion.yml b/helm-multiregion.yml index cdb2a5e6..ec404af7 100644 --- a/helm-multiregion.yml +++ b/helm-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/helm-quality.yml' # EUROPE deploy:production:europe:helm: diff --git a/helm-quality.yml b/helm-quality.yml index 720b0d9d..29a963ae 100644 --- a/helm-quality.yml +++ b/helm-quality.yml @@ -1,6 +1,6 @@ include: - - 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' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/helm.yml' deploy:quality:helm: variables: diff --git a/helm-regional.yml b/helm-regional.yml index a79d0a2f..73868d2c 100644 --- a/helm-regional.yml +++ b/helm-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/helm-quality.yml' deploy:production:helm: extends: .deploy:production:helm diff --git a/kubernetes-multiregion.yml b/kubernetes-multiregion.yml index 77bc2d91..65f4a5ba 100644 --- a/kubernetes-multiregion.yml +++ b/kubernetes-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-quality.yml' # EUROPE deploy:production:europe:image: diff --git a/kubernetes-quality.yml b/kubernetes-quality.yml index 97ce715e..2d59052a 100644 --- a/kubernetes-quality.yml +++ b/kubernetes-quality.yml @@ -1,6 +1,6 @@ include: - - 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' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/kubernetes.yml' deploy:quality:image: variables: diff --git a/kubernetes-regional.yml b/kubernetes-regional.yml index 315a59dc..cc1edab2 100644 --- a/kubernetes-regional.yml +++ b/kubernetes-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-quality.yml' deploy:production:image: extends: .deploy:production:image diff --git a/kubernetes-task-production.yml b/kubernetes-task-production.yml index 7a051871..da372a9f 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.11.0/kubernetes-task-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-task-quality.yml' task:production: extends: .task diff --git a/kubernetes-task-quality.yml b/kubernetes-task-quality.yml index 5061fdf2..7b275aa9 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.11.0/templates/kubernetes-task.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/kubernetes-task.yml' task:quality: extends: .task diff --git a/serverless-multiregion.yml b/serverless-multiregion.yml index 33206662..a087dc48 100644 --- a/serverless-multiregion.yml +++ b/serverless-multiregion.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml' # EUROPE deploy:production:europe: diff --git a/serverless-quality.yml b/serverless-quality.yml index 1935bc1e..e227c2c3 100644 --- a/serverless-quality.yml +++ b/serverless-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml' deploy:quality: extends: .serverless:deploy diff --git a/serverless-regional.yml b/serverless-regional.yml index ba6c7b8e..ad0c0a9d 100644 --- a/serverless-regional.yml +++ b/serverless-regional.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml' deploy:production: extends: .serverless:deploy diff --git a/ssh-production.yml b/ssh-production.yml index 91bbcd71..4da02fb3 100644 --- a/ssh-production.yml +++ b/ssh-production.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/ssh-quality.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/ssh-quality.yml' ssh:production: extends: .ssh:exec diff --git a/ssh-quality.yml b/ssh-quality.yml index bd787f3c..19b4f3ae 100644 --- a/ssh-quality.yml +++ b/ssh-quality.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/ssh.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/ssh.yml' ssh:quality: extends: .ssh:exec diff --git a/test-unit.yml b/test-unit.yml index c4811f86..d0a14059 100644 --- a/test-unit.yml +++ b/test-unit.yml @@ -1,5 +1,5 @@ include: - - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml' + - remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/docker.yml' test:unit: extends: .docker