From 327a3b30206eb2b2c197d48f6997288ddf2b84a5 Mon Sep 17 00:00:00 2001
From: Cam Saul <cammsaul@gmail.com>
Date: Tue, 19 Feb 2019 18:08:43 -0800
Subject: [PATCH] Add yamllint step to CI

---
 .circleci/config.yml                     | 19 +++++
 resources/migrations/000_migrations.yaml | 89 ++++++++++++++----------
 2 files changed, 72 insertions(+), 36 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index e4f2204dfbb..bb1677667b9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -294,6 +294,20 @@ jobs:
             lein with-profile +ci test
           no_output_timeout: 10m
 
+  yaml-linter:
+    <<: *defaults
+    steps:
+      - attach_workspace:
+          at: /home/circleci/
+      - run:
+          name: Install yamllint
+          command: npm install yaml-lint
+          no_output_timeout: 2m
+      - run:
+          name: Lint YAML files
+          command: ./node_modules/.bin/yamllint `find resources -name '*.yaml'`
+          no_output_timeout: 2m
+
   be-tests-sqlserver:
     <<: *defaults
     steps:
@@ -674,6 +688,9 @@ workflows:
       - be-tests-snowflake:
           requires:
             - be-tests
+      - yaml-linter:
+          requires:
+            - checkout
       - fe-deps:
           requires:
             - checkout
@@ -726,6 +743,8 @@ workflows:
             - be-tests-vertica
             - be-tests-snowflake
 
+            - yaml-linter
+
             - fe-linter-eslint
             - fe-linter-prettier
             - fe-linter-flow
diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml
index c229596d4c8..20c99b83f55 100644
--- a/resources/migrations/000_migrations.yaml
+++ b/resources/migrations/000_migrations.yaml
@@ -1464,8 +1464,11 @@ databaseChangeLog:
   - changeSet:
       id: 10
       author: cammsaul
-      validCheckSum: 7:97fec69516d0dfe424ea7365f51bb87e
-      validCheckSum: 7:3b90e2fe0ac8e617a1f30ef95d39319b
+      validCheckSum:
+        - 7:97fec69516d0dfe424ea7365f51bb87e
+        - 7:3b90e2fe0ac8e617a1f30ef95d39319b
+        - 8:431360d062cb82d8b27960b3a0abb98c
+        - 8:9f03a236be31f54e8e5c894fe5fc7f00
       changes:
         - createTable:
             tableName: revision
@@ -1516,10 +1519,10 @@ databaseChangeLog:
             tableName: revision
             indexName: idx_revision_model_model_id
             columns:
-              column:
-                name: model
-              column:
-                name: model_id
+              - column:
+                  name: model
+              - column:
+                  name: model_id
         - modifySql:
             dbms: postgresql
             replace:
@@ -1569,8 +1572,9 @@ databaseChangeLog:
   - changeSet:
       id: 13
       author: agilliland
-      validCheckSum: 7:f27286894439bef33ff93761f9b32bc4
-      validCheckSum: 7:1bc8ccc9b1803cda5651f144029be40c
+      validCheckSum:
+        - 7:f27286894439bef33ff93761f9b32bc4
+        - 7:1bc8ccc9b1803cda5651f144029be40c
       changes:
         - createTable:
             tableName: activity
@@ -1759,8 +1763,9 @@ databaseChangeLog:
   - changeSet:
       id: 18
       author: camsaul
-      validCheckSum: 7:07d501a6e52c14691f7f895d137e565f
-      validCheckSum: 7:329d897d44ba9893fdafc9ce7e876d73
+      validCheckSum:
+        - 7:07d501a6e52c14691f7f895d137e565f
+        - 7:329d897d44ba9893fdafc9ce7e876d73
       changes:
         - createTable:
             tableName: data_migrations
@@ -2916,6 +2921,9 @@ databaseChangeLog:
   - changeSet:
       id: 40
       author: camsaul
+      validCheckSum:
+        - 8:231d66cf27fc4b4bc066172b435439b5
+        - 8:ee7f50a264d6cf8d891bd01241eebd2c
       changes:
         ############################################################ add PermissionsGroup table ############################################################
         - createTable:
@@ -2990,10 +2998,10 @@ databaseChangeLog:
             tableName: permissions_group_membership
             indexName: idx_permissions_group_membership_group_id_user_id
             columns:
