Skip to content

Commit 85bf253

Browse files
committed
If codegen artifact already exists:
- DRY_RUN=true -> continue with notice. - otherwise preserve existing recovery/fail logic.
1 parent df9ccca commit 85bf253

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

CI/release/resolve-release-versions.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ previous_generators_version="${PREVIOUS_GENERATORS_VERSION:-}"
1111
bootstrap_codegen_version="${CODEGEN_GENERATORS_BOOTSTRAP_VERSION:-}"
1212
generators_existing_behavior="${GENERATORS_EXISTING_BEHAVIOR:-skip}"
1313
skip_maven_deploy="${SKIP_MAVEN_DEPLOY:-false}"
14+
dry_run="${DRY_RUN:-false}"
1415
next_codegen_snapshot_version="${NEXT_CODEGEN_SNAPSHOT_VERSION:-}"
1516

1617
[[ "${release_generators}" == "true" || "${release_generators}" == "false" ]] || fail "RELEASE_GENERATORS must be true or false"
@@ -27,7 +28,9 @@ require_snapshot_version "NEXT_CODEGEN_SNAPSHOT_VERSION" "${next_codegen_snapsho
2728
codegen_exists="false"
2829
if release_artifact_exists "${CODEGEN_ARTIFACT}" "${codegen_version}"; then
2930
codegen_exists="true"
30-
if [[ "${skip_maven_deploy}" != "true" ]]; then
31+
if [[ "${dry_run}" == "true" ]]; then
32+
notice "Codegen artifact ${CODEGEN_ARTIFACT}:${codegen_version} already exists; continuing because DRY_RUN=true."
33+
elif [[ "${skip_maven_deploy}" != "true" ]]; then
3134
fail "Codegen artifact ${CODEGEN_ARTIFACT}:${codegen_version} already exists in Maven Central. Rerun with skip_maven_deploy=true only for recovery."
3235
fi
3336
fi
@@ -53,7 +56,7 @@ if [[ "${release_generators}" == "true" ]]; then
5356
notice "Generator artifact ${generators_version} does not exist; generator deploy is required."
5457
fi
5558

56-
if [[ "${generators_deploy_needed}" == "true" && "${skip_maven_deploy}" == "true" ]]; then
59+
if [[ "${generators_deploy_needed}" == "true" && "${skip_maven_deploy}" == "true" && "${dry_run}" != "true" ]]; then
5760
fail "Generator artifact ${generators_version} does not exist, but skip_maven_deploy=true would skip publishing it. Publish generators first or rerun without skip_maven_deploy."
5861
fi
5962

@@ -82,7 +85,7 @@ if [[ "${release_generators}" == "true" ]]; then
8285
fi
8386
assert_maven_resolves "io.swagger.codegen.v3:${GENERATORS_ARTIFACT}:${bootstrap_generators_version}"
8487

85-
if [[ "${generators_deploy_needed}" == "true" && "${DRY_RUN:-false}" == "true" ]]; then
88+
if [[ "${generators_deploy_needed}" == "true" && "${dry_run}" == "true" ]]; then
8689
codegen_build_generators_version="${bootstrap_generators_version}"
8790
notice "Dry run will build codegen with bootstrap generators ${codegen_build_generators_version}; release deploy will use ${generators_version} after generators are published."
8891
else

0 commit comments

Comments
 (0)