Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into chore/release-2.8.…
Browse files Browse the repository at this point in the history
…0-to-develop
  • Loading branch information
jmank88 committed Jan 24, 2024
2 parents 04fbe42 + 78e96d1 commit 523bbdf
Show file tree
Hide file tree
Showing 1,299 changed files with 89,879 additions and 20,498 deletions.
5 changes: 5 additions & 0 deletions .ct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See: https://github.com/helm/chart-testing
target-branch: develop
chart-dirs: 'charts'
check-version-increment: false
validate-maintainers: false
2 changes: 1 addition & 1 deletion .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
required: false
suites:
description: The test suites to build into the image
default: chaos migration performance reorg smoke soak benchmark load/automationv2_1
default: chaos migration reorg smoke soak benchmark load/automationv2_1
required: false
QA_AWS_ROLE_TO_ASSUME:
description: The AWS role to assume as the CD user, if any. Used in configuring the docker/login-action
Expand Down
7 changes: 1 addition & 6 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ runs:
shell: bash
run: mkdir -p core/web/assets && touch core/web/assets/index.html
- name: Build binary
if: ${{ inputs.go-directory == '.' }}
shell: bash
run: go build ./...
- name: Build binary
if: ${{ inputs.go-directory != '.' }}
working-directory: ${{ inputs.go-directory }}
shell: bash
run: go build
run: go build ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/actions/notify-slack-jobs-result/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Notify Slack Jobs Result

Sends a Slack message to a specified channel detailing the results of one to many GHA job results using a regex. The job results will be grouped by the `github_job_name_regex` and displayed underneath the `message_title`, with the regex matching group displayed as an individual result. This is primarily designed for when you have test groups running in a matrix, and would like condensed reporting on their status by group. It's often accompanied by posting a Slack message before to start a thread, then attaching all the results to that thread like we do in the reporting section of the [live-testnet-test.yml workflow](../../workflows/live-testnet-tests.yml). Check out the example below, where we post an initial summary message, then use this action to thread together specific results:

```yaml
message_title: Optimism Goerli
github_job_name_regex: ^Optimism Goerli (?<cap>.*?) Tests$ # Note that the regex MUST have a capturing group named "cap"
```
![example](image.png)
## Inputs
```yaml
inputs:
github_token:
description: "The GitHub token to use for authentication (usually ${{ github.token }})"
required: true
github_repository:
description: "The GitHub owner/repository to use for authentication (usually ${{ github.repository }}))"
required: true
workflow_run_id:
description: "The workflow run ID to get the results from (usually ${{ github.run_id }})"
required: true
github_job_name_regex:
description: "The regex to use to match 1..many job name(s) to collect results from. Should include a capture group named 'cap' for the part of the job name you want to display in the Slack message (e.g. ^Client Compatability Test (?<cap>.*?)$)"
required: true
message_title:
description: "The title of the Slack message"
required: true
slack_channel_id:
description: "The Slack channel ID to post the message to"
required: true
slack_thread_ts:
description: "The Slack thread timestamp to post the message to, handy for keeping multiple related results in a single thread"
required: false
```
110 changes: 110 additions & 0 deletions .github/actions/notify-slack-jobs-result/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Notify Slack Jobs Result
description: Will send a notification in Slack for the result of a GitHub action run, typically for test results
inputs:
github_token:
description: "The GitHub token to use for authentication (usually github.token)"
required: true
github_repository:
description: "The GitHub owner/repository to use for authentication (usually github.repository))"
required: true
workflow_run_id:
description: "The workflow run ID to get the results from (usually github.run_id)"
required: true
github_job_name_regex:
description: "The regex to use to match 1..many job name(s) to collect results from. Should include a capture group named 'cap' for the part of the job name you want to display in the Slack message (e.g. ^Client Compatability Test (?<cap>.*?)$)"
required: true
message_title:
description: "The title of the Slack message"
required: true
slack_channel_id:
description: "The Slack channel ID to post the message to"
required: true
slack_bot_token:
description: "The Slack bot token to use for authentication which needs permission and an installed app in the channel"
required: true
slack_thread_ts:
description: "The Slack thread timestamp to post the message to, handy for keeping multiple related results in a single thread"
required: false

