-
Notifications
You must be signed in to change notification settings - Fork 2
[CERT-9836] Replace active reviews #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c7ff1a5
Replace active reviews
H00N24 e7914a5
Use argjson
H00N24 d5fa8b3
Use variables
H00N24 a3c7194
Use conf file
H00N24 5018314
[CERT-9814] Certora API calls (#74)
H00N24 433be91
PR fix
H00N24 6383b79
Merge branch 'main' into CERT-9836-reuse-active-reviews
H00N24 aff1fb3
Rename file
H00N24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,36 @@ | ||
| name: Certora API | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| command: | ||
| required: true | ||
| description: | | ||
| The Certora API command to execute. Options are: | ||
| - `cancel <group_id>`: Cancel all jobs in the specified group. | ||
| - `refresh <group_id>`: Refresh the status of all jobs in the specified group. | ||
| server: | ||
| required: true | ||
| type: choice | ||
| description: | | ||
| The Certora server to use. Either production, staging, or vaas-dev. | ||
| Default is production. | ||
| default: production | ||
| options: | ||
| - production | ||
| - staging | ||
| - vaas-dev | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| certora_api_command: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./api/ | ||
| with: | ||
| certora-command: ${{ github.event.inputs.command }} | ||
| server: ${{ github.event.inputs.server }} | ||
This file contains hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/github-action.json | ||
| name: Certora API | ||
|
|
||
| description: |- | ||
| GitHub Action to call Certora API to cancel or refresh a job group. | ||
| This action requires that the Certora GitHub App is installed on the repository. | ||
|
|
||
| branding: | ||
| color: blue | ||
| icon: cloud-lightning | ||
|
|
||
| inputs: | ||
| certora-command: | ||
| required: true | ||
| description: |- | ||
| Command to send to the Certora API. It should be in the format | ||
| "<command> <group_id>", where <command> is either "cancel" or "refresh", | ||
| and <group_id> is the identifier of a job group to which the command applies. | ||
| server: | ||
| required: false | ||
| description: |- | ||
| The Certora server to use. Can be "production" (default). "vaas-dev" or "vaas-stg". | ||
| default: "production" | ||
| debug-level: | ||
| default: "0" | ||
| description: |- | ||
| The debug level to use for the action command. Default is `0`. | ||
| Options: `0`, `1`, `2`, or `3`. | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Call Certora API | ||
| shell: bash | ||
| run: | | ||
| RUN_ID="$(cat /proc/sys/kernel/random/uuid)" | ||
| CERTORA_LOG_DIR="/tmp/certora-logs/$RUN_ID" | ||
ozcodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CERTORA_API_SUBDOMAIN="data-api" | ||
| if [[ "${{ inputs.server }}" == "vaas-dev" || "${{ inputs.server }}" == "development" ]]; then | ||
| CERTORA_API_SUBDOMAIN="data-api-dev" | ||
| elif [[ "${{ inputs.server }}" == "staging" || "${{ inputs.server }}" == "vaas-stg" ]]; then | ||
| CERTORA_API_SUBDOMAIN="data-api-stg" | ||
| fi | ||
| export CERTORA_API_SUBDOMAIN | ||
| export CERTORA_LOG_DIR | ||
| bash "${{ github.action_path }}/../scripts/call-api.sh" | ||
| env: | ||
| CERTORA_COMMAND: ${{ inputs.certora-command }} | ||
| DEBUG_LEVEL: "${{ inputs.debug-level }}" | ||
This file contains hidden or 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,56 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| if [ "${DEBUG_LEVEL:-0}" -gt 0 ]; then | ||
| set -x | ||
| fi | ||
|
|
||
| # Validate required variables | ||
| required_vars=( | ||
| CERTORA_COMMAND | ||
ozcodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CERTORA_API_SUBDOMAIN | ||
| CERTORA_LOG_DIR | ||
| ACTIONS_ID_TOKEN_REQUEST_TOKEN | ||
| ACTIONS_ID_TOKEN_REQUEST_URL | ||
| ) | ||
|
|
||
| missing_args=false | ||
|
|
||
| for var in "${required_vars[@]}"; do | ||
| if [ -z "${!var:-}" ]; then | ||
| echo "::error title=Missing variable::$var is required but not set" | ||
| missing_args=true | ||
| fi | ||
| done | ||
|
|
||
| if [ "$missing_args" = true ]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| endpoint="" | ||
| group_id="" | ||
|
|
||
| read -r endpoint group_id <<< "$CERTORA_COMMAND" | ||
ozcodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Fetch OIDC token | ||
| TOKEN="$(curl -sSfL --retry 3 --max-time 30 -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r .value)" | ||
| if [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ]; then | ||
| echo "::error title=Token Retrieval Failed::Could not fetch GitHub OIDC token." | ||
| exit 1 | ||
| fi | ||
|
|
||
| GHINT_LOG="$CERTORA_LOG_DIR/gh-call.json" | ||
|
|
||
| CERT_GH_APP_LINK='https://github.com/apps/certora-run' | ||
| CERT_GH_ACTION_LINK='https://github.com/Certora/certora-run-action' | ||
| ERROR_MSG="There was an issue executing the API call (Please have a look at $CERT_GH_APP_LINK, $CERT_GH_ACTION_LINK)." | ||
|
|
||
| # Make API request to verify GitHub App integration | ||
| curl -sSL --proto '=https' --tlsv1.2 --retry 10 --max-time 60 --retry-connrefused --fail-with-body -X POST "https://$CERTORA_API_SUBDOMAIN.certora.com/v1/github-app/$endpoint?groupId=$group_id" \ | ||
| -H "Authorization: Bearer $TOKEN" \ | ||
ozcodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -H "Content-Type: application/json" >"$GHINT_LOG" || { | ||
| echo "::error title=Certora GitHub Application Integration Missing::$(jq -r '"Error \(.status_code): \(.detail)"' "$GHINT_LOG") - $ERROR_MSG" | ||
| cat "$GHINT_LOG" | ||
| exit 1 | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.