Skip to content

Commit

Permalink
[TT-1624] link PR to solidity review issue (#14521)
Browse files Browse the repository at this point in the history
* try more universal Solidity scripts

* fix error printing in uml generation; test foundry pipeline

* Update gethwrappers

* a bit more testing

* fix Sol

* remove test contracts

* Update gethwrappers

* try reusable artifact workflow

* fix syntax

* reuse workflow for .github/workflows

* use newer reusable Solidity Review Artifacts pipeline

* remove actions that were moved to chainlink-github-actions

* add test Solidity file

* add missing changeset

* use scripts from shared repository

* modify one contract

* set git top level dir manually

* [Bot] Update changeset file with jira issue

* fix script path

* use newer version of the reusable pipeline

* update pipeline version, use custom pruning script

* use newer action version, remove JIRA scripts

* use reusable Solidity Review Artifacts workflow from .github

* remove left over changes that are no longer needed

* remove left over changes that are no longer needed

* fix foundry pipeline

* remove test Solidity files

* use tagged reusable pipeline version

* link PR to Solidity Review issue in Jira

* update all references to .github to use tagged commit

* test out the enforcement

* remove extra changeset

* [Bot] Update changeset file with jira issue

* fix filename

* test out empty changeset file

* [Bot] Update changeset file with jira issues

* use latest version of the action

* remove changeset

* fix condition in solidity tracability pipeline

* add changeset

* [Bot] Update changeset file with jira issues

* fix message and condition for comment posting

* test changesets in core

* add changeset for core

* use tagged jira-tracing version, restore changeset

* add missing version comment

* remove test-related changes

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 76addb1 commit b4360c9
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
repository: smartcontractkit/.github
ref: b6e37806737eef87e8c9137ceeb23ef0bff8b1db # validate-solidity-artifacts@0.1.0
ref: 9aed33e5298471f20a3d630d711b96ae5538728c # jira-tracing@0.2.0
path: ./dot_github

- name: Update Jira ticket for core
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ jobs:
retention-days: 7

- name: Find Slither comment in the PR
# We only want to create the comment if the PR is not modified by a bot
if: "(github.event_name == 'push' && github.event.pusher.username && ! contains(github.event.pusher.username, '[bot]')) || (github.event_name != 'push' && ! contains(github.actor, '[bot]'))"
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.0.0
id: find-comment
with:
Expand All @@ -518,6 +520,8 @@ jobs:
echo "slither_artifact_url=$slither_artifact_url" >> $GITHUB_OUTPUT
- name: Create or update Slither comment in the PR
# We only want to create the comment if the PR is not modified by a bot
if: "(github.event_name == 'push' && github.event.pusher.username && ! contains(github.event.pusher.username, '[bot]')) || (github.event_name != 'push' && ! contains(github.actor, '[bot]'))"
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
Expand Down
62 changes: 57 additions & 5 deletions .github/workflows/solidity-tracability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: files-changed
with:
list-files: "json"
list-files: "csv"
# This is a valid input, see https://github.com/dorny/paths-filter/pull/226
predicate-quantifier: "every"
filters: |
source:
source:
- contracts/**/*.sol
- '!contracts/**/*.t.sol'
changesets:
- 'contracts/.changeset/**'
- added|modified: 'contracts/.changeset/**'
enforce-traceability:
# Note: A job that is skipped will report its status as "Success".
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
repository: smartcontractkit/.github
ref: b6e37806737eef87e8c9137ceeb23ef0bff8b1db # validate-solidity-artifacts@0.1.0
ref: 9aed33e5298471f20a3d630d711b96ae5538728c # jira-tracing@0.2.0
path: ./dot_github

# we need to set the top level directory for the jira-tracing action manually
Expand Down Expand Up @@ -128,16 +128,68 @@ jobs:

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Enforce Solidity Review Jira issue
working-directory: ./dot_github
shell: bash
run: |
# we do not want to fail the workflow if there are issues with the script
if ! pnpm --filter jira-tracing issue:enforce-solidity-review; then
echo "::warning::Failed to enforce Solidity Review Jira issue, this is not a blocking issue. You can safely ignore it."
fi
env:
CHANGESET_FILES: ${{ needs.files-changed.outputs.changesets_files }}
GIT_TOP_LEVEL_DIR: ${{ steps.find-git-top-level-dir.outputs.top_level_dir }}

SOLIDITY_REVIEW_TEMPLATE_KEY: 'TT-1634'
EXPORT_JIRA_ISSUE_KEYS: 'true'

JIRA_HOST: ${{ vars.JIRA_HOST }}
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

# Commit appended changeset file back to repo
- uses: planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6
with:
commit_message: "[Bot] Update changeset file with jira issue"
commit_message: "[Bot] Update changeset file with jira issues"
repo: ${{ github.repository }}
branch: ${{ github.head_ref }}
file_pattern: "contracts/.changeset/*"
env:
GITHUB_TOKEN: ${{ steps.get-gh-token.outputs.access-token }}

- name: Read issue keys from env vars
shell: bash
id: read-issue-keys
run: |
# issue:enforce-solidity-review should have set two env vars with the issue keys
echo "Jira issue key related to pr: ${{ env.PR_JIRA_ISSUE_KEY }}"
echo "Jira issue key related to solidity review: ${{ env.SOLIDITY_REVIEW_JIRA_ISSUE_KEY }}"
- name: Find traceability comment in the PR
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.0.0
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Solidity Review Jira issue'

- name: Create or update traceability comment in the PR
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Solidity Review Jira issue
Hey! We have taken the liberty to link this PR to a Jira issue for Solidity Review.
This is a new feature, that's currently in the pilot phase, so please make sure that the linkage is correct. In a contrary case, please update it manually in JIRA and replace Solidity Review issue key in the changeset file with the correct one.
Please reach out to the Test Tooling team and notify them about any issues you encounter.
Any changes to the Solidity Review Jira issue should be reflected in the changeset file. If you need to update the issue key, please do so manually in the following changeset file: `${{ needs.files-changed.outputs.changesets_files }}`
This PR has been linked to Solidity Review Jira issue: [${{ env.SOLIDITY_REVIEW_JIRA_ISSUE_KEY }}](${{ vars.JIRA_HOST }}browse/${{ env.SOLIDITY_REVIEW_JIRA_ISSUE_KEY }})
edit-mode: replace

- name: Collect Metrics
id: collect-gha-metrics
if: always()
Expand Down
8 changes: 8 additions & 0 deletions contracts/.changeset/strong-boats-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@chainlink/contracts': patch
---

Add linkage between PR and Jira's Solidity Review issue


PR issue: TT-1624

0 comments on commit b4360c9

Please sign in to comment.