runs:
using: composite
steps:
- name: Get Results
shell: bash
id: test-results
run: |
# I feel like there's some clever, fully jq way to do this, but I ain't got the motivation to figure it out
echo "Querying test results at https://api.github.com/repos/${{inputs.github_repository}}/actions/runs/${{ inputs.workflow_run_id }}/jobs"
PARSED_RESULTS=$(curl \
-H "Authorization: Bearer ${{ inputs.github_token }}" \
'https://api.github.com/repos/${{inputs.github_repository}}/actions/runs/${{ inputs.workflow_run_id }}/jobs' \
| jq -r --arg pattern "${{ inputs.github_job_name_regex }}" '.jobs[]
| select(.name | test($pattern)) as $job
| $job.steps[]
| select(.name == "Run Tests")
| { conclusion: (if .conclusion == "success" then ":white_check_mark:" else ":x:" end), cap: ("*" + ($job.name | capture($pattern).cap) + "*"), html_url: $job.html_url }')
echo "Parsed Results:"
echo $PARSED_RESULTS
ALL_SUCCESS=true
echo "Checking for failures"
echo "$PARSED_RESULTS" | jq -s | jq -r '.[] | select(.conclusion != ":white_check_mark:")'
for row in $(echo "$PARSED_RESULTS" | jq -s | jq -r '.[] | select(.conclusion != ":white_check_mark:")'); do
ALL_SUCCESS=false
break
done
echo "Success: $ALL_SUCCESS"
echo all_success=$ALL_SUCCESS >> $GITHUB_OUTPUT
FORMATTED_RESULTS=$(echo $PARSED_RESULTS | jq -s '[.[]
| {
conclusion: .conclusion,
cap: .cap,
html_url: .html_url
}
]
| map("{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"<\(.html_url)|\(.cap)>: \(.conclusion)\"}}")
| join(",")')
echo "Formatted Results:"
echo $FORMATTED_RESULTS
# Cleans out backslashes and quotes from jq
CLEAN_RESULTS=$(echo "$FORMATTED_RESULTS" | sed 's/\\\"/"/g' | sed 's/^"//;s/"$//')
echo "Clean Results"
echo $CLEAN_RESULTS
echo results=$CLEAN_RESULTS >> $GITHUB_OUTPUT
- name: Post Results
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
env:
SLACK_BOT_TOKEN: ${{ inputs.slack_bot_token }}
with:
channel-id: ${{ inputs.slack_channel_id }}
payload: |
{
"thread_ts": "${{ inputs.slack_thread_ts }}",
"attachments": [
{
"color": "${{ steps.test-results.outputs.all_success == 'true' && '#2E7D32' || '#C62828' }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ inputs.message_title }} ${{ steps.test-results.outputs.all_success == 'true' && ':white_check_mark:' || ':x:'}}",
"emoji": true
}
},
{
"type": "divider"
},
${{ steps.test-results.outputs.results }}
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions .github/actions/setup-create-base64-config-live-testnets/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Create Base64 Config
description: A composite action that creates a base64-encoded config to be used by integration tests

inputs:
runId:
description: The run id
testLogCollect:
description: Whether to always collect logs, even for passing tests
default: "false"
chainlinkImage:
description: The chainlink image to use
default: "public.ecr.aws/chainlink/chainlink"
chainlinkVersion:
description: The git commit sha to use for the image tag
pyroscopeServer:
description: URL of Pyroscope server
pyroscopeEnvironment:
description: Name of Pyroscope environment
pyroscopeKey:
description: Pyroscope server key
lokiEndpoint:
description: Loki push endpoint
lokiTenantId:
description: Loki tenant id
lokiBasicAuth:
description: Loki basic auth
logstreamLogTargets:
description: Where to send logs (e.g. file, loki)
grafanaUrl:
description: Grafana URL
grafanaDashboardUrl:
description: Grafana dashboard URL
network:
description: Network to run tests on
httpEndpoints:
description: HTTP endpoints to use for network
wsEndpoints:
description: WS endpoints to use for network
fundingKeys:
description: Funding keys to use for network

runs:
using: composite
steps:
- name: Prepare Base64 TOML override
shell: bash
id: base64-config-override
env:
RUN_ID: ${{ inputs.runId }}
PYROSCOPE_SERVER: ${{ inputs.pyroscopeServer }}
PYROSCOPE_ENVIRONMENT: ${{ inputs.pyroscopeEnvironment }}
PYROSCOPE_KEY: ${{ inputs.pyroscopeKey }}
CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }}
CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }}
LOKI_ENDPOINT: ${{ inputs.lokiEndpoint }}
LOKI_TENANT_ID: ${{ inputs.lokiTenantId }}
LOKI_BASIC_AUTH: ${{ inputs.lokiBasicAuth }}
LOGSTREAM_LOG_TARGETS: ${{ inputs.logstreamLogTargets }}
GRAFANA_URL: ${{ inputs.grafanaUrl }}
GRAFANA_DASHBOARD_URL: ${{ inputs.grafanaDashboardUrl }}
NETWORK: ${{ inputs.network }}
HTTP_ENDPOINTS: ${{ inputs.httpEndpoints }}
WS_ENDPOINTS: ${{ inputs.wsEndpoints }}
FUNDING_KEYS: ${{ inputs.fundingKeys }}
run: |
convert_to_toml_array() {
local IFS=','
local input_array=($1)
local toml_array_format="["
for element in "${input_array[@]}"; do
toml_array_format+="\"$element\","
done
toml_array_format="${toml_array_format%,}]"
echo "$toml_array_format"
}
if [ -n "$PYROSCOPE_SERVER" ]; then
pyroscope_enabled=true
else
pyroscope_enabled=false
fi
cat << EOF > config.toml
[Common]
chainlink_node_funding=0.5
[ChainlinkImage]
image="$CHAINLINK_IMAGE"
version="$CHAINLINK_VERSION"
[Pyroscope]
enabled=$pyroscope_enabled
server_url="$PYROSCOPE_SERVER"
environment="$PYROSCOPE_ENVIRONMENT"
key="$PYROSCOPE_KEY"
[Logging]
run_id="$RUN_ID"
[Logging.LogStream]
log_targets=$(convert_to_toml_array "$LOGSTREAM_LOG_TARGETS")
[Logging.Loki]
tenant_id="$LOKI_TENANT_ID"
endpoint="$LOKI_URL"
basic_auth="$LOKI_BASIC_AUTH"
[Logging.Grafana]
base_url="$GRAFANA_URL"
dasboard_url="$GRAFANA_DASHBOARD_URL"
[Network]
selected_networks=["$NETWORK"]
[Network.RpcHttpUrls]
"$NETWORK" = $(convert_to_toml_array "$HTTP_ENDPOINTS")
[Network.RpcWsUrls]
"$NETWORK" = $(convert_to_toml_array "$WS_ENDPOINTS")
[Network.WalletKeys]
"$NETWORK" = $(convert_to_toml_array "$FUNDING_KEYS")
EOF
BASE64_CONFIG_OVERRIDE=$(cat config.toml | base64 -w 0)
echo ::add-mask::$BASE64_CONFIG_OVERRIDE
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
touch .root_dir
Loading

0 comments on commit 523bbdf

Please sign in to comment.