-              column:
-                name: group_id
-              column:
-                name: user_id
+              - column:
+                  name: group_id
+              - column:
+                  name: user_id
         ############################################################ add Permissions table ############################################################
         - createTable:
             tableName: permissions
@@ -3033,10 +3041,10 @@ databaseChangeLog:
             tableName: permissions
             indexName: idx_permissions_group_id_object
             columns:
-              column:
-                name: group_id
-              column:
-                name: object
+              - column:
+                  name: group_id
+              - column:
+                  name: object
         - addUniqueConstraint:
             tableName: permissions
             columnNames: group_id, object
@@ -3058,10 +3066,10 @@ databaseChangeLog:
             tableName: metabase_table
             indexName: idx_metabase_table_db_id_schema
             columns:
-              column:
-                name: db_id
-              column:
-                name: schema
+              - column:
+                  name: db_id
+              - column:
+                  name: schema
   - changeSet:
       id: 41
       author: camsaul
@@ -3132,8 +3140,9 @@ databaseChangeLog:
   - changeSet:
       id: 43
       author: camsaul
-      validCheckSum: 7:b20750a949504e93efced32877a4488f
-      validCheckSum: 7:dbc18c8ca697fc335869f0ed0eb5f4cb
+      validCheckSum:
+        - 7:b20750a949504e93efced32877a4488f
+        - 7:dbc18c8ca697fc335869f0ed0eb5f4cb
       changes:
         - createTable:
             tableName: permissions_revision
@@ -3433,6 +3442,9 @@ databaseChangeLog:
   - changeSet:
       id: 51
       author: camsaul
+      validCheckSum:
+        - 8:8491a72bd30aac2565c97daf8b84e515
+        - 8:676d3f95358dcd572ccce47c950e8ed9
       changes:
         - createTable:
             tableName: query_execution
@@ -3516,10 +3528,10 @@ databaseChangeLog:
             tableName: query_execution
             indexName: idx_query_execution_query_hash_started_at
             columns:
-              column:
-                name: query_hash
-              column:
-                name: started_at
+              - column:
+                  name: hash
+              - column:
+                  name: started_at
   - property:
         name: blob.type
         value: blob
@@ -3592,8 +3604,9 @@ databaseChangeLog:
   - changeSet:
       id: 54
       author: tlrobinson
-      validCheckSum: '7:695b12a78e897c62c21d41bfb04ab44b'
-      validCheckSum: '7:0857800db71a4757e7202aad4eaed48d'
+      validCheckSum:
+        - 7:695b12a78e897c62c21d41bfb04ab44b
+        - 7:0857800db71a4757e7202aad4eaed48d
       changes:
         - addColumn:
             tableName: pulse
@@ -3858,8 +3871,9 @@ databaseChangeLog:
       id: 66
       author: senior
       comment: 'Added 0.26.0'
-      validCheckSum: '7:e494c2c90fe5c377526da7a6e5ad63a2'
-      validCheckSum: '7:76d06b44a544105c2a613603b8bdf25f'
+      validCheckSum:
+        - 7:e494c2c90fe5c377526da7a6e5ad63a2
+        - 7:76d06b44a544105c2a613603b8bdf25f
       changes:
         - sql:
             sql: drop table if exists computation_job_result cascade
@@ -4230,8 +4244,10 @@ databaseChangeLog:
               defaultValueBoolean: false
         # Before this change, metrics/segments had opposite logic, rather than marking something as archived
         # it was marked as active. Since the column is now an archived column, flip the boolean value
+        #
+        # As you may have noticed, we're not flipping the value for Metric here. @senior originally intended to do so,
+        # but the YAML was off slightly. We have corrected this issue at a later date -- see migration #100
         - sql:
-            sql: update metric set archived = not(archived)
             sql: update segment set archived = not(archived)
   # Personal Collections, and removing Collection's unique constraint and index on slug
   - changeSet:
@@ -4995,9 +5011,10 @@ databaseChangeLog:
       id: 92
       author: camsaul
       comment: 'Added 0.31.0'
-      validCheckSum: 8:a875945f36824a0667c740888c00c37f
-      validCheckSum: 8:83ded48e18fe8f70d6ec09add042124d
-      validCheckSum: 8:1e5bc2d66778316ea640a561862c23b4
+      validCheckSum:
+        - 8:a875945f36824a0667c740888c00c37f
+        - 8:83ded48e18fe8f70d6ec09add042124d
+        - 8:1e5bc2d66778316ea640a561862c23b4
       changes:
         - addColumn:
             tableName: query_execution
-- 
GitLab