Skip to content

Commit

Permalink
Merge branch 'develop' into feature/keystone-beholder-alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Oct 16, 2024
2 parents c9ff3c1 + 2b67c54 commit c26973f
Show file tree
Hide file tree
Showing 69 changed files with 1,473 additions and 473 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-jobs-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Rename DA oracle consts to be more descriptive #wip
5 changes: 5 additions & 0 deletions .changeset/rude-spies-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#added new config field to FeeQuoter
152 changes: 138 additions & 14 deletions .github/actions/goreleaser-build-sign-publish/release.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,146 @@
#!/usr/bin/env node
const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");

function main() {
const goreleaserConfig = mustGetEnv("GORELEASER_CONFIG");
const releaseType = mustGetEnv("RELEASE_TYPE");
const command = constructGoreleaserCommand(releaseType, goreleaserConfig);

if (process.env.DRY_RUN) {
console.log(`Generated command: ${command}`);
console.log("Dry run enabled. Exiting without executing the command.");
return;
const args = process.argv.slice(2);
const useExistingDist = args.includes("--use-existing-dist");
const chainlinkVersion = getVersion();

if (!useExistingDist) {
const goreleaserConfig = mustGetEnv("GORELEASER_CONFIG");
const releaseType = mustGetEnv("RELEASE_TYPE");
const command = constructGoreleaserCommand(
releaseType,
chainlinkVersion,
goreleaserConfig
);

if (process.env.DRY_RUN) {
console.log(`Generated command: ${command}`);
console.log("Dry run enabled. Exiting without executing the command.");
return;
} else {
console.log(`Executing command: ${command}`);
execSync(command, { stdio: "inherit" });
}
} else {
console.log(`Executing command: ${command}`);
execSync(command, { stdio: "inherit" });
console.log(
"Skipping Goreleaser command execution as '--use-existing-dist' is set."
);
}

const artifactsJsonPath = findArtifactsJson();
const dockerImages = extractDockerImages(artifactsJsonPath);
const repoSha = execSync("git rev-parse HEAD", { encoding: "utf-8" }).trim();

const results = dockerImages.map((image) => {
try {
console.log(`Checking version for image: ${image}, expected version: ${chainlinkVersion}, expected SHA: ${repoSha}`);
const versionOutput = execSync(`docker run --rm ${image} --version`, {
encoding: "utf-8",
});
console.log(`Output from image ${image}: ${versionOutput}`);

const cleanedOutput = versionOutput.replace("chainlink version ", "").trim();
const [version, sha] = cleanedOutput.split("@");
if (!version || !sha) {
throw new Error("Version or SHA not found in output.");
}

if (sha.trim() !== repoSha) {
throw new Error(`SHA mismatch: Expected ${repoSha}, got ${sha.trim()}`);
}
if (version.trim() !== chainlinkVersion) {
throw new Error(
`Version mismatch: Expected ${chainlinkVersion}, got ${version.trim()}`
);
}

return { image, success: true, message: "Version check passed." };
} catch (error) {
return { image, success: false, message: error.message };
}
});

printSummary(results);
if (results.some((result) => !result.success)) {
process.exit(1);
}
}

main();
function printSummary(results) {
const passed = results.filter((result) => result.success);
const failed = results.filter((result) => !result.success);

console.log("\nSummary:");
console.log(`Total images checked: ${results.length}`);
console.log(`Passed: ${passed.length}`);
console.log(`Failed: ${failed.length}`);

if (passed.length > 0) {
console.log("\nPassed images:");
passed.forEach((result) =>
console.log(`${result.image}:\n${result.message}`)
);
}

if (failed.length > 0) {
console.log("\nFailed images:");
failed.forEach((result) =>
console.log(`${result.image}:\n${result.message}`)
);
}
}

function findArtifactsJson() {
const distDir = path.resolve(process.cwd(), "dist");
const files = [];

function findJsonFiles(dir) {
const items = fs.readdirSync(dir, { withFileTypes: true });
for (const item of items) {
const fullPath = path.join(dir, item.name);
if (item.isDirectory()) {
findJsonFiles(fullPath);
} else if (item.isFile() && item.name === "artifacts.json") {
files.push(fullPath);
}
}
}

findJsonFiles(distDir);

if (files.length === 0) {
console.error("Error: No artifacts.json found in /dist.");
process.exit(1);
} else if (files.length > 1) {
console.error("Error: Multiple artifacts.json files found.");
process.exit(1);
}

return files[0];
}

function extractDockerImages(artifactsJsonPath) {
console.log(`Reading artifacts.json from: ${artifactsJsonPath}`);
const artifactsJson = JSON.parse(fs.readFileSync(artifactsJsonPath, "utf-8"));

const dockerImages = artifactsJson
.filter((artifact) => artifact.type === "Docker Image")
.map((artifact) => artifact.name);

if (dockerImages.length === 0) {
console.error("Error: No Docker images found in artifacts.json.");
process.exit(1);
}

function constructGoreleaserCommand(releaseType, goreleaserConfig) {
const version = getVersion();
console.log(`Found Docker images:\n - ${dockerImages.join("\n - ")}`);
return dockerImages;
}

function constructGoreleaserCommand(releaseType, version, goreleaserConfig) {
const flags = [];

checkReleaseType(releaseType);
Expand Down Expand Up @@ -59,6 +180,7 @@ function checkReleaseType(releaseType) {
console.error(
`Error: Invalid release type: ${releaseType}. Must be one of: ${validReleaseTypesStr}`
);
process.exit(1);
}
}

Expand All @@ -74,7 +196,7 @@ function mustGetEnv(key) {

function getVersion() {
try {
const pkgPath = process.cwd() + "/package.json";
const pkgPath = path.resolve(process.cwd(), "package.json");
console.log("Looking for chainlink version in package.json at: ", pkgPath);
const packageJson = require(pkgPath);
if (!packageJson.version) {
Expand All @@ -91,3 +213,5 @@ function getVersion() {
process.exit(1);
}
}

main();
2 changes: 1 addition & 1 deletion .github/workflows/automation-benchmark-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automation-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automation-nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automation-ondemand-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccip-chaos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ccip-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: ${{ secrets.LOKI_URL }} # CCIP has a different one for some reason
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
89 changes: 0 additions & 89 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,95 +244,6 @@ jobs:
echo "path_output=${resultsFile}" >> $GITHUB_OUTPUT
fi
detect-flakey-tests:
needs: [filter, core]
name: Flakey Test Detection
runs-on: ubuntu-latest
if: ${{ always() && github.actor != 'dependabot[bot]' }}
env:
CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable
permissions:
id-token: write
contents: read
steps:
- name: Checkout the repo
uses: actions/[email protected]
- name: Setup node
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: actions/[email protected]
- name: Setup NodeJS
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: ./.github/actions/setup-nodejs
with:
prod: "true"
- name: Setup Go
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: ./.github/actions/setup-go
- name: Setup Postgres
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: ./.github/actions/setup-postgres
- name: Touching core/web/assets/index.html
if: ${{ needs.filter.outputs.changes == 'true' }}
run: mkdir -p core/web/assets && touch core/web/assets/index.html
- name: Download Go vendor packages
if: ${{ needs.filter.outputs.changes == 'true' }}
run: go mod download
- name: Replace chainlink-evm deps
if: ${{ needs.filter.outputs.changes == 'true' && inputs.evm-ref != ''}}
shell: bash
run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@${{ inputs.evm-ref }}
- name: Build binary
if: ${{ needs.filter.outputs.changes == 'true' }}
run: go build -o chainlink.test .
- name: Setup DB
if: ${{ needs.filter.outputs.changes == 'true' }}
run: ./chainlink.test local db preparetest
- name: Load test outputs
if: ${{ needs.filter.outputs.changes == 'true' }}
uses: actions/[email protected]
with:
name: go_core_tests_logs
path: ./artifacts
- name: Delete go_core_tests_logs/coverage.txt
if: ${{ needs.filter.outputs.changes == 'true' }}
shell: bash
run: |
# Need to delete coverage.txt so the disk doesn't fill up
rm -f ./artifacts/go_core_tests_logs/coverage.txt
- name: Build flakey test runner
if: ${{ needs.filter.outputs.changes == 'true' }}
run: go build ./tools/flakeytests/cmd/runner
- name: Re-run tests
if: ${{ needs.filter.outputs.changes == 'true' }}
env:
GRAFANA_INTERNAL_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
./runner \
-grafana_auth=$GRAFANA_INTERNAL_BASIC_AUTH \
-grafana_host=$GRAFANA_INTERNAL_HOST \
-grafana_org_id=$GRAFANA_INTERNAL_TENANT_ID \
-gh_sha=$GITHUB_SHA \
-gh_event_path=$GITHUB_EVENT_PATH \
-gh_event_name=$GITHUB_EVENT_NAME \
-gh_run_id=$GITHUB_RUN_ID \
-gh_repo=$GITHUB_REPO \
-command=./tools/bin/go_core_tests \
`ls -R ./artifacts/output.txt`
- name: Store logs artifacts
if: ${{ needs.filter.outputs.changes == 'true' && always() }}
uses: actions/[email protected]
with:
name: flakey_test_runner_logs
path: |
./output.txt
retention-days: 7

scan:
name: SonarQube Scan
needs: [core]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/client-compatibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ jobs:
E2E_TEST_SELECTED_NETWORK: ${{ env.SELECTED_NETWORKS}}
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CHAINLINK_IMAGE }}
E2E_TEST_CHAINLINK_VERSION: ${{ needs.select-versions.outputs.chainlink_image_version }}
E2E_TEST_LOKI_TENANT_ID: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
E2E_TEST_LOKI_ENDPOINT: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
E2E_TEST_LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
E2E_TEST_LOKI_ENDPOINT: ${{ secrets.LOKI_URL }}
E2E_TEST_LOKI_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
E2E_TEST_GRAFANA_DASHBOARD_URL: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs"
E2E_TEST_GRAFANA_BEARER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-chaos-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GRAFANA_INTERNAL_URL_SHORTENER_TOKEN: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
LOKI_TENANT_ID: ${{ secrets.LOKI_TENANT_ID }}
LOKI_URL: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push
LOKI_URL: ${{ secrets.LOKI_URL }}
LOKI_BASIC_AUTH: ${{ secrets.LOKI_BASIC_AUTH }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
Expand Down
Loading

0 comments on commit c26973f

Please sign in to comment.