-
Notifications
You must be signed in to change notification settings - Fork 26
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
Trigger tests #677
Trigger tests #677
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (1)
.github/workflows/deploy.yml (1)
203-238
: Enhance error handling and security in workflow dispatchThe workflow dispatch implementation could be improved in several areas:
- The error message in case of kernel mismatch could be more descriptive
- Consider validating the version map format before sending
- Add retry logic for the workflow dispatch in case of temporary failures
script: | const kernelAddress = '${{ inputs.kernel_address }}'; const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; // Read the version map const fs = require('fs'); const versionMap = fs.readFileSync('version_map.json', 'utf8'); + + // Validate version map format + try { + const parsedMap = JSON.parse(versionMap); + if (!parsedMap || typeof parsedMap !== 'object') { + throw new Error('Invalid version map format'); + } + } catch (error) { + core.setFailed(`Invalid version map: ${error.message}`); + return; + } let workflowFile; if (kernelAddress === testnetKernels) { workflowFile = 'develop.yml'; } else if (kernelAddress === testnetStagingKernels) { workflowFile = 'staging.yml'; } else { - core.setFailed('Error: Kernel not found in known configurations'); + core.setFailed(`Error: Kernel ${kernelAddress} not found in known configurations. Expected either ${testnetKernels} or ${testnetStagingKernels}`); return; } + const maxRetries = 3; + let attempt = 0; + try { - await github.rest.actions.createWorkflowDispatch({ - owner: 'andromedaprotocol', - repo: 'andromeda-armour', - workflow_id: workflowFile, - ref: 'main', - inputs: { - version_map: versionMap - } - }); + while (attempt < maxRetries) { + try { + await github.rest.actions.createWorkflowDispatch({ + owner: 'andromedaprotocol', + repo: 'andromeda-armour', + workflow_id: workflowFile, + ref: 'main', + inputs: { + version_map: versionMap + } + }); + break; + } catch (error) { + attempt++; + if (attempt === maxRetries) throw error; + await new Promise(resolve => setTimeout(resolve, 1000 * attempt)); + } + } } catch (error) { core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); }🧰 Tools
🪛 yamllint (1.35.1)
[error] 211-211: trailing spaces
(trailing-spaces)
[error] 215-215: trailing spaces
(trailing-spaces)
[error] 225-225: trailing spaces
(trailing-spaces)
[error] 238-238: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/deploy.yml
(2 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/deploy.yml
[warning] 114-114: wrong indentation: expected 4 but found 6
(indentation)
[error] 181-181: trailing spaces
(trailing-spaces)
[error] 190-190: trailing spaces
(trailing-spaces)
[error] 201-201: trailing spaces
(trailing-spaces)
[error] 211-211: trailing spaces
(trailing-spaces)
[error] 215-215: trailing spaces
(trailing-spaces)
[error] 225-225: trailing spaces
(trailing-spaces)
[error] 238-238: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
.github/workflows/deploy.yml (1)
114-114
: Verify schema availability after dependency removal
The job no longer depends on build_schemas
. Ensure that the schemas are still available through the artifact from the deploy
job.
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 114-114: wrong indentation: expected 4 but found 6
(indentation)
run: | | ||
echo "Waiting 6 minutes for schema updates to propagate..." | ||
sleep 360 | ||
echo "Wait complete, proceeding with Armor workflow trigger" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider implementing a more robust wait mechanism
The hard-coded 6-minute wait time is brittle and could lead to race conditions if schema updates take longer. Consider:
- Implementing a polling mechanism to check for schema availability
- Making the wait time configurable via workflow inputs
- Adding a timeout to prevent indefinite waiting
@@ -111,7 +111,7 @@ | |||
./andromeda-deploy | |||
|
|||
trigger-schema-parser: | |||
needs: [deploy, build_schemas] | |||
needs: [deploy] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix job indentation
The needs
field is incorrectly indented. It should be at the same level as runs-on
.
- needs: [deploy]
+ needs: [deploy]
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
needs: [deploy] | |
needs: [deploy] |
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 114-114: wrong indentation: expected 4 but found 6
(indentation)
- name: Extract version map | ||
run: | | ||
cd artifacts | ||
cat version_map.json | ||
cp version_map.json ../version_map.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for version map extraction
The version map extraction lacks error handling. If the file is missing or malformed, the workflow will fail without a clear error message.
- name: Extract version map
run: |
cd artifacts
+ if [ ! -f version_map.json ]; then
+ echo "Error: version_map.json not found"
+ exit 1
+ fi
+ if ! jq . version_map.json >/dev/null 2>&1; then
+ echo "Error: Invalid JSON in version_map.json"
+ exit 1
+ fi
cat version_map.json
cp version_map.json ../version_map.json
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: Extract version map | |
run: | | |
cd artifacts | |
cat version_map.json | |
cp version_map.json ../version_map.json | |
- name: Extract version map | |
run: | | |
cd artifacts | |
if [ ! -f version_map.json ]; then | |
echo "Error: version_map.json not found" | |
exit 1 | |
fi | |
if ! jq . version_map.json >/dev/null 2>&1; then | |
echo "Error: Invalid JSON in version_map.json" | |
exit 1 | |
fi | |
cat version_map.json | |
cp version_map.json ../version_map.json |
🧰 Tools
🪛 yamllint (1.35.1)
[error] 201-201: trailing spaces
(trailing-spaces)
Motivation
Added the final trigger for e2e tests:
Changes:
Summary by CodeRabbit