After importing data from an old Electric CloudBees CD (CloudBees Flow) server to a new one, errors like these started to appear:
Step error [CorruptCredential]: corrupted credentials, possibly due to a mismatched passkey file
Credentials are encrypted using the server passkey. When data is directly transported from one server to another, either through a database dump or ectool import, you will need to transfer the previous server’s passkey as well to decrypt these credentials.
Note that if you switch out the passkey, any credentials and passwords on the server created using the current passkey will be invalidated.
Back up the current /conf/passkey file, and copy over the passkey from the old server instance.
ectool setDatabaseConfigurationto enforce the new passkey and re-configure the database password with it, then restart the server.
ectool setDatabaseConfiguration --databaseType --hostName --databaseName --userName --password --ignoreServerMismatch true `--ignorePasskeyMismatch true`
Alternatively, restart the server right after replacing the file, and wait for prompts to come up to set your DB configs in the UI. You will need to first re-enter the DB configurations, then ignore passkey mismatch after that to push this passkey file to the DB.
After the passkey change, encrypted sessions will be invalidated, which you may need to clear. You can do this manually, or by restarting the server again.