From 89b1546b96a62299226678ab1229560fd631feec Mon Sep 17 00:00:00 2001 From: jamshale Date: Tue, 13 Aug 2024 16:26:16 -0700 Subject: [PATCH 1/2] Adjust auto release docs Signed-off-by: jamshale --- .github/workflows/create-release-pr.yaml | 34 +++++++++++++++++++----- .github/workflows/create-release.yaml | 4 +-- repo_manager.py | 24 +++++++++-------- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml index bf99f5b76..79815c7b9 100644 --- a/.github/workflows/create-release-pr.yaml +++ b/.github/workflows/create-release-pr.yaml @@ -187,7 +187,7 @@ jobs: continue fi cd $current_folder - poetry install --no-interaction --no-root --extras "aca-py" + poetry install --no-interaction --no-root --all-extras if poetry run pytest; then echo "plugin $current_folder passed unit test check" else @@ -213,9 +213,24 @@ jobs: run: | trap 'echo "integration_test_exit_code=$?" >> "$GITHUB_OUTPUT"' EXIT declare -a failed_plugins=() + + # lite plugins should be skipped during integration tests + readarray -t lite_plugin_array < lite_plugins + + elementIn () { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 + } + for dir in ./*/; do current_folder=$(basename "$dir") - if [[ $current_folder == "plugin_globals" ]]; then + # Skip plugin_globals and lite plugins + if [[ "$current_folder" == "plugin_globals" ]] ; then + continue + fi + if elementIn "$current_folder" "${lite_plugin_array[@]}"; then continue fi cd $current_folder/integration @@ -310,6 +325,8 @@ jobs: fi # Update the RELEASES.md file with the release notes + # Remove the Plugin Release Status heading + sed -i '/# Plugin Release Status/d' RELEASES.md echo "$body" | cat - RELEASES.md > temp && mv temp RELEASES.md # Check if there are any upgrades @@ -333,15 +350,15 @@ jobs: # Update the release notes with the upgraded plugins. # For replacing with the sed command we need to double escape the newline and tab characters. - details=$(printf '#### Plugins upgraded this release: \n\t - ') - double_escape_details=$(printf '#### Plugins upgraded this release: \\n\\t - ') + details=$(printf '\n### Plugins Upgraded For ACA-Py Release %s \n - ' "$release_version") + double_escape_details=$(printf '\\n### Plugins Upgraded For ACA-Py Release %s \\n - ' "$release_version") # For replacing the first occurence of ' - ' with the details count=${#upgraded_plugins[*]} for i in $(seq 0 "$(("$count" - 2))" ); do - details=$(printf '%s %s \n\t - ' "$details" "${upgraded_plugins[$i]}") - double_escape_details=$(printf '%s %s \\n\\t - ' "$double_escape_details" "${upgraded_plugins[$i]}") + details=$(printf '%s %s \n - ' "$details" "${upgraded_plugins[$i]}") + double_escape_details=$(printf '%s %s \\n - ' "$double_escape_details" "${upgraded_plugins[$i]}") done details=$(printf '%s %s \n' "$details" "${upgraded_plugins[$count - 1]}") double_escape_details=$(printf '%s %s \n' "$double_escape_details" "${upgraded_plugins[$count - 1]}") @@ -353,6 +370,11 @@ jobs: sed -i "0,/v$release_version/{s/v$release_version/v$tag_version/}" RELEASES.md body=${body/v$release_version/v$tag_version} + # Add the heading for the Plugin Release Status and RELEASES.md + heading="# Plugin Release Status" + body=$(printf '%s\n%s' "${heading}" "${body}") + printf '%s\n%s\n' "${heading}" "$(cat RELEASES.md)" > RELEASES.md + # Prepare the PR body EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) echo "pr_body<<$EOF" >> $GITHUB_OUTPUT diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 8f340300f..3cd692e12 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -125,11 +125,11 @@ jobs: body=$(python repo_manager.py 4) body=${body/v$version/v$release_tag} upgraded_plugins=($(python repo_manager.py 5)) - details=$(printf '#### Plugins upgraded this release: \n\t - ') + details=$(printf '### Plugins Upgraded For ACA-Py Release %s \n - ' '$version') count=${#upgraded_plugins[*]} for i in $(seq 0 "$(("$count" - 2))" ); do - details=$(printf '%s %s \n\t - ' "$details" "${upgraded_plugins[$i]}") + details=$(printf '%s %s \n - ' "$details" "${upgraded_plugins[$i]}") done details=$(printf '%s %s \n' "$details" "${upgraded_plugins[$count - 1]}") diff --git a/repo_manager.py b/repo_manager.py index cc19dfa9e..d8087f422 100644 --- a/repo_manager.py +++ b/repo_manager.py @@ -404,10 +404,10 @@ def main(arg_1=None, arg_2=None): global_version = re.findall(r'"([^"]*)"', next_line) break # Create and output the markdown release notes - msg = f"""### Release v{global_version[0]}\n##### The latest supported versions of aries-cloudagent for each plugin are as follows:\n""" + msg = f"""## ACA-Py Release {global_version[0]}\n""" print(msg) # Markdown table header - print("| Plugin Name | Supported aries-cloudagent version |") + print("| Plugin Name | Supported ACA-Py Release |") print("| --- | --- |") for plugin_name in sorted(os.listdir("./")): if is_plugin_directory(plugin_name): @@ -443,9 +443,8 @@ def main(arg_1=None, arg_2=None): with open(f"./{plugin_name}/pyproject.toml", "w") as file: file.write(filedata) print(f"|{plugin_name} | {version[0]}|") - - print("***") - print(" - ") + + print("\n") elif selection == "5": """ @@ -470,14 +469,14 @@ def main(arg_1=None, arg_2=None): with open("RELEASES.md", "r") as file: last_releases = [] for line in file: - if f"### Release v{global_version[0]}" in line: + if f"## ACA-Py Release {global_version[0]}" in line: line = next(file) line = next(file) line = next(file) - while "***" not in line: + while "### Plugins Upgraded" not in line: if ( line - != "| Plugin Name | Supported aries-cloudagent version |\n" + != "| Plugin Name | Supported ACA-Py Release |\n" and line != "| --- | --- |\n" ): last_releases.append(line.strip()) @@ -491,9 +490,12 @@ def main(arg_1=None, arg_2=None): # Get all released plugins and the plugins not on the global version for item in last_releases: - released_plugins.append(item.split("|")[1].strip()) - if item.split("|")[2].strip() == global_version[0]: - plugins_on_old_release.append(item.split("|")[1].strip()) + split_item = item.split("|") + if len(split_item) > 1: + released_plugins.append(split_item[1].strip()) + + if split_item[2].strip() == global_version[0]: + plugins_on_old_release.append(split_item[1].strip()) # If there is releases in the RELEASES.md file then look for new plugins and add them to plugins on old release if last_releases: From fc53877f747ded83636ceb1637d98fd027069fd6 Mon Sep 17 00:00:00 2001 From: jamshale Date: Wed, 14 Aug 2024 13:18:19 -0700 Subject: [PATCH 2/2] WIP Signed-off-by: jamshale --- .github/workflows/create-release-pr.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml index 79815c7b9..3cce7d9d3 100644 --- a/.github/workflows/create-release-pr.yaml +++ b/.github/workflows/create-release-pr.yaml @@ -351,9 +351,9 @@ jobs: # Update the release notes with the upgraded plugins. # For replacing with the sed command we need to double escape the newline and tab characters. details=$(printf '\n### Plugins Upgraded For ACA-Py Release %s \n - ' "$release_version") - double_escape_details=$(printf '\\n### Plugins Upgraded For ACA-Py Release %s \\n - ' "$release_version") + double_escape_details=$(printf '\\n### Plugins Upgraded For ACA-Py Release %s \\n*' "$release_version") - # For replacing the first occurence of ' - ' with the details + # For replacing the first occurence of '*' with the details count=${#upgraded_plugins[*]} for i in $(seq 0 "$(("$count" - 2))" ); do @@ -363,8 +363,8 @@ jobs: details=$(printf '%s %s \n' "$details" "${upgraded_plugins[$count - 1]}") double_escape_details=$(printf '%s %s \n' "$double_escape_details" "${upgraded_plugins[$count - 1]}") - # Replace the first occurence of ' - ' with the details - sed -i "0,/\s\-\s/s// - $(printf '%s ' ${double_escape_details})/" RELEASES.md + # Replace the first occurence of '*' with the details + sed -i "0,/*/s// - $(printf '%s ' ${double_escape_details})/" RELEASES.md # Replace the release version with the release tag sed -i "0,/v$release_version/{s/v$release_version/v$tag_version/}" RELEASES.md