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

Feat: Upgrade from tags and fix issue with legacy IssuerRevRegRecords [<=v0.5.2] #2486

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 19 additions & 0 deletions UpgradingACA-Py.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ is high (such as a "resave connections" upgrade to a deployment with many, many
connections), you may want to do a test upgrade offline first, to see if there
is likely to be a service disruption during the upgrade. Plan accordingly!

## Tagged upgrades
Upgrades are defined in the [Upgrade Definition YML file], in addition to specifying upgrade actions by version they can also be specified by named tags. Unlike version based upgrades where all applicable version based actions will be performed based upon sorted order of versions, with named tags only actions corresponding to provided tags will be performed. Note: `--force-upgrade` is required when running name tags based upgrade [i.e. provding `--named-tag`]

Tags are specfied in YML file as below:
```
fix_issue_rev_reg:
fix_issue_rev_reg_records: true
```

Example
```
./scripts/run_docker upgrade --force-upgrade --named-tag fix_issue_rev_reg

In case, running multiple tags [say test1 & test2]:
./scripts/run_docker upgrade --force-upgrade --named-tag test1 --named-tag test2
```



## Exceptions

There are a couple of upgrade exception conditions to consider, as outlined
Expand Down
4 changes: 3 additions & 1 deletion aries_cloudagent/commands/default_version_upgrade_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ v0.7.1:
v0.7.0:
update_existing_records: false
v0.6.0:
update_existing_records: false
update_existing_records: false
fix_issue_rev_reg:
fix_issue_rev_reg_records: true
42 changes: 41 additions & 1 deletion aries_cloudagent/commands/tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,44 @@ async def test_upgrade_callable(self):
}
)

async def test_upgrade_callable_named_tag(self):
version_storage_record = await self.storage.find_record(
type_filter="acapy_version", tag_query={}
)
await self.storage.delete_record(version_storage_record)
with async_mock.patch.object(
test_module,
"wallet_config",
async_mock.CoroutineMock(
return_value=(
self.profile,
async_mock.CoroutineMock(did="public DID", verkey="verkey"),
)
),
), async_mock.patch.object(
test_module.yaml,
"safe_load",
async_mock.MagicMock(
return_value={
"v0.7.2": {
"resave_records": {
"base_record_path": [
"aries_cloudagent.connections.models.conn_record.ConnRecord"
]
},
"update_existing_records": True,
},
"fix_issue_rev_reg": {"fix_issue_rev_reg_records": True},
}
),
):
await test_module.upgrade(
settings={
"upgrade.named_tags": ["fix_issue_rev_reg"],
"upgrade.force_upgrade": True,
}
)

async def test_upgrade_x_same_version(self):
version_storage_record = await self.storage.find_record(
type_filter="acapy_version", tag_query={}
Expand Down Expand Up @@ -169,7 +207,9 @@ async def test_upgrade_missing_from_version(self):
"upgrade.config_path": "./aries_cloudagent/commands/default_version_upgrade_config.yml",
}
)
assert "No upgrade from version found in wallet or" in str(ctx.exception)
assert "Error during upgrade: No upgrade from version or tags found" in str(
ctx.exception
)

async def test_upgrade_x_callable_not_set(self):
version_storage_record = await self.storage.find_record(
Expand Down
Loading