Skip to content

Instantly share code, notes, and snippets.

@2color
Forked from willejs/README.md
Last active March 5, 2018 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2color/529b2a714a3576ad9a77c019f7da6936 to your computer and use it in GitHub Desktop.
Save 2color/529b2a714a3576ad9a77c019f7da6936 to your computer and use it in GitHub Desktop.
Moving Concourse Pipelines

Moving Concourse Pipelines

Intro

Currently concourse does not support moving pipelines between teams via fly CLI. There is an issue for that here

The only way to do this is to make a few changes in the DB.

If you run the statement below you will see that 6 tables have the team_id column.

concourse=> select table_name                                                                                                                                                                                                                                                                                                                                                       from INFORMATION_SCHEMA.COLUMNS                                                                                                                                                                                                                                                                                                                                                 where column_name = 'team_id';;
    from INFORMATION_SCHEMA.COLUMNS
    where column_name = 'team_id';

If you describe the tables \d+ pipelines you can see the column is present. Run a quick select * from pipelines limit 5 to examine what the data is like.

If you do this for the rest of the tables, it becomes apparant that the only tables you need to edit are pipelines, and builds. This will move your pipeline definitions and your historic builds over correctly, and everything will carry on working.

Migrate pipelines and builds

from one team to another

If you want to move all your pipelines from team main to team new (lets say it has an id of 3) you would just run the following statements:

begin;
update pipelines set team_id = 3 where team_id = 1; 
update builds set team_id = 3 where team_id = 1;
commit;

This will move all of your pipelines that belong to team 1 to team 3.

All pipeline and corresponding builds of a pipelines with a pattern

begin;
update pipelines set team_id = 3 where name ~ 'analytic';
update builds set team_id = 3 where pipeline_id in (select id from pipelines where name ~ 'analytic');
commit;

This will move all of your pipelines with analytics in their name to team 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment