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

Mutable artifact versions via DRAFT artifact version state #5330

Merged
merged 12 commits into from
Oct 15, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-autoapprove.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: pull_request_target

jobs:
auto-approve:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write
if: github.actor == 'dependabot[bot]'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-automerge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:

jobs:
dependabot:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:
jobs:
prepare-integration-tests:
name: Prepare for Integration Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Show Actor
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:

prepare-ui-tests:
name: Prepare for UI Integration Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Show Actor
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:

integration-tests-h2:
name: Integration Tests H2
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: prepare-integration-tests
steps:
- name: Checkout Code
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:

integration-tests-postgresql:
name: Integration Tests Postgresql
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: prepare-integration-tests
steps:
- name: Checkout Code
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:

integration-tests-kafkasql:
name: Integration Tests KafkaSql
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: prepare-integration-tests
steps:
- name: Checkout Code
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:

integration-tests-ui:
name: Integration Tests UI
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: [prepare-ui-tests, prepare-integration-tests]
steps:
- name: Checkout Code
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:

integration-tests-legacy-v2:
name: Integration Tests Legacy V2
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: prepare-integration-tests
steps:
- name: Checkout Registry 2.5
Expand Down Expand Up @@ -369,7 +369,7 @@ jobs:

build-examples:
name: Build and Run Application examples
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: prepare-integration-tests
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-snapshot-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:
jobs:
tests:
name: Operator Basic tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
publish-docs:
if: github.repository_owner == 'Apicurio'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Apicurio Website Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ concurrency:
jobs:
lint:
name: Qodana
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: >
github.repository_owner == 'Apicurio' && contains(github.event.*.labels.*.name, 'QODANA')
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/registry-rhbq-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
jobs:
build:
name: Build Project
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio'
steps:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
release-images:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 120
env:
RELEASE_TYPE: release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-maven-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
release-maven:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 30
env:
RELEASE_TYPE: release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-sdk-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
release-sdk:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
env:
RELEASE_TYPE: release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-sdk-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
release-sdk:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
env:
RELEASE_TYPE: release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-sdk-typescript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
release-sdk:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
env:
RELEASE_TYPE: release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
default: 'main'
jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio'
env:
IS_PRE_RELEASE: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tool-exportV1-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
update-openapi:
name: Update OpenAPI
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio'
steps:
- name: Apicurio Registry Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
update-website:
if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.'))
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Apicurio Website Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
validate:
name: Validate Docs
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:
jobs:
build-verify:
name: Verify Application Build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:

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

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

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

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

