Skip to content

Commit

Permalink
Create 2024-09-18-node-cli-api.md (#486)
Browse files Browse the repository at this point in the history
* Update download-prs.sh to only download PRs that have been merged in the
given date range

Make date more precise in the scripts by zeroing UTC time

* Update scripts/README.md

* Update scripts/create-slug.sh with new arguments and parameter changes

* Create 2024-09-18-node-cli-api.md
  • Loading branch information
Jimbo4350 authored Oct 17, 2024
1 parent a0b6054 commit 8714d03
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 28 deletions.
55 changes: 55 additions & 0 deletions blog/2024-09-18-node-cli-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Node API & CLI Team Update
slug: 2024-09-18-node-cli-api
authors: Jimbo4350
tags: [cli-api]
hide_table_of_contents: false
---

# Node-Api-Cli Update
# 2024-09-04 - 2024-09-18

## High level summary

In line with our ongoing refactoring work, we began propagating the [experimental api](https://github.com/input-output-hk/cardano-node-wiki/wiki/ADR-4-Support-only-for-mainnet-and-upcoming-eras) in `cardano-cli`. This will continue for several sprints as we remove eras prior to mainnet in order to reduce the unnecessary complexity of `cardano-api`'s and `cardano-cli`'s codebases. Other work:
- New functionality has been added to cardano-cli and cardano-ping
- Collateral balancing bug has been fixed in cardano-cli
- `optparse-applicative-fork` dependency has been removed
- Various refactors and improvements to cardano-testnet

### cardano-cli
- [Add support for fetching tip through cardano-ping](https://github.com/IntersectMBO/cardano-cli/pull/888)
- [add support for script based drep on update certificate](https://github.com/IntersectMBO/cardano-cli/pull/884)
- [cardano-ping: report user friendly error on misconfiguration](https://github.com/IntersectMBO/cardano-cli/pull/893)
- [Move parsing helpers from API](https://github.com/IntersectMBO/cardano-cli/pull/894)
- [Options: avoid code duplication](https://github.com/IntersectMBO/cardano-cli/pull/890)
- [Propagate experimental api](https://github.com/IntersectMBO/cardano-cli/pull/853)
- [Release cardano-cli-9.4.0.0](https://github.com/IntersectMBO/cardano-cli/pull/885)
- [Release cardano-cli-9.4.1.0](https://github.com/IntersectMBO/cardano-cli/pull/889)
- [Remove deprecation message when invoking a command in deprecated era](https://github.com/IntersectMBO/cardano-cli/pull/887)

### cardano-api
- [Add `fromLedgerUTxO` export](https://github.com/IntersectMBO/cardano-api/pull/627)
- [Add new types to CDDL list and test forward compatibility of `deserialiseTxLedgerCddl`](https://github.com/IntersectMBO/cardano-api/pull/634)
- [Bump CHaP](https://github.com/IntersectMBO/cardano-api/pull/610)
- [Experimental API: remove redundant type families and functions](https://github.com/IntersectMBO/cardano-api/pull/625)
- [Fix collateral balancing when building transaction](https://github.com/IntersectMBO/cardano-api/pull/631)
- [Release cardano-api-9.3.0.0 cardano-api-gen-9.0.0.0 ](https://github.com/IntersectMBO/cardano-api/pull/628)
- [Remove optparse-applicative-fork dependency, and functions depending on it](https://github.com/IntersectMBO/cardano-api/pull/635)

### cardano-node
- [Add more context to invalid snapshot events](https://github.com/IntersectMBO/cardano-node/pull/5933)
- [Names of metrics in the new tracing system](https://github.com/IntersectMBO/cardano-node/pull/5905)
- [Update dependencies](https://github.com/IntersectMBO/cardano-node/pull/5979)

### cardano-testnet
- [Add test for `query spo-stake-distribution`](https://github.com/IntersectMBO/cardano-node/pull/5932)
- [cardano-testnet | Add plutus V3 cost model, set minFeeRefScriptCostPerByte=15 in Conway genesis](https://github.com/IntersectMBO/cardano-node/pull/5977)
- [cardano-testnet-test: small improvements](https://github.com/IntersectMBO/cardano-node/pull/5962)
- [cardano-testnet: make call to query stake-address-info a golden test](https://github.com/IntersectMBO/cardano-node/pull/5970)
- [cardano-testnet: separate in types the options encoded in genesis files, from other options](https://github.com/IntersectMBO/cardano-node/pull/5976)
- [cardano-testnet: test value delegated to dreps in test of drep-stake-distribution](https://github.com/IntersectMBO/cardano-node/pull/5961)

### docs

### CI & project maintenance
12 changes: 8 additions & 4 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ The following scripts are included in this repository:

### PR Summary Scripts

NB: When specifying date ranges be sure the end date is the _start date of the following sprint_. If not you risk losing work done on the last day of a sprint.

NB: Dates are converted to UTC time and are automatically zeroed: YYYY-MM-DD:00:00:00Z

To use these scripts, follow the instructions below:

1. Run the `download-prs.sh` script providing a "repository" and a "start-date" (YYYY-MM-DD) as arguments. The script will download all PRs created after the start date. For example:
1. Run the `download-prs.sh` script providing a "repository", "start-date" (YYYY-MM-DD) and "end-date" (YYYY-DD-DD) as arguments. The script will download all PRs merged in the date range. For example:

```bash
./scripts/download-prs.sh input-output-hk/cardano-node 2023-06-30
./scripts/download-prs.sh https://github.com/IntersectMBO/cardano-node.git 2023-06-30 2023-07-30
```

2. Execute the `distribute-merged-prs.sh` script using the following command:

```bash
./scripts/distribute-merged-prs.sh input-output-hk/cardano-node $dir 2022-06-25 2023-04-18
./scripts/distribute-merged-prs.sh input-output-hk/cardano-node $dir 2023-06-30 2023-07-30
```

This script will distribute the downloaded PRs based on the files they have touched in the the directory $dir.
Expand All @@ -57,7 +61,7 @@ Execute the create-slug.sh script with the following command:
```bash
./create-slug.sh <author> <date> <end_date>
```
This script will create a markdown file named blog/<date>-node-cli-api.md, authored by "<author>", with sections for updates from "<date>" to "<end_date>". It automatically runs the PR summary scripts as defined above so you can cherry pick the PRs as necessary.
This script will create a markdown file named blog/<date>-node-cli-api.md, authored by "<author>", with sections for updates from "<date>" to "<end_date>". It automatically runs the PR summary scripts as defined above so you can cherry pick the PRs as necessary.


## Additional Information
Expand Down
6 changes: 3 additions & 3 deletions scripts/create-slug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ hide_table_of_contents: false
### CI & project maintenance
EOF

source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-node.git $DATE
source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-cli.git $DATE
source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-api.git $DATE
source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-node.git $DATE $END_DATE
source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-cli.git $DATE $END_DATE
source scripts/download-prs.sh https://github.com/IntersectMBO/cardano-api.git $DATE $END_DATE

source scripts/distribute-merged-prs.sh https://github.com/IntersectMBO/cardano-node.git current $DATE $END_DATE
source scripts/distribute-merged-prs.sh https://github.com/IntersectMBO/cardano-cli.git current $DATE $END_DATE
Expand Down
9 changes: 7 additions & 2 deletions scripts/distribute-merged-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ else
date_cmd=date
fi

repository="$1"
repository_url="$1"
subdir="$2"
start_date="$("$date_cmd" -u -d "$3" +"%Y-%m-%dT%H:%M:%SZ")"
end_date="$("$date_cmd" -u -d "$4" +"%Y-%m-%dT%H:%M:%SZ")"
repository_name="$(basename "$repository_url" ".git")"

work_dir="gen/$repository"
echo "Start date: $start_date"
echo "End date: $end_date"


work_dir="gen/$repository_name"
work_subdir="$work_dir/$subdir"
download_file="$work_dir/download.yaml"
filtered_file="$work_subdir/filtered.yaml"
Expand Down
32 changes: 16 additions & 16 deletions scripts/download-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -euo pipefail
exit 1
}

if [ "$#" -ne 2 ]; then
echo "Usage: $0 repository" >&2
echo "Example: $0 IntersectMBO/cardano-node" >&2
if [ "$#" -ne 3 ]; then
echo "Usage: $0 repository_url start_date end_date" >&2
echo "Example: $0 IntersectMBO/cardano-node 2024-09-04 2024-09-17" >&2
exit 1
fi

Expand All @@ -19,27 +19,27 @@ else
date_cmd=date
fi

repository="$1"
date="$2"
repository_url="$1"
repository_name="$(basename "$repository_url" ".git")"

out_dir="gen/$repository"
start_date="$("$date_cmd" -u -d "$2" +"%Y-%m-%dT%H:%M:%SZ")"
end_date="$("$date_cmd" -u -d "$3" +"%Y-%m-%dT%H:%M:%SZ")"

out_dir="gen/$repository_name"

mkdir -p "$out_dir"

temp_json_file="$(mktemp).json"

# Find a reasonable number for -L
max_pr_number="$(gh pr list --repo "$repository" --state all --search "created:>=$date" -L 1000 --json number | jq length)"
max_pr_number="$(gh pr list --repo "$repository_url" --state merged --search "merged:$start_date..$end_date" -L 1000 --json number | jq length)"

gh pr list --repo "$repository_url" --state merged --search "merged:$start_date..$end_date" -L "$max_pr_number" \
--json number,title,author,createdAt,closedAt,files,mergedAt,baseRefName,url,body > "$temp_json_file"

echo "Repository: $repository"
echo "Date: $date"
echo "Downloading up to $max_pr_number PRs"

gh pr list --repo "$repository" \
-L "$max_pr_number" \
--state all \
--json number,title,author,createdAt,closedAt,files,mergedAt,baseRefName,url,body \
> "$temp_json_file"
echo "Repository: $repository_url"
echo "Start Date: $start_date"
echo "End Date: $end_date"
echo "Downloading up to $max_pr_number PRs"

cat "$temp_json_file" | yq -P > "$out_dir/download.yaml"
7 changes: 4 additions & 3 deletions scripts/summarise-merged-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ set -euo pipefail
}

if [ "$#" -ne 2 ]; then
echo "Usage: $0 repository output_subdir" >&2
echo "Usage: $0 repository_url output_subdir" >&2
echo "Example: $0 IntersectMBO/cardano-node v8.0.0" >&2
exit 1
fi

repository="$1"
repository_url="$1"
repository_name="$(basename "$repository_url" ".git")"
subdir="$2"

work_dir="gen/$repository"
work_dir="gen/$repository_name"
work_subdir="$work_dir/$subdir"
detail_dir="$work_subdir/detail"
summary_dir="$work_subdir/summary"
Expand Down

0 comments on commit 8714d03

Please sign in to comment.