diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /scripts | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/api/get_job_id.rb | 16 | ||||
-rwxr-xr-x | scripts/db_tasks | 12 | ||||
-rw-r--r-- | scripts/frontend/startup_css/get_startup_css.js | 4 | ||||
-rw-r--r-- | scripts/lib/gitlab.rb | 13 | ||||
-rw-r--r-- | scripts/review_apps/base-config.yaml | 4 | ||||
-rwxr-xr-x | scripts/review_apps/review-apps.sh | 58 | ||||
-rwxr-xr-x | scripts/rspec_bisect_flaky | 29 | ||||
-rw-r--r-- | scripts/rspec_helpers.sh | 100 | ||||
-rwxr-xr-x | scripts/trigger-build | 4 | ||||
-rwxr-xr-x | scripts/undercoverage | 3 | ||||
-rwxr-xr-x | scripts/used-feature-flags | 7 | ||||
-rwxr-xr-x | scripts/validate_migration_schema | 6 |
12 files changed, 216 insertions, 40 deletions
diff --git a/scripts/api/get_job_id.rb b/scripts/api/get_job_id.rb index 166c9198951..2ee769d58f4 100755 --- a/scripts/api/get_job_id.rb +++ b/scripts/api/get_job_id.rb @@ -10,6 +10,7 @@ class JobFinder pipeline_query: {}.freeze, job_query: {}.freeze ).freeze + MAX_PIPELINES_TO_ITERATE = 20 def initialize(options) @project = options.delete(:project) @@ -41,25 +42,28 @@ class JobFinder def find_job_with_artifact return if artifact_path.nil? - client.pipelines(project, pipeline_query_params).auto_paginate do |pipeline| + client.pipelines(project, pipeline_query_params).paginate_with_limit(MAX_PIPELINES_TO_ITERATE) do |pipeline| + $stderr.puts "Iterating over #{pipeline}" # rubocop:disable Style/StderrPuts client.pipeline_jobs(project, pipeline.id, job_query_params).auto_paginate do |job| + next if job_name && !found_job_by_name?(job) + return job if found_job_with_artifact?(job) # rubocop:disable Cop/AvoidReturnFromBlocks end end - raise 'Job not found!' + warn 'Job not found!' end def find_job_with_filtered_pipelines return if pipeline_query.empty? - client.pipelines(project, pipeline_query_params).auto_paginate do |pipeline| + client.pipelines(project, pipeline_query_params).paginate_with_limit(MAX_PIPELINES_TO_ITERATE) do |pipeline| client.pipeline_jobs(project, pipeline.id, job_query_params).auto_paginate do |job| return job if found_job_by_name?(job) # rubocop:disable Cop/AvoidReturnFromBlocks end end - raise 'Job not found!' + warn 'Job not found!' end def find_job_in_pipeline @@ -69,7 +73,7 @@ class JobFinder return job if found_job_by_name?(job) # rubocop:disable Cop/AvoidReturnFromBlocks end - raise 'Job not found!' + warn 'Job not found!' end def found_job_with_artifact?(job) @@ -83,7 +87,7 @@ class JobFinder end def pipeline_query_params - @pipeline_query_params ||= { per_page: 100, **pipeline_query } + @pipeline_query_params ||= { per_page: MAX_PIPELINES_TO_ITERATE, **pipeline_query } end def job_query_params diff --git a/scripts/db_tasks b/scripts/db_tasks new file mode 100755 index 00000000000..56c2eefef68 --- /dev/null +++ b/scripts/db_tasks @@ -0,0 +1,12 @@ +#!/bin/bash + +root_path="$(cd "$(dirname "$0")/.." || exit ; pwd -P)" +task=$1 + +shift + +if [[ -d "${root_path}/ee/" || "${DECOMPOSED_DB}" == "true" ]]; then + task="${task}:main" +fi + +eval "bundle exec rake ${task} ${*}" diff --git a/scripts/frontend/startup_css/get_startup_css.js b/scripts/frontend/startup_css/get_startup_css.js index 10e8371df8c..2c8c3b4e321 100644 --- a/scripts/frontend/startup_css/get_startup_css.js +++ b/scripts/frontend/startup_css/get_startup_css.js @@ -29,7 +29,9 @@ const mergePurgeCSSOptions = (...options) => const getStartupCSS = async ({ htmlPaths, cssPaths, purgeOptions }) => { const content = htmlPaths.map((htmlPath) => { if (!fs.existsSync(htmlPath)) { - die(`Could not find fixture "${htmlPath}". Have you run the fixtures?`); + die( + `Could not find fixture "${htmlPath}". Have you run the fixtures? (bundle exec rspec spec/frontend/fixtures/startup_css.rb)`, + ); } const rawHtml = fs.readFileSync(htmlPath); diff --git a/scripts/lib/gitlab.rb b/scripts/lib/gitlab.rb new file mode 100644 index 00000000000..556e2037edf --- /dev/null +++ b/scripts/lib/gitlab.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Gitlab + module_function + + def ee? + File.exist?(File.expand_path('../../ee/app/models/license.rb', __dir__)) && !%w[true 1].include?(ENV['FOSS_ONLY'].to_s) + end + + def jh? + ee? && Dir.exist?(File.expand_path('../../jh', __dir__)) && !%w[true 1].include?(ENV['EE_ONLY'].to_s) + end +end diff --git a/scripts/review_apps/base-config.yaml b/scripts/review_apps/base-config.yaml index 7bb9c010016..0f6603fea8c 100644 --- a/scripts/review_apps/base-config.yaml +++ b/scripts/review_apps/base-config.yaml @@ -64,7 +64,7 @@ gitlab: memory: 2890M hpa: targetAverageValue: 650m - task-runner: + toolbox: resources: requests: cpu: 300m @@ -158,7 +158,7 @@ postgresql: memory: 1500M master: nodeSelector: - preemptible: "true" + preemptible: "false" prometheus: install: false redis: diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh index edb55a83555..695de95b8fc 100755 --- a/scripts/review_apps/review-apps.sh +++ b/scripts/review_apps/review-apps.sh @@ -1,5 +1,23 @@ [[ "$TRACE" ]] && set -x +function namespace_exists() { + local namespace="${1}" + local namespace_exists + + echoinfo "Checking if ${namespace} exists..." true + + kubectl describe namespace "${namespace}" >/dev/null 2>&1 + namespace_exists=$? + + if [ $namespace_exists -eq 0 ]; then + echoinfo "Namespace ${namespace} found." + else + echoerr "Namespace ${namespace} NOT found." + fi + + return $namespace_exists +} + function deploy_exists() { local namespace="${1}" local release="${2}" @@ -73,17 +91,20 @@ function delete_failed_release() { # Cleanup and previous installs, as FAILED and PENDING_UPGRADE will cause errors with `upgrade` if previous_deploy_failed "${namespace}" "${release}" ; then echoinfo "Review App deployment in bad state, cleaning up namespace ${release}" - delete_k8s_release_namespace + delete_namespace else echoinfo "Review App deployment in good state" fi fi } -function delete_k8s_release_namespace() { +function delete_namespace() { local namespace="${CI_ENVIRONMENT_SLUG}" - kubectl delete namespace "${namespace}" --wait + if namespace_exists "${namespace}"; then + echoinfo "Deleting namespace ${namespace}..." true + kubectl delete namespace "${namespace}" --wait + fi } function get_pod() { @@ -120,9 +141,9 @@ function get_pod() { function run_task() { local namespace="${CI_ENVIRONMENT_SLUG}" local ruby_cmd="${1}" - local task_runner_pod=$(get_pod "task-runner") + local toolbox_pod=$(get_pod "toolbox") - kubectl exec --namespace "${namespace}" "${task_runner_pod}" -- gitlab-rails runner "${ruby_cmd}" + kubectl exec --namespace "${namespace}" "${toolbox_pod}" -- gitlab-rails runner "${ruby_cmd}" } function disable_sign_ups() { @@ -147,6 +168,13 @@ function disable_sign_ups() { fi } +function create_sample_projects() { + local create_sample_projects_rb="root_user = User.find_by_username('root'); 1.times { |i| params = { namespace_id: root_user.namespace.id, name: 'sample-project' + i.to_s, path: 'sample-project' + i.to_s, template_name: 'sample' }; ::Projects::CreateFromTemplateService.new(root_user, params).execute }" + + # Queue jobs to create sample projects for root user namespace from sample data project template + retry "run_task \"${create_sample_projects_rb}\"" +} + function check_kube_domain() { echoinfo "Checking that Kube domain exists..." true @@ -163,9 +191,10 @@ function check_kube_domain() { function ensure_namespace() { local namespace="${1}" - echoinfo "Ensuring the ${namespace} namespace exists..." true - - kubectl describe namespace "${namespace}" || kubectl create namespace "${namespace}" + if ! namespace_exists "${namespace}"; then + echoinfo "Creating namespace ${namespace}..." true + kubectl create namespace "${namespace}" + fi } function label_namespace() { @@ -256,6 +285,12 @@ function deploy() { gitaly_image_tag=$(parse_gitaly_image_tag) gitlab_shell_image_repository="${IMAGE_REPOSITORY}/gitlab-shell" gitlab_workhorse_image_repository="${IMAGE_REPOSITORY}/gitlab-workhorse-ee" + sentry_enabled="false" + + if [ -n ${REVIEW_APPS_SENTRY_DSN} ]; then + echo "REVIEW_APPS_SENTRY_DSN detected, enabling Sentry" + sentry_enabled="true" + fi ensure_namespace "${namespace}" label_namespace "${namespace}" "tls=review-apps-tls" # label namespace for kubed to sync tls @@ -276,6 +311,9 @@ HELM_CMD=$(cat << EOF --set releaseOverride="${release}" \ --set global.hosts.hostSuffix="${HOST_SUFFIX}" \ --set global.hosts.domain="${REVIEW_APPS_DOMAIN}" \ + --set global.appConfig.sentry.enabled="${sentry_enabled}" \ + --set global.appConfig.sentry.dsn="${REVIEW_APPS_SENTRY_DSN}" \ + --set global.appConfig.sentry.environment="review" \ --set gitlab.migrations.image.repository="${gitlab_toolbox_image_repository}" \ --set gitlab.migrations.image.tag="${CI_COMMIT_REF_SLUG}" \ --set gitlab.gitaly.image.repository="${gitlab_gitaly_image_repository}" \ @@ -290,8 +328,8 @@ HELM_CMD=$(cat << EOF --set gitlab.webservice.image.tag="${CI_COMMIT_REF_SLUG}" \ --set gitlab.webservice.workhorse.image="${gitlab_workhorse_image_repository}" \ --set gitlab.webservice.workhorse.tag="${CI_COMMIT_REF_SLUG}" \ - --set gitlab.task-runner.image.repository="${gitlab_toolbox_image_repository}" \ - --set gitlab.task-runner.image.tag="${CI_COMMIT_REF_SLUG}" + --set gitlab.toolbox.image.repository="${gitlab_toolbox_image_repository}" \ + --set gitlab.toolbox.image.tag="${CI_COMMIT_REF_SLUG}" EOF ) diff --git a/scripts/rspec_bisect_flaky b/scripts/rspec_bisect_flaky new file mode 100755 index 00000000000..efeb9bcb5a0 --- /dev/null +++ b/scripts/rspec_bisect_flaky @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +## Usage: scripts/rspec_bisect_flaky <files...> +# +# The files should be listed in order, with the last file being the file where +# the flaky spec lives. + +if [ $# -eq 0 ]; then + echo "Usage: scripts/rspec_bisect_flaky <files...>" + exit +fi + +files=( $@ ) +len=${#files[@]} +target=${files[$len-1]} + +# Trap interrupts and exit instead of continuing the loop +trap "echo Exited!; exit 2;" SIGINT SIGTERM + +# Show which set of specs are running +set -x + +# Do the speedy case first, run each spec with our failing spec +for file in "${files[@]}"; do + bin/rspec $file $target +done + +# Do a full bisect given we did not find candidates with speedy cases +bin/rspec --bisect=verbose $@ diff --git a/scripts/rspec_helpers.sh b/scripts/rspec_helpers.sh index cabd2e6380c..2a6eb91a1f3 100644 --- a/scripts/rspec_helpers.sh +++ b/scripts/rspec_helpers.sh @@ -16,19 +16,27 @@ function retrieve_tests_metadata() { # always target the canonical project here, so the branch must be hardcoded local project_path="gitlab-org/gitlab" local artifact_branch="master" + local username="gitlab-bot" + local job_name="update-tests-metadata" local test_metadata_job_id # Ruby - test_metadata_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=gitlab-bot" -Q "scope=success" --job-name "update-tests-metadata") - - if [[ ! -f "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" ]]; then - scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_job_id}" --artifact-path "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" || echo "{}" > "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" - fi - - if [[ ! -f "${FLAKY_RSPEC_SUITE_REPORT_PATH}" ]]; then - # Fixed ID to get the report back to a good state after https://gitlab.com/gitlab-org/gitlab/-/issues/345798 / https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74617 - test_metadata_job_id=1766932099 - scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_job_id}" --artifact-path "${FLAKY_RSPEC_SUITE_REPORT_PATH}" || echo "{}" > "${FLAKY_RSPEC_SUITE_REPORT_PATH}" + test_metadata_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=${username}" -Q "scope=success" --job-name "${job_name}") + + if [[ -n "${test_metadata_job_id}" ]]; then + echo "test_metadata_job_id: ${test_metadata_job_id}" + + if [[ ! -f "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" ]]; then + scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_job_id}" --artifact-path "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" || echo "{}" > "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" + fi + + if [[ ! -f "${FLAKY_RSPEC_SUITE_REPORT_PATH}" ]]; then + scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_job_id}" --artifact-path "${FLAKY_RSPEC_SUITE_REPORT_PATH}" || echo "{}" > "${FLAKY_RSPEC_SUITE_REPORT_PATH}" + fi + else + echo "test_metadata_job_id couldn't be found!" + echo "{}" > "${KNAPSACK_RSPEC_SUITE_REPORT_PATH}" + echo "{}" > "${FLAKY_RSPEC_SUITE_REPORT_PATH}" fi fi } @@ -63,18 +71,58 @@ function retrieve_tests_mapping() { # always target the canonical project here, so the branch must be hardcoded local project_path="gitlab-org/gitlab" local artifact_branch="master" + local username="gitlab-bot" + local job_name="update-tests-metadata" local test_metadata_with_mapping_job_id - test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=gitlab-bot" -Q "scope=success" --job-name "update-tests-metadata" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz") + test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=${username}" -Q "scope=success" --job-name "${job_name}") - if [[ ! -f "${RSPEC_PACKED_TESTS_MAPPING_PATH}" ]]; then - (scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_with_mapping_job_id}" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz" && gzip -d "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz") || echo "{}" > "${RSPEC_PACKED_TESTS_MAPPING_PATH}" + if [[ -n "${test_metadata_with_mapping_job_id}" ]]; then + echo "test_metadata_with_mapping_job_id: ${test_metadata_with_mapping_job_id}" + + if [[ ! -f "${RSPEC_PACKED_TESTS_MAPPING_PATH}" ]]; then + (scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_with_mapping_job_id}" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz" && gzip -d "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz") || echo "{}" > "${RSPEC_PACKED_TESTS_MAPPING_PATH}" + fi + else + echo "test_metadata_with_mapping_job_id couldn't be found!" + echo "{}" > "${RSPEC_PACKED_TESTS_MAPPING_PATH}" fi fi scripts/unpack-test-mapping "${RSPEC_PACKED_TESTS_MAPPING_PATH}" "${RSPEC_TESTS_MAPPING_PATH}" } +function retrieve_frontend_fixtures_mapping() { + mkdir -p $(dirname "$FRONTEND_FIXTURES_MAPPING_PATH") + + if [[ -n "${RETRIEVE_TESTS_METADATA_FROM_PAGES}" ]]; then + if [[ ! -f "${FRONTEND_FIXTURES_MAPPING_PATH}" ]]; then + (curl --location -o "${FRONTEND_FIXTURES_MAPPING_PATH}" "https://gitlab-org.gitlab.io/gitlab/${FRONTEND_FIXTURES_MAPPING_PATH}") || echo "{}" > "${FRONTEND_FIXTURES_MAPPING_PATH}" + fi + else + # ${CI_DEFAULT_BRANCH} might not be master in other forks but we want to + # always target the canonical project here, so the branch must be hardcoded + local project_path="gitlab-org/gitlab" + local artifact_branch="master" + local username="gitlab-bot" + local job_name="generate-frontend-fixtures-mapping" + local test_metadata_with_mapping_job_id + + test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "ref=${artifact_branch}" -q "username=${username}" -Q "scope=success" --job-name "${job_name}") + + if [[ $? -eq 0 ]] && [[ -n "${test_metadata_with_mapping_job_id}" ]]; then + echo "test_metadata_with_mapping_job_id: ${test_metadata_with_mapping_job_id}" + + if [[ ! -f "${FRONTEND_FIXTURES_MAPPING_PATH}" ]]; then + (scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_with_mapping_job_id}" --artifact-path "${FRONTEND_FIXTURES_MAPPING_PATH}") || echo "{}" > "${FRONTEND_FIXTURES_MAPPING_PATH}" + fi + else + echo "test_metadata_with_mapping_job_id couldn't be found!" + echo "{}" > "${FRONTEND_FIXTURES_MAPPING_PATH}" + fi + fi +} + function update_tests_mapping() { if ! crystalball_rspec_data_exists; then echo "No crystalball rspec data found." @@ -115,7 +163,7 @@ function rspec_simple_job() { export NO_KNAPSACK="1" - bin/rspec -Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts} + eval "bin/rspec -Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}" } function rspec_db_library_code() { @@ -258,3 +306,27 @@ function rspec_matched_foss_tests() { echo "No impacted FOSS rspec tests to run" fi } + +function generate_frontend_fixtures_mapping() { + local pattern="" + + if [[ -d "ee/" ]]; then + pattern=",ee/" + fi + + if [[ -d "jh/" ]]; then + pattern="${pattern},jh/" + fi + + if [[ -n "${pattern}" ]]; then + pattern="{${pattern}}" + fi + + pattern="${pattern}spec/frontend/fixtures/**/*.rb" + + export GENERATE_FRONTEND_FIXTURES_MAPPING="true" + + mkdir -p $(dirname "$FRONTEND_FIXTURES_MAPPING_PATH") + + rspec_simple_job "--pattern \"${pattern}\"" +} diff --git a/scripts/trigger-build b/scripts/trigger-build index e5fa55f8582..d40e8de5a1f 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -155,7 +155,9 @@ module Trigger 'ee' => Trigger.ee? ? 'true' : 'false', 'QA_BRANCH' => ENV['QA_BRANCH'] || 'master', 'CACHE_UPDATE' => ENV['OMNIBUS_GITLAB_CACHE_UPDATE'], - 'GITLAB_QA_OPTIONS' => ENV['GITLAB_QA_OPTIONS'] + 'GITLAB_QA_OPTIONS' => ENV['GITLAB_QA_OPTIONS'], + 'QA_TESTS' => ENV['QA_TESTS'], + 'ALLURE_JOB_NAME' => ENV['ALLURE_JOB_NAME'] } end end diff --git a/scripts/undercoverage b/scripts/undercoverage new file mode 100755 index 00000000000..cc7415d67ac --- /dev/null +++ b/scripts/undercoverage @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +bundle exec undercover -c "${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(git merge-base origin/master HEAD)}" diff --git a/scripts/used-feature-flags b/scripts/used-feature-flags index 7d81e4b2cb2..552adbfbd9f 100755 --- a/scripts/used-feature-flags +++ b/scripts/used-feature-flags @@ -3,6 +3,7 @@ require 'set' require 'fileutils' +require_relative 'lib/gitlab' class String def red @@ -27,8 +28,7 @@ flags_paths = [ ] # For EE additionally process `ee/` feature flags -is_ee = File.exist?('ee/app/models/license.rb') && !%w[true 1].include?(ENV['FOSS_ONLY'].to_s) -if is_ee +if Gitlab.ee? flags_paths << 'ee/config/feature_flags/**/*.yml' # Geo feature flags are constructed dynamically and there's no explicit checks in the codebase so we mark all @@ -43,8 +43,7 @@ if is_ee end # For JH additionally process `jh/` feature flags -is_jh = is_ee && Dir.exist?('jh') && !%w[true 1].include?(ENV['EE_ONLY'].to_s) -if is_jh +if Gitlab.jh? flags_paths << 'jh/config/feature_flags/**/*.yml' Dir.glob('jh/app/replicators/geo/*_replicator.rb').each_with_object(Set.new) do |path, memo| diff --git a/scripts/validate_migration_schema b/scripts/validate_migration_schema index f9b2f0677b7..dded5c64927 100755 --- a/scripts/validate_migration_schema +++ b/scripts/validate_migration_schema @@ -30,7 +30,8 @@ class MigrationSchemaValidator committed_migrations.reverse_each do |filename| version = find_migration_version(filename) - run("bin/rails db:migrate:down VERSION=#{version}") + run("scripts/db_tasks db:migrate:down VERSION=#{version}") + run("scripts/db_tasks db:schema:dump") end git_command = "git diff #{diff_target} -- #{FILENAME}" @@ -40,7 +41,8 @@ class MigrationSchemaValidator end def validate_schema_on_migrate! - run('bin/rails db:migrate') + run("scripts/db_tasks db:migrate") + run("scripts/db_tasks db:schema:dump") git_command = "git diff -- #{FILENAME}" base_message = "the committed #{FILENAME} does not match the one generated by running added migrations" |