notify-sdk:
if: github.repository_owner == 'Apicurio' && github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
language: [ js ]
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/io/apicurio/registry/auth/AuthConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public class AuthConfig {
Logger log;

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

@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")
@ConfigProperty(name = "apicurio.authn.basic-client-credentials.enabled", defaultValue = "false")
@Info(category = "auth", description = "Enable basic auth client credentials", availableSince = "0.1.18-SNAPSHOT", registryAvailableSince = "2.1.0.Final", studioAvailableSince = "1.0.0")
@Info(category = "auth", description = "Enable basic auth client credentials", availableSince = "0.1.18", registryAvailableSince = "2.1.0.Final", studioAvailableSince = "1.0.0")
Supplier<Boolean> basicClientCredentialsAuthEnabled;

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

@ConfigProperty(name = "apicurio.auth.role-based-authorization", defaultValue = "false")
Expand Down Expand Up @@ -96,7 +96,7 @@ public class AuthConfig {
String adminOverrideClaimValue;

@ConfigProperty(name = "apicurio.auth.admin-override.user", defaultValue = "admin")
@Info(category = "auth", description = "Auth admin override user name", availableSince = "3.0.0.Final")
@Info(category = "auth", description = "Auth admin override user name", availableSince = "3.0.0")
String adminOverrideUser;

@PostConstruct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ protected ArtifactVersionMetaDataDto createOrUpdateArtifact(String artifactId, S
.contentType(contentType).references(parsedReferences).build();

res = storage.createArtifact(groupId, artifactId, artifactType, artifactMetaData, null,
firstVersionContent, firstVersionMetaData, null, false).getValue();
firstVersionContent, firstVersionMetaData, null, false, false).getValue();
} else {
TypedContent typedSchemaContent = TypedContent.create(schemaContent, contentType);
rulesService.applyRules(groupId, artifactId, artifactType, typedSchemaContent,
RuleApplicationType.UPDATE, artifactReferences, resolvedReferences);
ContentWrapperDto versionContent = ContentWrapperDto.builder().content(schemaContent)
.contentType(contentType).references(parsedReferences).build();
res = storage.createArtifactVersion(groupId, artifactId, null, artifactType, versionContent,
EditableVersionMetaDataDto.builder().build(), List.of(), false);
EditableVersionMetaDataDto.builder().build(), List.of(), false, false);
}
} catch (RuleViolationException ex) {
if (ex.getRuleType() == RuleType.VALIDITY) {
Expand Down Expand Up @@ -238,7 +238,7 @@ protected boolean isArtifactActive(String artifactId, String groupId) {
protected String getLatestArtifactVersionForSubject(String artifactId, String groupId) {
try {
GAV latestGAV = storage.getBranchTip(new GA(groupId, artifactId), BranchId.LATEST,
RetrievalBehavior.SKIP_DISABLED_LATEST);
RetrievalBehavior.ACTIVE_STATES);
return latestGAV.getRawVersionId();
} catch (ArtifactNotFoundException ex) {
throw new VersionNotFoundException(groupId, artifactId, "latest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import io.apicurio.registry.metrics.health.liveness.ResponseErrorLivenessCheck;
import io.apicurio.registry.metrics.health.readiness.ResponseTimeoutReadinessCheck;
import io.apicurio.registry.model.GA;
import io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior;
import io.apicurio.registry.storage.dto.ArtifactVersionMetaDataDto;
import io.apicurio.registry.storage.dto.EditableVersionMetaDataDto;
import io.apicurio.registry.storage.dto.StoredArtifactVersionDto;
import io.apicurio.registry.storage.error.ArtifactNotFoundException;
import io.apicurio.registry.storage.error.InvalidArtifactTypeException;
Expand All @@ -38,8 +38,6 @@

import static io.apicurio.common.apps.logging.audit.AuditingConstants.KEY_ARTIFACT_ID;
import static io.apicurio.common.apps.logging.audit.AuditingConstants.KEY_VERSION;
import static io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior.DEFAULT;
import static io.apicurio.registry.storage.RegistryStorage.RetrievalBehavior.SKIP_DISABLED_LATEST;

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

List<Integer> rval;
if (fdeleted) {
rval = storage.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(), DEFAULT)
rval = storage
.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(),
RetrievalBehavior.NON_DRAFT_STATES)
.stream().map(VersionUtil::toLong).map(converter::convertUnsigned).sorted()
.collect(Collectors.toList());
} else {
rval = storage
.getArtifactVersions(ga.getRawGroupIdWithNull(), ga.getRawArtifactId(),
SKIP_DISABLED_LATEST)
RetrievalBehavior.ACTIVE_STATES)
.stream().map(VersionUtil::toLong).map(converter::convertUnsigned).sorted()
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -190,9 +190,8 @@ private String processDeleteVersion(String artifactId, String versionString, Str
if (avmd.getState().equals(VersionState.DISABLED)) {
throw new SchemaSoftDeletedException("Schema is already soft deleted");
} else {
EditableVersionMetaDataDto emd = EditableVersionMetaDataDto.builder()
.state(VersionState.DISABLED).build();
storage.updateArtifactVersionMetaData(groupId, artifactId, version, emd);
storage.updateArtifactVersionState(groupId, artifactId, version, VersionState.DISABLED,
false);
}
}
return version;
Expand Down
Loading
Loading