Skip to content

Commit 94ea1f0

Browse files
authored
Mutable artifact versions via DRAFT artifact version state (#5330)
* Implemented basic support for DRAFT (mutable) artifact versions * Updated REST API to support searching for versions by state * Formatting * Regenerate go-sdk and fix generate.sh to put kiota_tmp into ./target * Added support for state changes from DRAFT to ENABLED * Improvements/tweaks to DRAFT content * Code reformatting * Add a UI label for draft, deprecated, and disabled versions * Added new "drafts" system branch * Ensure that ccompat and v2 APIs do not return DRAFT content * Minor fixes while debugging an environmental issue that was resulting in test failures * Update all workflows to use a newer ubuntu image
1 parent 145375d commit 94ea1f0

File tree

86 files changed

+2198
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2198
-432
lines changed

.github/workflows/dependabot-autoapprove.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: pull_request_target
44

55
jobs:
66
auto-approve:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-22.04
88
permissions:
99
pull-requests: write
1010
if: github.actor == 'dependabot[bot]'

.github/workflows/dependabot-automerge.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88

99
jobs:
1010
dependabot:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
if: ${{ github.actor == 'dependabot[bot]' }}
1313
steps:
1414
- name: Dependabot metadata

.github/workflows/integration-tests.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ concurrency:
2424
jobs:
2525
prepare-integration-tests:
2626
name: Prepare for Integration Tests
27-
runs-on: ubuntu-20.04
27+
runs-on: ubuntu-22.04
2828
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
2929
steps:
3030
- name: Show Actor
@@ -67,7 +67,7 @@ jobs:
6767
6868
prepare-ui-tests:
6969
name: Prepare for UI Integration Tests
70-
runs-on: ubuntu-20.04
70+
runs-on: ubuntu-22.04
7171
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
7272
steps:
7373
- name: Show Actor
@@ -119,7 +119,7 @@ jobs:
119119
120120
integration-tests-h2:
121121
name: Integration Tests H2
122-
runs-on: ubuntu-20.04
122+
runs-on: ubuntu-22.04
123123
needs: prepare-integration-tests
124124
steps:
125125
- name: Checkout Code
@@ -164,7 +164,7 @@ jobs:
164164

165165
integration-tests-postgresql:
166166
name: Integration Tests Postgresql
167-
runs-on: ubuntu-20.04
167+
runs-on: ubuntu-22.04
168168
needs: prepare-integration-tests
169169
steps:
170170
- name: Checkout Code
@@ -210,7 +210,7 @@ jobs:
210210

211211
integration-tests-kafkasql:
212212
name: Integration Tests KafkaSql
213-
runs-on: ubuntu-20.04
213+
runs-on: ubuntu-22.04
214214
needs: prepare-integration-tests
215215
steps:
216216
- name: Checkout Code
@@ -258,7 +258,7 @@ jobs:
258258

259259
integration-tests-ui:
260260
name: Integration Tests UI
261-
runs-on: ubuntu-20.04
261+
runs-on: ubuntu-22.04
262262
needs: [prepare-ui-tests, prepare-integration-tests]
263263
steps:
264264
- name: Checkout Code
@@ -331,7 +331,7 @@ jobs:
331331

332332
integration-tests-legacy-v2:
333333
name: Integration Tests Legacy V2
334-
runs-on: ubuntu-20.04
334+
runs-on: ubuntu-22.04
335335
needs: prepare-integration-tests
336336
steps:
337337
- name: Checkout Registry 2.5
@@ -369,7 +369,7 @@ jobs:
369369

370370
build-examples:
371371
name: Build and Run Application examples
372-
runs-on: ubuntu-20.04
372+
runs-on: ubuntu-22.04
373373
needs: prepare-integration-tests
374374
steps:
375375
- name: Checkout Code with Ref '${{ github.ref }}'

.github/workflows/maven-snapshot-release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: workflow_dispatch
33

44
jobs:
55
deploy:
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-22.04
77
steps:
88
- name: Checkout
99
uses: actions/checkout@v3

.github/workflows/operator.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ concurrency:
2424
jobs:
2525
tests:
2626
name: Operator Basic tests
27-
runs-on: ubuntu-latest
27+
runs-on: ubuntu-22.04
2828
steps:
2929
- name: Checkout Code
3030
uses: actions/checkout@v3

.github/workflows/publish-docs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
publish-docs:
1111
if: github.repository_owner == 'Apicurio'
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
steps:
1414

1515
- name: Apicurio Website Checkout

.github/workflows/qodana.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
jobs:
2323
lint:
2424
name: Qodana
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-22.04
2626
if: >
2727
github.repository_owner == 'Apicurio' && contains(github.event.*.labels.*.name, 'QODANA')
2828
permissions:

.github/workflows/registry-rhbq-build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
build:
2828
name: Build Project
29-
runs-on: ubuntu-20.04
29+
runs-on: ubuntu-22.04
3030
if: github.repository_owner == 'Apicurio'
3131
steps:
3232

.github/workflows/release-images.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
release-images:
2121
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
timeout-minutes: 120
2424
env:
2525
RELEASE_TYPE: release

.github/workflows/release-maven-artifacts.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
release-maven:
2121
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
timeout-minutes: 30
2424
env:
2525
RELEASE_TYPE: release

.github/workflows/release-sdk-go.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
release-sdk:
2121
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
timeout-minutes: 15
2424
env:
2525
RELEASE_TYPE: release

.github/workflows/release-sdk-python.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
release-sdk:
2121
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
timeout-minutes: 15
2424
env:
2525
RELEASE_TYPE: release

.github/workflows/release-sdk-typescript.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
release-sdk:
2121
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
22-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2323
timeout-minutes: 15
2424
env:
2525
RELEASE_TYPE: release

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
default: 'main'
1515
jobs:
1616
release:
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-22.04
1818
if: github.repository_owner == 'Apicurio'
1919
env:
2020
IS_PRE_RELEASE: false

.github/workflows/tool-exportV1-release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Set up JDK 17

.github/workflows/update-openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
update-openapi:
1212
name: Update OpenAPI
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-22.04
1414
if: github.repository_owner == 'Apicurio'
1515
steps:
1616
- name: Apicurio Registry Checkout

.github/workflows/update-website.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
update-website:
99
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
steps:
1212

1313
- name: Apicurio Website Checkout

.github/workflows/validate-docs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
validate:
1212
name: Validate Docs
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
steps:
1515
- name: Checkout Code
1616
uses: actions/checkout@v3

.github/workflows/validate-openapi.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
validate:
1111
name: Validate
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v3
1515
with:

.github/workflows/verify.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ concurrency:
2424
jobs:
2525
build-verify:
2626
name: Verify Application Build
27-
runs-on: ubuntu-latest
27+
runs-on: ubuntu-22.04
2828
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
2929
steps:
3030
- name: Checkout Code with Ref '${{ github.ref }}'
@@ -103,7 +103,7 @@ jobs:
103103

104104
build-verify-ui:
105105
name: Verify UI Build
106-
runs-on: ubuntu-latest
106+
runs-on: ubuntu-22.04
107107
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
108108
steps:
109109
- name: Checkout Code with Ref '${{ github.ref }}'
@@ -203,7 +203,7 @@ jobs:
203203

204204
build-native-images:
205205
name: Build and Test Native images
206-
runs-on: ubuntu-latest
206+
runs-on: ubuntu-22.04
207207
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
208208
steps:
209209
- name: Checkout Code with Ref '${{ github.ref }}'
@@ -307,7 +307,7 @@ jobs:
307307

308308
build-verify-python-sdk:
309309
name: Verify Python SDK
310-
runs-on: ubuntu-latest
310+
runs-on: ubuntu-22.04
311311
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
312312
steps:
313313
- name: Checkout Code with Ref '${{ github.ref }}'
@@ -344,7 +344,7 @@ jobs:
344344

345345
build-verify-go-sdk:
346346
name: Verify Go SDK
347-
runs-on: ubuntu-latest
347+
runs-on: ubuntu-22.04
348348
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
349349
steps:
350350
- name: Checkout Code with Ref '${{ github.ref }}'
@@ -371,7 +371,7 @@ jobs:
371371

372372
notify-sdk:
373373
if: github.repository_owner == 'Apicurio' && github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
374-
runs-on: ubuntu-latest
374+
runs-on: ubuntu-22.04
375375
strategy:
376376
matrix:
377377
language: [ js ]

app/src/main/java/io/apicurio/registry/auth/AuthConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ public class AuthConfig {
1717
Logger log;
1818

1919
@ConfigProperty(name = "quarkus.oidc.tenant-enabled", defaultValue = "false")
20-
@Info(category = "auth", description = "Enable auth", availableSince = "0.1.18-SNAPSHOT", registryAvailableSince = "2.0.0.Final", studioAvailableSince = "1.0.0")
20+
@Info(category = "auth", description = "Enable auth", availableSince = "0.1.18", registryAvailableSince = "2.0.0.Final", studioAvailableSince = "1.0.0")
2121
boolean oidcAuthEnabled;
2222

2323
@Dynamic(label = "HTTP basic authentication", description = "When selected, users are permitted to authenticate using HTTP basic authentication (in addition to OAuth).", requires = "apicurio.authn.enabled=true")
2424
@ConfigProperty(name = "apicurio.authn.basic-client-credentials.enabled", defaultValue = "false")
25-
@Info(category = "auth", description = "Enable basic auth client credentials", availableSince = "0.1.18-SNAPSHOT", registryAvailableSince = "2.1.0.Final", studioAvailableSince = "1.0.0")
25+
@Info(category = "auth", description = "Enable basic auth client credentials", availableSince = "0.1.18", registryAvailableSince = "2.1.0.Final", studioAvailableSince = "1.0.0")
2626
Supplier<Boolean> basicClientCredentialsAuthEnabled;
2727

2828
@ConfigProperty(name = "quarkus.http.auth.basic", defaultValue = "false")
29-
@Info(category = "auth", description = "Enable basic auth", availableSince = "1.1.X-SNAPSHOT", registryAvailableSince = "3.X.X.Final", studioAvailableSince = "1.0.0")
29+
@Info(category = "auth", description = "Enable basic auth", availableSince = "1.1.x", registryAvailableSince = "3.0.0", studioAvailableSince = "1.0.0")
3030
boolean basicAuthEnabled;
3131

3232
@ConfigProperty(name = "apicurio.auth.role-based-authorization", defaultValue = "false")

app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/AbstractResource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ protected ArtifactVersionMetaDataDto createOrUpdateArtifact(String artifactId, S
127127
.contentType(contentType).references(parsedReferences).build();
128128

129129
res = storage.createArtifact(groupId, artifactId, artifactType, artifactMetaData, null,
130-
firstVersionContent, firstVersionMetaData, null, false).getValue();
130+
firstVersionContent, firstVersionMetaData, null, false, false).getValue();
131131
} else {
132132
TypedContent typedSchemaContent = TypedContent.create(schemaContent, contentType);
133133
rulesService.applyRules(groupId, artifactId, artifactType, typedSchemaContent,
134134
RuleApplicationType.UPDATE, artifactReferences, resolvedReferences);
135135
ContentWrapperDto versionContent = ContentWrapperDto.builder().content(schemaContent)
136136
.contentType(contentType).references(parsedReferences).build();
137137
res = storage.createArtifactVersion(groupId, artifactId, null, artifactType, versionContent,
138-
EditableVersionMetaDataDto.builder().build(), List.of(), false);
138+
EditableVersionMetaDataDto.builder().build(), List.of(), false, false);
139139
}
140140
} catch (RuleViolationException ex) {
141141
if (ex.getRuleType() == RuleType.VALIDITY) {
@@ -238,7 +238,7 @@ protected boolean isArtifactActive(String artifactId, String groupId) {
238238
protected String getLatestArtifactVersionForSubject(String artifactId, String groupId) {
239239
try {
240240
GAV latestGAV = storage.getBranchTip(new GA(groupId, artifactId), BranchId.LATEST,
241-
RetrievalBehavior.SKIP_DISABLED_LATEST);
241+
RetrievalBehavior.ACTIVE_STATES);
242242
return latestGAV.getRawVersionId();
243243
} catch (ArtifactNotFoundException ex) {
244244
throw new VersionNotFoundException(groupId, artifactId, "latest");

app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectVersionsResourceImpl.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import io.apicurio.registry.metrics.health.liveness.ResponseErrorLivenessCheck;
2020
import io.apicurio.registry.metrics.health.readiness.ResponseTimeoutReadinessCheck;
2121
import io.apicurio.registry.model.GA;
22+
import io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior;
2223
import io.apicurio.registry.storage.dto.ArtifactVersionMetaDataDto;
23-
import io.apicurio.registry.storage.dto.EditableVersionMetaDataDto;
2424
import io.apicurio.registry.storage.dto.StoredArtifactVersionDto;
2525
import io.apicurio.registry.storage.error.ArtifactNotFoundException;
2626
import io.apicurio.registry.storage.error.InvalidArtifactTypeException;
@@ -38,8 +38,6 @@
3838

3939
import static io.apicurio.common.apps.logging.audit.AuditingConstants.KEY_ARTIFACT_ID;
4040
import static io.apicurio.common.apps.logging.audit.AuditingConstants.KEY_VERSION;
41-
import static io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior.DEFAULT;
42-
import static io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior.SKIP_DISABLED_LATEST;
4341

4442
@Interceptors({ ResponseErrorLivenessCheck.class, ResponseTimeoutReadinessCheck.class })
4543
@Logged
@@ -56,13 +54,15 @@ public List<Integer> listVersions(String subject, String groupId, Boolean delete
5654

5755
List<Integer> rval;
5856
if (fdeleted) {
59-
rval = storage.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(), DEFAULT)
57+
rval = storage
58+
.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(),
59+
RetrievalBehavior.NON_DRAFT_STATES)
6060
.stream().map(VersionUtil::toLong).map(converter::convertUnsigned).sorted()
6161
.collect(Collectors.toList());
6262
} else {
6363
rval = storage
6464
.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(),
65-
SKIP_DISABLED_LATEST)
65+
RetrievalBehavior.ACTIVE_STATES)
6666
.stream().map(VersionUtil::toLong).map(converter::convertUnsigned).sorted()
6767
.collect(Collectors.toList());
6868
}
@@ -190,9 +190,8 @@ private String processDeleteVersion(String artifactId, String versionString, Str
190190
if (avmd.getState().equals(VersionState.DISABLED)) {
191191
throw new SchemaSoftDeletedException("Schema is already soft deleted");
192192
} else {
193-
EditableVersionMetaDataDto emd = EditableVersionMetaDataDto.builder()
194-
.state(VersionState.DISABLED).build();
195-
storage.updateArtifactVersionMetaData(groupId, artifactId, version, emd);
193+
storage.updateArtifactVersionState(groupId, artifactId, version, VersionState.DISABLED,
194+
false);
196195
}
197196
}
198197
return version;

0 commit comments

Comments
 (0)