Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): add migration script for v0.26 #1029

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions migrations/v0.26/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# v0.26 migration

> NOTE: This applies when upgrading to the latest `v0.26.x` release.

When migrating from Vela version [v0.25](../../releases/v0.25.md) to [v0.26](../../releases/v0.26.md) the Vela
administrator will want to ensure the following actions are being performed. All queries are available in the [SQL migration scripts](./scripts/).

1. `v0.26.x` introduces a new opt-in GitHub App integration. This integration requires the addition of the `install_id` (INTEGER) column to the `repos` table.

- https://github.com/go-vela/server/pull/1217

2. Repos will also be able to set approval timeouts for builds that are pending approval. This requires `approval_timeout` (INTEGER) to be added to the `repos` table.
- https://github.com/go-vela/server/pull/1227

3. `v0.26.x` will use `go-yaml/v3` as the YAML parser for pipelines and templates but will support backwards comptability with `buildkite/yaml` until a later release. This change led to the creation of pipeline warnings, which necessitate the addition of `warnings` (VARCHAR-5000) to the `pipelines` table.

- https://github.com/go-vela/server/pull/1232


4. An additional OIDC claim will be added to identity tokens in `v0.26.x`. This will be the `fork` field, which should be added to `builds` table as a BOOLEAN.

- https://github.com/go-vela/server/pull/1221


5. Lastly, `v0.26.x` introduces a new index (`builds_event`) to the default configuration. This index will be created automatically. However, if you are running the `server` component with the `VELA_DATABASE_SKIP_CREATION` set to `true`, you will need to manually create this index. This change accompanies a deletion of an unused index (`builds_source`). You will need to manually delete this index if it exists, regardless of the skip creation setting.

- https://github.com/go-vela/server/pull/1228
39 changes: 39 additions & 0 deletions migrations/v0.26/scripts/migration-postgres.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
VELA MIGRATION v0.25.x --> v0.26.x

Please note that this SQL file must be executed prior to upgrading Vela to version 0.26.x
*/

/*
___ ___ _
| \ | \ |
|__/ |__/ |___
*/

-- Add warnings to pipelines table
ALTER TABLE pipelines
ADD COLUMN IF NOT EXISTS warnings VARCHAR(5000)
;

-- Add approval timeout to repos table
ALTER TABLE repos
ADD COLUMN IF NOT EXISTS approval_timeout INTEGER
;

-- Add install_id to repos table
ALTER TABLE repos
ADD COLUMN IF NOT EXISTS install_id INTEGER
;

-- Add fork to builds table
ALTER TABLE builds
ADD COLUMN IF NOT EXISTS fork BOOLEAN
;

-- Delete builds_source index
DROP INDEX IF EXISTS builds_source
;

-- Add builds_event index
CREATE INDEX IF NOT EXISTS builds_event ON builds (event)
;
39 changes: 39 additions & 0 deletions migrations/v0.26/scripts/migration-sqlite.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
VELA MIGRATION v0.25.x --> v0.26.x

Please note that this SQL file must be executed prior to upgrading Vela to version 0.26.x
*/

/*
___ ___ _
| \ | \ |
|__/ |__/ |___
*/

-- Add warnings to pipelines table
ALTER TABLE pipelines
ADD COLUMN IF NOT EXISTS warnings TEXT
;

-- Add approval timeout to repos table
ALTER TABLE repos
ADD COLUMN IF NOT EXISTS approval_timeout INTEGER
;

-- Add install_id to repos table
ALTER TABLE repos
ADD COLUMN IF NOT EXISTS install_id INTEGER
;

-- Add fork to builds table
ALTER TABLE builds
ADD COLUMN IF NOT EXISTS fork BOOLEAN
;

-- Delete builds_source index
DROP INDEX IF EXISTS builds_source
;

-- Add builds_event index
CREATE INDEX IF NOT EXISTS builds_event ON builds (event)
;