Skip to content

Use absolute path to find pending database migration in gdk doctor

nobody requested to merge jgao1025/gitlab-development-kit:issue-1661 into main

What does this merge request do and why?

Use gdk doctor to troubleshoot and fix any issues with the database migration. It should work okay on local dev, but on Gitpod, there is a slink from /workspace/gitlab-development-kit/gitlab to /workspace/gitlab, and using relative path will make GDK unable to find bundle-exec.

This MR will use absolute path instead.

gitpod /workspace/gitlab-development-kit ((fb7d9d3d...)) $ gdk doctor
.................
⚠️  WARNING: Your GDK may need attention.

GDK Version
================================================================================
An update for GDK is available.

Database Migrations
================================================================================
No such file or directory - ../support/bundle-exec
/home/gitpod/.asdf/installs/ruby/2.7.7/lib/ruby/2.7.0/open3.rb:213:in `spawn'
/home/gitpod/.asdf/installs/ruby/2.7.7/lib/ruby/2.7.0/open3.rb:213:in `popen_run'
/home/gitpod/.asdf/installs/ruby/2.7.7/lib/ruby/2.7.0/open3.rb:101:in `popen3'
/home/gitpod/.asdf/installs/ruby/2.7.7/lib/ruby/2.7.0/open3.rb:281:in `capture3'
/workspace/gitlab-development-kit/lib/shellout.rb:150:in `capture'
/workspace/gitlab-development-kit/lib/shellout.rb:98:in `run'
/workspace/gitlab-development-kit/lib/gdk/diagnostic/pending_migrations.rb:10:in `diagnose'
/workspace/gitlab-development-kit/lib/gdk/command/doctor.rb:55:in `perform_diagnosis_for'
/workspace/gitlab-development-kit/lib/gdk/command/doctor.rb:48:in `block (2 levels) in jobs'

Closes #1661 (closed)

How to set up and validate locally

  1. open gitlab project by using GitPod.
  2. apply the changes to gitlab-developnet-kit
  3. run the following command.
gitpod /workspace/gitlab-development-kit ((fb7d9d3d...)) $ gdk doctor
..................
⚠️  WARNING: Your GDK may need attention.

GDK Version
================================================================================
An update for GDK is available.

Database Migrations
================================================================================
There are pending database migrations.  To update your database, run:

  cd /workspace/gitlab-development-kit/gitlab && /workspace/gitlab-development-kit/support/bundle-exec rails db:migrate

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Ash McKenzie

Merge request reports