-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/addon-storage…
…-ctrler
- Loading branch information
Showing
1,673 changed files
with
186,202 additions
and
39,281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
# requires `git` and `gh` commands, ref. https://cli.github.com/manual/installation for installation guides. | ||
|
||
workdir=$(dirname $0) | ||
. ${workdir}/gh_env | ||
. ${workdir}/functions.bash | ||
|
||
bug_report_md_file=${1} | ||
|
||
crit_cnt=$(cat ${bug_report_md_file} | grep crit | wc -l) | ||
major_cnt=$(cat ${bug_report_md_file} | grep major | wc -l) | ||
minor_cnt=$(cat ${bug_report_md_file} | grep minor | wc -l) | ||
total_cnt=$(cat ${bug_report_md_file} | wc -l) | ||
total_cnt=$((total_cnt-2)) | ||
|
||
printf "bug stats\ntotal open: %s\ncritial: %s\nmajor: %s\nminor: %s\n" ${total_cnt} ${crit_cnt} ${major_cnt} ${minor_cnt} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# requires `git` and `gh` commands, ref. https://cli.github.com/manual/installation for installation guides. | ||
|
||
workdir=$(dirname $0) | ||
. ${workdir}/gh_env | ||
. ${workdir}/functions.bash | ||
|
||
process_issue_rows() { | ||
for ((i = 0; i < ${item_count}; i++)) | ||
do | ||
local issue_body=$(echo ${last_issue_list} | jq -r ".[${i}]") | ||
local issue_id=$(echo ${issue_body} | jq -r ".number") | ||
local url=$(echo ${issue_body} | jq -r '.html_url') | ||
local title=$(echo ${issue_body} | jq -r '.title') | ||
local assignees=$(echo ${issue_body} | jq -r '.assignees[]?.login') | ||
local state=$(echo ${issue_body}| jq -r '.state') | ||
printf "[%s](%s) #%s | %s | %s | %s \n" "${title}" "${url}" "${issue_id}" "$(join_by , ${assignees})" "${state}" | ||
gh_update_issue_milestone ${issue_id} | ||
done | ||
} | ||
|
||
item_count=100 | ||
page=1 | ||
printf "%s | %s | %s \n" "Issue Title" "Assignees" "Issue State" | ||
echo "---|---|---" | ||
while [ "${item_count}" == "100" ] | ||
do | ||
gh_get_issues "none" "kind/bug" "open" ${page} | ||
item_count=$(echo ${last_issue_list} | jq -r '. | length') | ||
process_issue_rows | ||
page=$((page+1)) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# requires `git` and `gh` commands, ref. https://cli.github.com/manual/installation for installation guides. | ||
|
||
workdir=$(dirname $0) | ||
. ${workdir}/gh_env | ||
. ${workdir}/functions.bash | ||
|
||
set -x | ||
|
||
git stash | ||
git switch ${HEAD_BRANCH} | ||
git pull | ||
git rebase origin/${BASE_BRANCH} | ||
git pull | ||
git push | ||
|
||
echo "Creating ${PR_TITLE}" | ||
gh pr create --head ${HEAD_BRANCH} --base ${BASE_BRANCH} --title "${PR_TITLE}" --body "" --label "releasing-task" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# requires `git` and `gh` commands, ref. https://cli.github.com/manual/installation for installation guides. | ||
|
||
workdir=$(dirname $0) | ||
. ${workdir}/gh_env | ||
. ${workdir}/functions.bash | ||
|
||
LABELS=${LABELS:-'kind/bug,bug'} #"severity/critical,severity/major,severity/minor,severity/normal" | ||
|
||
print_issue_rows() { | ||
for ((i = 0; i < ${item_count}; i++)) | ||
do | ||
local issue_body=$(echo ${last_issue_list} | jq -r ".[${i}]") | ||
local issue_id=$(echo ${issue_body} | jq -r ".number") | ||
local url=$(echo ${issue_body} | jq -r '.html_url') | ||
local title=$(echo ${issue_body} | jq -r '.title') | ||
local assignees=$(echo ${issue_body} | jq -r '.assignees[]?.login') | ||
local state=$(echo ${issue_body}| jq -r '.state') | ||
local labels=$(echo ${issue_body} | jq -r '.labels[]?.name') | ||
printf "[%s](%s) #%s | %s | %s | %s \n" "${title}" "${url}" "${issue_id}" "$(join_by , ${assignees})" "${state}" "$(join_by , ${labels})" | ||
done | ||
} | ||
|
||
count_total=0 | ||
item_count=100 | ||
page=1 | ||
echo "" | ||
printf "%s | %s | %s | %s \n" "Issue Title" "Assignees" "Issue State" "Labels" | ||
echo "---|---|---|---" | ||
while [ "${item_count}" == "100" ] | ||
do | ||
gh_get_issues ${MILESTONE_ID} "${LABELS}" "open" ${page} | ||
item_count=$(echo ${last_issue_list} | jq -r '. | length') | ||
print_issue_rows | ||
page=$((page+1)) | ||
count_total=$((count_total + item_count)) | ||
done | ||
|
||
if [ -n "$DEBUG" ]; then | ||
echo "" | ||
echo "total items: ${count_total}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# bash functions | ||
|
||
DEBUG=${DEBUG:-} | ||
# requires `gh` command, ref. https://cli.github.com/manual/installation for installation guides. | ||
|
||
gh_get_issues () { | ||
# @arg milestone - Milestone ID, if the string none is passed, issues without milestones are returned. | ||
# @arg labels - A list of comma separated label names, processed as OR query. | ||
# @arg state - Can be one of: open, closed, all; Default: open. | ||
# @arg page - Cardinal value; Default: 1 | ||
# @result $last_issue_list - contains JSON result | ||
declare milestone="$1" labels="$2" state="${3:-open}" page="${4:-1}" | ||
local label_filter="" | ||
IFS=',' read -ra label_items <<< "${labels}" | ||
for i in "${label_items[@]}"; do | ||
label_filter="${label_filter} -f labels=${i}" | ||
done | ||
_gh_get_issues ${milestone} "${label_filter}" ${state} ${page} | ||
} | ||
|
||
gh_get_issues_with_and_labels () { | ||
# @arg milestone - Milestone ID, if the string none is passed, issues without milestones are returned. | ||
# @arg labels - A list of comma separated label names, processed as AND query. | ||
# @arg state - Can be one of: open, closed, all; Default: open. | ||
# @arg page - Cardinal value; Default: 1 | ||
# @result $last_issue_list - contains JSON result | ||
declare milestone="$1" labels="$2" state="${3:-open}" page="${4:-1}" | ||
_gh_get_issues ${milestone} "-f labels=${labels}" ${state} ${page} | ||
} | ||
|
||
_gh_get_issues () { | ||
# @arg milestone - Milestone ID, if the string none is passed, issues without milestones are returned. | ||
# @arg label_filter - Label fileter query params. | ||
# @arg state - Can be one of: open, closed, all; Default: open. | ||
# @arg page - Cardinal value; Default: 1 | ||
# @result $last_issue_list - contains JSON result | ||
declare milestone="$1" label_filter="$2" state="${3:-open}" page="${4:-1}" | ||
|
||
# GH list issues API ref: https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues | ||
local cmd="gh api \ | ||
--method GET \ | ||
--header 'Accept: application/vnd.github+json' \ | ||
--header 'X-GitHub-Api-Version: 2022-11-28' \ | ||
/repos/${OWNER}/${REPO}/issues \ | ||
-F per_page=100 \ | ||
-F page=${page} \ | ||
-f milestone=${milestone} \ | ||
${label_filter} \ | ||
-f state=${state}" | ||
if [ -n "$DEBUG" ]; then echo $cmd; fi | ||
last_issue_list=`eval ${cmd} 2> /dev/null` | ||
} | ||
|
||
|
||
gh_get_issue_body() { | ||
# @arg issue_id - Github issue ID | ||
# @result last_issue_body | ||
# @result last_issue_url | ||
# @result last_issue_title | ||
# @result last_issue_state | ||
# @result last_issue_assignees - multi-lines items | ||
declare issue_id="$1" | ||
|
||
local issue_body=$(gh api \ | ||
--method GET \ | ||
--header 'Accept: application/vnd.github+json' \ | ||
--header 'X-GitHub-Api-Version: 2022-11-28' \ | ||
/repos/${OWNER}/${REPO}/issues/${issue_id}) | ||
local url=$(echo ${issue_body} | jq -r '.url') | ||
local title=$(echo ${issue_body} | jq -r '.title') | ||
local assignees=$(echo ${issue_body} | jq -r '.assignees[]?.login') | ||
local state=$(echo ${issue_body}| jq -r '.state') | ||
last_issue_body="${issue_body}" | ||
last_issue_url="${url}" | ||
last_issue_title="${title}" | ||
last_issue_state="${state}" | ||
last_issue_assignees=${assignees} | ||
} | ||
|
||
gh_update_issue_milestone() { | ||
# @arg issue_id - Github issue ID | ||
# @arg milestone - Milestone ID, if the string none is passed, issues without milestones are returned. | ||
# @result last_issue_resp | ||
declare issue_id="$1" milestone_id="${2:-}" | ||
|
||
if [ -z "$milestone_id" ]; then | ||
milestone_id=${MILESTONE_ID} | ||
fi | ||
|
||
local req_data="{\"milestone\":$milestone_id}" | ||
|
||
if [ -n "$DEBUG" ]; then echo "req_data=$req_data"; fi | ||
|
||
local gh_token=$(gh auth token) | ||
local resp=$(curl \ | ||
--location \ | ||
--request PATCH \ | ||
--header 'Accept: application/vnd.github+json' \ | ||
--header 'X-GitHub-Api-Version: 2022-11-28' \ | ||
--header "Authorization: Bearer ${gh_token}" \ | ||
--data "${req_data}" \ | ||
https://api.github.com/repos/${OWNER}/${REPO}/issues/${issue_id}) | ||
|
||
last_issue_resp=${resp} | ||
} | ||
|
||
function join_by { | ||
local d=${1-} f=${2-} | ||
if shift 2; then | ||
printf %s "$f" "${@/#/$d}" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding:utf-8 -*- | ||
|
||
# generate kbcli sha256 notes | ||
# 1. open each *.sha256.txt in target direct | ||
# 2. get the contain of the file | ||
# 3. render the template | ||
|
||
import os | ||
import sys | ||
from datetime import date | ||
from string import Template | ||
|
||
release_note_template_path = "docs/release_notes/template.md" | ||
|
||
def main(argv: list[str]) -> None: | ||
""" | ||
:param: the kbcli version | ||
:param: the sha256 files direct | ||
:return None | ||
""" | ||
kbcli_version = argv[1] | ||
sha256_direct = argv[2] | ||
release_note_template_path = "docs/release_notes/kbcli_template.md" | ||
release_note_path = f"docs/release_notes/{kbcli_version}/kbcli.md" | ||
|
||
template = "" | ||
try: | ||
with open(release_note_template_path, "r") as file: | ||
template = file.read() | ||
except FileNotFoundError as e: | ||
print(f"template {release_note_template_path} not found, IGNORED") | ||
|
||
with open(release_note_path,'a') as f_dest: | ||
f_dest.write(Template(template).safe_substitute( | ||
kbcli_version = kbcli_version[1:], | ||
today = date.today().strftime("%Y-%m-%d"), | ||
)) | ||
for file in os.listdir(sha256_direct): | ||
with open(os.path.join(sha256_direct, file),"r") as f: | ||
f_dest.write(f.read()) | ||
f_dest.write('\n') | ||
print("Done") | ||
|
||
if __name__ == "__main__": | ||
main(sys.argv) |
Oops, something went wrong.