From 37ed2723d584e0149da28a9f6b0eabc1b622ba40 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Thu, 15 Aug 2024 09:55:56 -0700 Subject: [PATCH 01/17] Script to create release JSON schemas --- scripts/release_schemas/_translator.py | 95 +++++++++++ scripts/release_schemas/generator.py | 151 ++++++++++++++++++ .../application_subnets.json | 6 +- 3 files changed, 247 insertions(+), 5 deletions(-) create mode 100644 scripts/release_schemas/_translator.py create mode 100755 scripts/release_schemas/generator.py diff --git a/scripts/release_schemas/_translator.py b/scripts/release_schemas/_translator.py new file mode 100644 index 0000000000..18501c994c --- /dev/null +++ b/scripts/release_schemas/_translator.py @@ -0,0 +1,95 @@ +""" +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: MIT-0 +""" + +from __future__ import annotations + +# Translate cfn-lint unique keywords into json schema keywords +import logging +from collections import deque +from typing import Any, Iterator + +from cfnlint.schema import PROVIDER_SCHEMA_MANAGER + +logger = logging.getLogger(__name__) + + +def required_xor(properties: list[str]) -> dict[str, list[Any]]: + + return {"oneOf": [{"required": [p]} for p in properties]} + + +def dependent_excluded(properties: dict[str, list[str]]) -> dict[str, list[Any]]: + dependencies: dict[str, Any] = {"dependencies": {}} + for prop, exclusions in properties.items(): + dependencies["dependencies"][prop] = {"not": {"anyOf": []}} + for exclusion in exclusions: + dependencies["dependencies"][prop]["not"]["anyOf"].append( + {"required": exclusion} + ) + + return dependencies + + +_keywords = { + "requiredXor": required_xor, + "dependentExcluded": dependent_excluded, +} + + +def _find_keywords(schema: Any) -> Iterator[deque[str | int]]: + + if isinstance(schema, list): + for i, item in enumerate(schema): + for path in _find_keywords(item): + path.appendleft(i) + yield path + elif isinstance(schema, dict): + for key, value in schema.items(): + if key in _keywords: + yield deque([key, value]) + else: + for path in _find_keywords(value): + path.appendleft(key) + yield path + + +def translator(resource_type: str, region: str): + keywords = list( + _find_keywords( + PROVIDER_SCHEMA_MANAGER.get_resource_schema( + region=region, resource_type=resource_type + ).schema + ) + ) + + for keyword in keywords: + value = keyword.pop() + key = keyword.pop() + if not keyword: + path = "" + else: + path = f"/{'/'.join(str(k) for k in keyword)}" + + patch = [ + { + "op": "add", + "path": f"{path}/allOf", + "value": [], + } + ] + + logger.info(f"Patch {resource_type} add allOf for {key}") + PROVIDER_SCHEMA_MANAGER._schemas[region][resource_type].patch(patches=patch) + + patch = [ + { + "op": "remove", + "path": f"{path}/{key}", + }, + {"op": "add", "path": f"{path}/allOf/-", "value": _keywords[key](value)}, # type: ignore + ] + + logger.info(f"Patch {resource_type} replace for {key}") + PROVIDER_SCHEMA_MANAGER._schemas[region][resource_type].patch(patches=patch) diff --git a/scripts/release_schemas/generator.py b/scripts/release_schemas/generator.py new file mode 100755 index 0000000000..6000a93185 --- /dev/null +++ b/scripts/release_schemas/generator.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python +""" +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: MIT-0 +""" +import logging +from collections import deque +from pathlib import Path + +import _translator + +from cfnlint.helpers import REGIONS, ToPy, format_json_string, load_plugins +from cfnlint.schema import PROVIDER_SCHEMA_MANAGER + +logging.basicConfig( + level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" +) +logger = logging.getLogger(__name__) + + +def _get_schema_path(schema, path): + s = schema.schema + schema_path = deque([]) + while path: + key = path.popleft() + if key == "*": + schema_path.append("items") + s = s["items"] + else: + s = s["properties"][key] + schema_path.extend(["properties", key]) + + pointer = s.get("$ref") + if pointer: + _, s = schema.resolver.resolve(pointer) + schema_path = deque(pointer.split("/")[1:]) + + return schema_path + + +def _build_patch(path, patch): + if not path: + path_str = "/allOf" + else: + path_str = f"/{'/'.join(path)}/allOf" + + return ( + [ + { + "op": "add", + "path": path_str, + "value": [], + } + ], + [ + { + "op": "add", + "path": f"{path_str}/-", + "value": patch, + } + ], + ) + + +schemas = {} + +########################## +# +# Build the definitive list of all resource types across all regions +# +########################### + +for region in ["us-east-1"] + list((set(REGIONS) - set(["us-east-1"]))): + for resource_type in PROVIDER_SCHEMA_MANAGER.get_resource_types(region): + if resource_type in ["AWS::CDK::Metadata", "Module"]: + continue + if resource_type not in schemas: + schemas[resource_type] = region + + +########################## +# +# Merge in rule schemas into the resource schemas +# +########################### + +rules_folder = Path("src") / "cfnlint" / "rules" + +rules = load_plugins( + rules_folder, + name="CfnLintJsonSchema", + modules=( + "cfnlint.rules.jsonschema.CfnLintJsonSchema", + "cfnlint.rules.jsonschema.CfnLintJsonSchema.CfnLintJsonSchema", + ), +) + +for rule in rules: + if rule.__class__.__base__ == ( + "cfnlint.rules.jsonschema." + "CfnLintJsonSchemaRegional.CfnLintJsonSchemaRegional" + ): + continue + if not rule.id or rule.schema == {}: + continue + + for keyword in rule.keywords: + if not keyword.startswith("Resources/"): + continue + path = deque(keyword.split("/")) + + if len(path) < 3: + continue + + path.popleft() + resource_type = path.popleft() + resource_properties = path.popleft() + if resource_type not in schemas and resource_properties != "Properties": + continue + + schema_path = _get_schema_path( + PROVIDER_SCHEMA_MANAGER.get_resource_schema( + schemas[resource_type], resource_type + ), + path, + ) + all_of_patch, schema_patch = _build_patch(schema_path, rule.schema) + + PROVIDER_SCHEMA_MANAGER._schemas[schemas[resource_type]][resource_type].patch( + patches=all_of_patch + ) + PROVIDER_SCHEMA_MANAGER._schemas[schemas[resource_type]][resource_type].patch( + patches=schema_patch + ) + + logger.info(f"Patch {rule.id} for {resource_type} in {schemas[resource_type]}") + + +for resource_type, region in schemas.items(): + rt_py = ToPy(resource_type) + + _translator.translator(resource_type, region) + + with open(f"local/release_schemas/{rt_py.py}.json", "w") as f: + f.write( + format_json_string( + PROVIDER_SCHEMA_MANAGER.get_resource_schema( + region, resource_type + ).schema + ) + ) diff --git a/src/cfnlint/data/schemas/extensions/aws_elasticloadbalancingv2_loadbalancer/application_subnets.json b/src/cfnlint/data/schemas/extensions/aws_elasticloadbalancingv2_loadbalancer/application_subnets.json index 615983bd23..2011ec9cad 100644 --- a/src/cfnlint/data/schemas/extensions/aws_elasticloadbalancingv2_loadbalancer/application_subnets.json +++ b/src/cfnlint/data/schemas/extensions/aws_elasticloadbalancingv2_loadbalancer/application_subnets.json @@ -26,10 +26,6 @@ "Subnets": { "minItems": 2 } - }, - "requiredXor": [ - "Subnets", - "SubnetMappings" - ] + } } } From d80b07c19c09b481dd3697a033b9eb9c5b5a5ccf Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 10:40:03 -0700 Subject: [PATCH 02/17] Build release artfiacts --- .github/workflows/cd-release.yaml | 25 +++++++++++++++++++++++++ scripts/release_schemas/generator.py | 27 ++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cd-release.yaml diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml new file mode 100644 index 0000000000..4a34b215c8 --- /dev/null +++ b/.github/workflows/cd-release.yaml @@ -0,0 +1,25 @@ +name: "[CD] Create release" +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Build + run: scripts/release_schemas/create_cfn_schema_rule.py + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + build/schemas-cfnlint.zip + build/schemas-draft7.zip diff --git a/scripts/release_schemas/generator.py b/scripts/release_schemas/generator.py index 6000a93185..987441a6ae 100755 --- a/scripts/release_schemas/generator.py +++ b/scripts/release_schemas/generator.py @@ -4,6 +4,7 @@ SPDX-License-Identifier: MIT-0 """ import logging +import tarfile from collections import deque from pathlib import Path @@ -136,12 +137,29 @@ def _build_patch(path, patch): logger.info(f"Patch {rule.id} for {resource_type} in {schemas[resource_type]}") +build_dir = Path("build") +schemas_dir = build_dir / "schemas" +schemas_cfnlint_dir = schemas_dir / "cfnlint" +schemas_cfnlint_dir.mkdir(parents=True, exist_ok=True) + +schemas_draft7_dir = schemas_dir / "draft7" +schemas_draft7_dir.mkdir(parents=True, exist_ok=True) + for resource_type, region in schemas.items(): rt_py = ToPy(resource_type) + with open(schemas_cfnlint_dir / f"{rt_py.py}.json", "w") as f: + f.write( + format_json_string( + PROVIDER_SCHEMA_MANAGER.get_resource_schema( + region, resource_type + ).schema + ) + ) + _translator.translator(resource_type, region) - with open(f"local/release_schemas/{rt_py.py}.json", "w") as f: + with open(schemas_draft7_dir / f"{rt_py.py}.json", "w") as f: f.write( format_json_string( PROVIDER_SCHEMA_MANAGER.get_resource_schema( @@ -149,3 +167,10 @@ def _build_patch(path, patch): ).schema ) ) + +logger.info("Create schema package") +with tarfile.open(build_dir / "schemas-cfnlint.zip", "w:gz") as tar: + tar.add(schemas_cfnlint_dir, arcname="schemas") + +with tarfile.open(build_dir / "schemas-draft7.zip", "w:gz") as tar: + tar.add(schemas_draft7_dir, arcname="schemas") From e4b47840e923e965782b8b9471c9db02c1b660d9 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 10:43:14 -0700 Subject: [PATCH 03/17] Only run on v1 tags --- .github/workflows/cd-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 4a34b215c8..0670a5767b 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -2,7 +2,7 @@ name: "[CD] Create release" on: push: tags: - - "*" + - "v1.*" jobs: build: @@ -18,7 +18,7 @@ jobs: run: scripts/release_schemas/create_cfn_schema_rule.py - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/v1') with: files: | build/schemas-cfnlint.zip From d8f1ffc304482115a470e53c4cddcdd36f51dc8b Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 10:43:14 -0700 Subject: [PATCH 04/17] Only run on v1 tags --- .github/workflows/cd-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 0670a5767b..402111ba5a 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -2,7 +2,7 @@ name: "[CD] Create release" on: push: tags: - - "v1.*" + - "v1*" jobs: build: From 0868b7fecc2cc5d5478c2da0fa8c0affcd3cb6c7 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 10:59:47 -0700 Subject: [PATCH 05/17] Fix script file --- .github/workflows/cd-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 402111ba5a..173f491047 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -15,7 +15,7 @@ jobs: with: python-version: "3.x" - name: Build - run: scripts/release_schemas/create_cfn_schema_rule.py + run: scripts/release_schemas/generator.py - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') From e7352d0dbb4b9829537ec92a2de247bf44b0d83c Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 11:03:39 -0700 Subject: [PATCH 06/17] Install cfnlint with release --- .github/workflows/cd-release.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 173f491047..2ea1efece0 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -15,7 +15,9 @@ jobs: with: python-version: "3.x" - name: Build - run: scripts/release_schemas/generator.py + run: | + pip install -e . + scripts/release_schemas/generator.py - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') From 8dad0309b8927ecf66bb8aae56091d2e05acad02 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 11:19:49 -0700 Subject: [PATCH 07/17] Use PAT for creating release --- .github/workflows/cd-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 2ea1efece0..cc74c96565 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -22,6 +22,7 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') with: + token: ${{ secrets.GH_PAT }} files: | build/schemas-cfnlint.zip build/schemas-draft7.zip From c36b5d6ea230f8dacdbcc3241c6bb3ae24ebed0b Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 11:25:43 -0700 Subject: [PATCH 08/17] Set release name --- .github/workflows/cd-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index cc74c96565..be5149edf4 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -22,6 +22,7 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') with: + name: Release ${{ github.ref_name }} token: ${{ secrets.GH_PAT }} files: | build/schemas-cfnlint.zip From a6a13dabd23dd88aa1e6776f47f224f27fbe50b5 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 11:36:15 -0700 Subject: [PATCH 09/17] Autogenerate release notes --- .github/workflows/cd-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index be5149edf4..e1ca64cb9c 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -24,6 +24,7 @@ jobs: with: name: Release ${{ github.ref_name }} token: ${{ secrets.GH_PAT }} + generate_release_notes: true files: | build/schemas-cfnlint.zip build/schemas-draft7.zip From 4a6cc45cf2acca82ba3f9da966fc0859b179d120 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 13:27:32 -0700 Subject: [PATCH 10/17] Change title for mainteniance job --- .github/workflows/maintenance-v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maintenance-v1.yaml b/.github/workflows/maintenance-v1.yaml index b08f92b63f..4a6a91cf36 100644 --- a/.github/workflows/maintenance-v1.yaml +++ b/.github/workflows/maintenance-v1.yaml @@ -44,4 +44,4 @@ jobs: Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action delete-branch: true - title: chore(schemas) - Update CloudFormation schemas to ${{ steps.maintenance.outputs.date }} + title: Update CloudFormation schemas to ${{ steps.maintenance.outputs.date }} From 8a5f73772c839081acce75687a9d8d25e7f62a83 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 13:32:40 -0700 Subject: [PATCH 11/17] Format github actions --- .github/workflows/cd-release.yaml | 4 ++-- .github/workflows/ci-pr-coverage.yaml | 2 +- .github/workflows/ci-pr.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index e1ca64cb9c..6aabff056b 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -16,8 +16,8 @@ jobs: python-version: "3.x" - name: Build run: | - pip install -e . - scripts/release_schemas/generator.py + pip install -e . + scripts/release_schemas/generator.py - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') diff --git a/.github/workflows/ci-pr-coverage.yaml b/.github/workflows/ci-pr-coverage.yaml index 89b9fe9546..d8ed0a56b9 100644 --- a/.github/workflows/ci-pr-coverage.yaml +++ b/.github/workflows/ci-pr-coverage.yaml @@ -31,7 +31,7 @@ jobs: ref: ${{ github.event.workflow_run.head_sha }} path: repo_clone - name: Upload coverage report - if: '!cancelled()' + if: "!cancelled()" uses: codecov/codecov-action@v3 with: override_commit: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml index 8fab70662c..033b689187 100644 --- a/.github/workflows/ci-pr.yaml +++ b/.github/workflows/ci-pr.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 From 875182f1dfb31f937a85e8ccdf37d8e9bfcec724 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 13:34:46 -0700 Subject: [PATCH 12/17] Format github actions --- .github/workflows/maintenance-v1.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/maintenance-v1.yaml b/.github/workflows/maintenance-v1.yaml index 4a6a91cf36..4355411a7c 100644 --- a/.github/workflows/maintenance-v1.yaml +++ b/.github/workflows/maintenance-v1.yaml @@ -1,7 +1,7 @@ name: Automated Maintenance v1 on: schedule: - - cron: '0 0,6,12,18 * * *' + - cron: "0 0,6,12,18 * * *" workflow_dispatch: # Enables on-demand/manual triggering: https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow jobs: job: @@ -9,12 +9,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: 'main' + ref: "main" - uses: actions/setup-python@v5 with: python-version: 3 - - - id: maintenance + - id: maintenance run: | latest_sam_cli=`curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r .tag_name | cut -c 2-` latest=`curl "https://pypi.org/pypi/aws-sam-cli/$latest_sam_cli/json" -s | jq -r '.info.requires_dist[] | select(contains("aws-sam-translator"))' | cut -c 21-` From 778b4b04ad6d713942fc5b33727be948015b2884 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 15:10:30 -0700 Subject: [PATCH 13/17] Build a better Changelog --- .github/workflows/cd-release.yaml | 3 +- .../_translator.py | 0 scripts/release/changelog.py | 34 +++++++++++++++++++ .../{release_schemas => release}/generator.py | 0 4 files changed, 36 insertions(+), 1 deletion(-) rename scripts/{release_schemas => release}/_translator.py (100%) create mode 100755 scripts/release/changelog.py rename scripts/{release_schemas => release}/generator.py (100%) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index 6aabff056b..a46690871f 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -18,13 +18,14 @@ jobs: run: | pip install -e . scripts/release_schemas/generator.py + scripts/release_schemas/changelog.py --version ${{ github.ref_name }} - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') with: name: Release ${{ github.ref_name }} token: ${{ secrets.GH_PAT }} - generate_release_notes: true + body_path: ${{ github.workspace }}/build/CHANGELOG.txt files: | build/schemas-cfnlint.zip build/schemas-draft7.zip diff --git a/scripts/release_schemas/_translator.py b/scripts/release/_translator.py similarity index 100% rename from scripts/release_schemas/_translator.py rename to scripts/release/_translator.py diff --git a/scripts/release/changelog.py b/scripts/release/changelog.py new file mode 100755 index 0000000000..43015a44c1 --- /dev/null +++ b/scripts/release/changelog.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +""" +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: MIT-0 +""" + +import argparse + +# version = "v1.10.3" +from pathlib import Path + +parser = argparse.ArgumentParser() +parser.add_argument("--version") +args = parser.parse_args() + +with open("CHANGELOG.md", "r") as f: + text = f.read() + +output = [] + +for line in text.splitlines(): + + if line.startswith("### "): + if args.version == line[3:].strip(): + found = True + else: + break + else: + if found: + output.append(line) + +build_dir = Path("build") +with open(build_dir / "CHANGELOG.md", "w") as f: + f.write("\n".join(output)) diff --git a/scripts/release_schemas/generator.py b/scripts/release/generator.py similarity index 100% rename from scripts/release_schemas/generator.py rename to scripts/release/generator.py From f15328756dd9091a3ad7f982dd35ec9bdc8d8728 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 15:12:33 -0700 Subject: [PATCH 14/17] Smarter logic on changelog release --- scripts/release/changelog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release/changelog.py b/scripts/release/changelog.py index 43015a44c1..32cee23547 100755 --- a/scripts/release/changelog.py +++ b/scripts/release/changelog.py @@ -23,7 +23,7 @@ if line.startswith("### "): if args.version == line[3:].strip(): found = True - else: + elif found: break else: if found: From 9132100769cea7e9dbdafae0cc27e6d7da612ded Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 15:23:37 -0700 Subject: [PATCH 15/17] Isort and black --- scripts/release/changelog.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/release/changelog.py b/scripts/release/changelog.py index 32cee23547..5334212ab7 100755 --- a/scripts/release/changelog.py +++ b/scripts/release/changelog.py @@ -5,8 +5,6 @@ """ import argparse - -# version = "v1.10.3" from pathlib import Path parser = argparse.ArgumentParser() From 2606bea98c6a8c8cb3f5f0a0da38fe404d9be8c4 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 15:34:41 -0700 Subject: [PATCH 16/17] Update gha script location --- .github/workflows/cd-release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index a46690871f..d315d82a46 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -17,8 +17,8 @@ jobs: - name: Build run: | pip install -e . - scripts/release_schemas/generator.py - scripts/release_schemas/changelog.py --version ${{ github.ref_name }} + scripts/release/generator.py + scripts/release/changelog.py --version ${{ github.ref_name }} - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/v1') From d96f5a504c85030462a86e030d93ee29ba66edd3 Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 21 Aug 2024 15:44:25 -0700 Subject: [PATCH 17/17] Fix bodypath for release flow --- .github/workflows/cd-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index d315d82a46..65e20792d5 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -25,7 +25,7 @@ jobs: with: name: Release ${{ github.ref_name }} token: ${{ secrets.GH_PAT }} - body_path: ${{ github.workspace }}/build/CHANGELOG.txt + body_path: ${{ github.workspace }}/build/CHANGELOG.md files: | build/schemas-cfnlint.zip build/schemas-draft7.zip