sqitch icon indicating copy to clipboard operation
sqitch copied to clipboard

Sqitch Status command on a new plan with a new change does not work as expected.

Open slowmonkey opened this issue 2 years ago • 3 comments

Steps to reproduce:

  1. Create a new plan file. eg. sqitch init with a new folder and sqitch project.
  2. Add a sql change. eg. New file added to the sqitch plan
  3. Type sqitch status

Expected result:

  1. Shows the new file has not been deployed as is to be deployed.
  2. Error code is 0.

Actual result:

  1. Shows "No changes deployed"
  2. Error code is 1.

sqitch check command returns Checks Successful with an error code 0 for the above scenario.

The Problem This is problematic as I'm trying to create a deploy workflow that shows what is about to happen before a manual deploy approval is required. The error code 1 and "No changes deployed". Because of the error code the build/deploy step fails.

NOTE: If at least one change file has been deployed to the database the above scenario does not occur. Everything works fine.

slowmonkey avatar Mar 04 '22 06:03 slowmonkey

It shows that error because the registry does not know about this project, so there is no status at all to show. This can be helpful for the case where you checked the status of the wrong database, for example. But I could see the argument either way; perhaps it would be helpful to add an option to --status so it returns 0 and a full status instead of the error if the database has no changes for the plan.

theory avatar Mar 12 '22 15:03 theory

I'm happy with either approach.

Only thing is it still doesn't say that it's going to deploy x, y, z on a brand new plan. Was hoping to show what is about to happen to the team before we click the go ahead for deployment in our CI/CD pipeline.

slowmonkey avatar Mar 18 '22 06:03 slowmonkey

The option would assume you mean to deploy and so would show the list of changes to be deployed as normal.

OTOH, it might make sense to do that with no option, and add a --strict option or some such to fail if there are no deployments at all. Needs some thinking through…

theory avatar Mar 18 '22 15:03 theory