-
Notifications
You must be signed in to change notification settings - Fork 19
Split CI/CD workflows for ENSNode and ENSDb Playground deployments #2338
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "Deploy: Switch ENSDb Playground Environment" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "New ENSDb Playground environment" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: choice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - green | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - blue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| switch-environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # NOTE: this needs to run on GH runner because of some obscure skopeo permissions thing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Serialize ENSDb Playground environment switches. This workflow mutates a single Traefik production routing key; overlapping manual dispatches can race and leave routing determined by the last Redis write, not operator intent. Add a workflow-level deployment lock. Proposed fix on:
workflow_dispatch:
inputs:
target:
description: "New ENSDb Playground environment"
required: true
type: choice
options:
- green
- blue
+
+concurrency:
+ group: deploy-switch-ensdb-playground-environment
+ cancel-in-progress: false
jobs:📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[warning] 6-15: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting (concurrency-limits) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Switch Environment to ${{ inputs.target }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TARGET_ENVIRONMENT: ${{ inputs.target }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REDIS_URL: ${{ secrets.TRAEFIK_REDIS_URL }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
tk-o marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
ref_json="$(gh api repos/actions/checkout/git/ref/tags/v6)"
sha="$(jq -r '.object.sha' <<<"$ref_json")"
type="$(jq -r '.object.type' <<<"$ref_json")"
if [ "$type" = "tag" ]; then
gh api "repos/actions/checkout/git/tags/$sha" --jq '.object.sha'
else
echo "$sha"
fiRepository: namehash/ensnode Length of output: 1984 🌐 Web query:
💡 Result: The actions/checkout action, maintained by GitHub, includes a persist-credentials input that controls whether authentication credentials (the GitHub token or a provided SSH key) are configured in the local Git configuration [1][2]. Default Behavior and Recommendation: The default value for persist-credentials is true [3][4]. When enabled, the action configures the runner's local Git environment with credentials, which allows subsequent steps in the same job to execute authenticated Git commands [1][5]. Security experts and industry guidance, including the OWASP GitHub Actions Security Cheat Sheet, strongly recommend setting persist-credentials: false unless your workflow explicitly requires authenticated Git operations [6][7]. This practice is recommended to minimize the attack surface by preventing credentials from being stored in the environment, thereby reducing the risk of accidental exposure if the workflow is compromised [6][7]. Action Versioning and Hash Pinning: Regarding hash pinning, it is a recommended security best practice to pin all GitHub Actions to a specific commit SHA rather than using tags (like v4) [6][7]. This ensures that your workflow consistently runs the exact same code, protecting against potential supply chain attacks where a tag might be updated to point to malicious code [7]. Example Configuration: To implement these security recommendations, use the following pattern in your workflow YAML: - uses: actions/checkout@<FULL_COMMIT_SHA> with: persist-credentials: false Replace <FULL_COMMIT_SHA> with the specific 40-character commit hash of the version you intend to use [6][7]. Citations:
Harden the checkout step.
🧰 Tools🪛 zizmor (1.26.1)[warning] 27-30: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 28-28: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Calculate env variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case "$TARGET_ENVIRONMENT" in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "green") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "SLACK_TITLE=:large_green_circle: ENSDb Playground GREEN Environment Activated" >> "$GITHUB_ENV" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "blue") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "SLACK_TITLE=:large_blue_circle: ENSDb Playground BLUE Environment Activated" >> "$GITHUB_ENV" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "SLACK_TITLE=:large_red_circle: Unrecognized ENSDb Playground Environment Activated" >> "$GITHUB_ENV" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
tk-o marked this conversation as resolved.
tk-o marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Switch Traefik Routing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo apt update | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo apt install -y redis-tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ENSDB PLAYGROUND | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis-cli -u $REDIS_URL SET traefik/http/routers/ensdb-playground-router/service "${TARGET_ENVIRONMENT}-ensdb-playground" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Send Slack Notification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/actions/send_slack_notification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+55
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== Workflow snippet ==\n'
sed -n '45,65p' .github/workflows/deploy_switch_ensdb_playground_environment.yml
printf '\n== Action metadata ==\n'
sed -n '1,80p' .github/actions/send_slack_notification/action.yml
printf '\n== References to send_slack_notification ==\n'
rg -n "send_slack_notification|actionlint|description:" .github -SRepository: namehash/ensnode Length of output: 1955 🌐 Web query:
💡 Result: In GitHub Actions, the description field in the action.yml metadata file is required [1][2]. The official GitHub Actions metadata syntax documentation explicitly lists description as a required top-level key for defining an action [1][3]. Regarding actionlint, this static analysis tool enforces metadata requirements for local actions. Since version 1.7.0, actionlint has included checks for the action metadata file (action.yml or action.yaml) [4]. If the top-level description field is missing from your action.yml file, actionlint will report an error (e.g., 'description' section is missing) [4]. Because actionlint primarily focuses on checking workflow files rather than independently validating action.yml files in isolation, you may need to ensure your action is being referenced in a workflow or test file that actionlint scans, or verify your linting configuration, to see the error reported [4]. Citations:
Add the missing 🧰 Tools🪛 actionlint (1.7.12)[error] 56-56: description is required in metadata of "Send Slack notification" action at "/home/jailuser/git/.github/actions/send_slack_notification/action.yml" (action) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slack_title: ${{ env.SLACK_TITLE }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slack_message: "✅ Switch ENSDb Playground environment completed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.