Skip to content

GitLab Next

    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Sign up now
  • Login
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !21955

Support db migration and initialization for Auto DevOps

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Thong Kuah requested to merge 48004-db-initialize-migrate into master Sep 27, 2018
  • Overview 23
  • Commits 5
  • Pipelines 6
  • Changes 3

Pre-requisite

  • ⚠ requires charts/auto-deploy-app!7 (merged)
  • ⚠ requires gitlab-ci-yml!201 (merged)

What does this MR do?

if $DB_INITIALIZE is present, deploy an initial release where only $DB_INITIALIZE is run in a special job (and deployments are not rendered/loaded). This is then followed by second release with deployments as usual.

if $DB_MIGRATE, set this value which will trigger a pre-upgrade helm hook.

Due to helm not supporting hook logs, this MR does not show the logs from the intialization and migration logs.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/48004

Tasks

  • Document :

For an example Rails project :

  • We can set DB_INITIALIZE: cd /app && RAILS_ENV=production bin/setup and DB_MIGRATE: cd app && RAILS_ENV=production bin/update

  • /app is from herokuish buildpacks. Can use $APP_PATH too

  • Also, there is only one chance to run $DB_INITIALIZE. If the first deploy successfully completes, $DB_INITIALIZE will never be run again. If $DB_INITIALIZE is present during the first deploy though and it errors or fails, that doesn't cound as a successfully first deploy

Does this MR meet the acceptance criteria?

  • Changelog entry added, if necessary
  • Documentation created/updated
  • Tests added for this feature/bug
  • Conforms to the code review guidelines
  • Conforms to the merge request performance guidelines
  • Conforms to the style guides
  • Conforms to the database guides

Closes #48004 (closed)

Edited Oct 02, 2018 by Thong Kuah
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 48004-db-initialize-migrate