porter: Incorrect installation state after migration to v1
Describe the bug
We’re seeing some issues with the migration from v0.38.12 to v1 - some installations are ending up in a uninstalled or defined state.
I’m haven’t been able to reproduce it (yet) but it fails consistently on our test server. So this issue just contains the output I’ve encountered so far - but I thought it relevant to bring it to your attention now.
My guess is that it is related to claims not being migrated in a sorted order - an assumption loosely based on me finding the following bit of https://github.com/getporter/porter/blob/release/v1/pkg/storage/migrations/migration.go#L224-L226
Perhaps this sorting should be done prior to iterating the claims? https://github.com/getporter/porter/blob/release/v1/pkg/storage/migrations/migration.go#L218-L219
To Reproduce
TBD
Steps to reproduce the behavior:
- Run
... - Use this porter.yaml from this repository or gist
- Run this porter command
... - See error
Expected behavior
Installations should end up with the correct state after migration
Porter Command and Output
[root@testserver old-porter-home]# PORTER_HOME=. ./porter list
NAME CREATED MODIFIED LAST ACTION LAST STATUS
test-bundle1 2022-06-22 2022-06-22 upgrade succeeded
test-bundle3 2022-09-02 2022-09-02 upgrade succeeded
test-bundle2 2022-06-22 2022-06-22 upgrade succeeded
[root@testserver old-porter-home]# PORTER_HOME=. ./porter show test-bundle1
Name: test-bundle1
Created: 2021-11-15
Modified: 2022-06-22
Outputs:
--------------------------------------------------------------------------------
Name Type Value
--------------------------------------------------------------------------------
io.cnab.outputs.invocationImageLogs string executing upgrade action from
test-bundle1 (installati...
History:
--------------------------------------------------------------------------
Run ID Action Timestamp Status Has Logs
--------------------------------------------------------------------------
01FMHGM6BSH4CKVKE0G0T7S4CY install 2021-11-15 succeeded true
01FPA38KVF5MJSGHAZETCQ792V upgrade 2021-12-07 succeeded true
01FPW0K1A066WGW4P1MMA10ZMQ upgrade 2021-12-14 failed true
01FPW0N9FAMPX7R4KQK4NZPC0M upgrade 2021-12-14 failed true
01FPW0XFKEM2K8PWH0XJ2Q5M98 uninstall 2021-12-14 succeeded true
01FPW0Y3EJQ1CJNW5E58502Y5N install 2021-12-14 succeeded true
01FPZ67EVWPMXZGRNX1069TNKZ upgrade 2021-12-15 succeeded true
01FXZ0KMEV92B8GSYHN1E2RW9D upgrade 2022-03-12 succeeded true
01G563RFRHZQ6TS3GYM2P6SJXT upgrade 2022-06-10 succeeded true
01G65TF7DN1RY4V2RQA10XQCRT upgrade 2022-06-22 succeeded true
.. insert migration here ..
[root@testserver ~]# porter -n test list
----------------------------------------------------------------------------------------
NAMESPACE NAME VERSION STATE STATUS MODIFIED
----------------------------------------------------------------------------------------
test test-bundle1 1.0.0 uninstalled succeeded 2022-06-22
test test-bundle2 0.1.1 defined succeeded 2022-06-22
test test-bundle3 3.0.0 installed succeeded 2022-09-02
[root@testserver ~]# porter -n test show test-bundle1 -o yaml
schemaType: Installation
schemaVersion: 1.0.2
id: 01FMHGM6BSH4CKVKE0G0T7S4CY
name: test-bundle1
namespace: test
bundle: {}
status:
runId: 01G65TF7DN1RY4V2RQA10XQCRT
action: upgrade
resultId: 01G65TG6GJ211ZNE00GSM250WV
resultStatus: succeeded
created: 2021-11-15T11:00:04.217318663+01:00
modified: 2022-06-22T15:43:46.869040797+02:00
installed: 2021-12-14T09:30:11.768736182+01:00
uninstalled: 2021-12-14T09:28:40.520278737+01:00
..
Version
Copy the output of porter version below
porter v1.0.0-rc.1 (8e005d5c)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (15 by maintainers)
Yes, the fix proposed in PR #2354 would resolve #2313 as well.