-
Notifications
You must be signed in to change notification settings - Fork 80
Timelock build pipeline #1305
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
base: main
Are you sure you want to change the base?
Timelock build pipeline #1305
Changes from all commits
ced059b
b55a32a
fe82208
8df9d5d
ed3c173
d32b636
e5c5769
d5f4176
bcdd1b3
55a8d87
33a5b87
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,102 @@ | |||||||||||||||||
| name: build & deploy | |||||||||||||||||
|
|
|||||||||||||||||
| on: | |||||||||||||||||
| push: | |||||||||||||||||
| branches: | |||||||||||||||||
| - main | |||||||||||||||||
| - '*' | |||||||||||||||||
| paths: | |||||||||||||||||
| - 'script/deploy/safe/ExecutePendingTimelock.Dockerfile' | |||||||||||||||||
| - 'script/deploy/safe/execute-pending-timelock-tx.ts' | |||||||||||||||||
| - 'package.json' | |||||||||||||||||
| - 'package-lock.json' | |||||||||||||||||
| pull_request: | |||||||||||||||||
| branches: | |||||||||||||||||
| - main | |||||||||||||||||
| paths: | |||||||||||||||||
| - 'script/deploy/safe/ExecutePendingTimelock.Dockerfile' | |||||||||||||||||
| - 'script/deploy/safe/execute-pending-timelock-tx.ts' | |||||||||||||||||
| - 'package.json' | |||||||||||||||||
| - 'package-lock.json' | |||||||||||||||||
|
|
|||||||||||||||||
| env: | |||||||||||||||||
| context: . | |||||||||||||||||
| dockerfile: script/deploy/safe/ExecutePendingTimelock.Dockerfile | |||||||||||||||||
|
|
|||||||||||||||||
| jobs: | |||||||||||||||||
| build: | |||||||||||||||||
| if: github.ref == 'refs/heads/main' | |||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||
| permissions: | |||||||||||||||||
| id-token: write | |||||||||||||||||
| contents: read | |||||||||||||||||
| steps: | |||||||||||||||||
| - name: Checkout repository | |||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Configure AWS credentials | |||||||||||||||||
| uses: aws-actions/configure-aws-credentials@v4 | |||||||||||||||||
| with: | |||||||||||||||||
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |||||||||||||||||
| role-session-name: github-actions-role-session | |||||||||||||||||
| aws-region: ${{ secrets.AWS_REGION }} | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Amazon ECR login | |||||||||||||||||
| id: login-ecr | |||||||||||||||||
| uses: aws-actions/amazon-ecr-login@v2 | |||||||||||||||||
| with: | |||||||||||||||||
| mask-password: "true" | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Set up Docker Buildx | |||||||||||||||||
| uses: docker/setup-buildx-action@v3 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Set current date as env variable | |||||||||||||||||
| shell: bash | |||||||||||||||||
| run: echo "UNIQ_ID=$(date +'%y%m%d')-${GITHUB_SHA:0:7}" >> $GITHUB_ENV | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Docker meta | |||||||||||||||||
| id: meta | |||||||||||||||||
| uses: docker/metadata-action@v5 | |||||||||||||||||
| with: | |||||||||||||||||
| images: ${{ secrets.ECR_REGISTRY }}/${{ secrets.TIMELOCK_IMAGE_NAME }} | |||||||||||||||||
| tags: | | |||||||||||||||||
| type=raw,value=${{ env.UNIQ_ID }}-main | |||||||||||||||||
| type=ref,event=branch | |||||||||||||||||
| type=ref,event=branch,prefix=${{ env.UNIQ_ID }}- | |||||||||||||||||
| type=raw,value=latest | |||||||||||||||||
| - name: Build and push Docker image | |||||||||||||||||
| uses: docker/build-push-action@v5 | |||||||||||||||||
| with: | |||||||||||||||||
| context: ${{ env.context }} | |||||||||||||||||
| file: ${{ env.dockerfile }} | |||||||||||||||||
| push: true | |||||||||||||||||
| platforms: linux/arm64 | |||||||||||||||||
| tags: ${{ steps.meta.outputs.tags }} | |||||||||||||||||
| labels: ${{ steps.meta.outputs.labels }} | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Inspect image | |||||||||||||||||
| run: | | |||||||||||||||||
| docker buildx imagetools inspect ${{ secrets.ECR_REGISTRY }}/${{ secrets.TIMELOCK_IMAGE_NAME }}:${{ env.UNIQ_ID }}-main | |||||||||||||||||
| build-branch-dockerfile: | |||||||||||||||||
| if: github.ref != 'refs/heads/main' | |||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||
| steps: | |||||||||||||||||
| - name: checkout code | |||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: set up docker buildx | |||||||||||||||||
| uses: docker/setup-buildx-action@v3 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: get short sha | |||||||||||||||||
| id: vars | |||||||||||||||||
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |||||||||||||||||
|
|
|||||||||||||||||
| - name: build docker image (test only) | |||||||||||||||||
| run: | | |||||||||||||||||
| docker buildx build \ | |||||||||||||||||
| --no-cache \ | |||||||||||||||||
| --platform linux/arm64 \ | |||||||||||||||||
| -f script/deploy/safe/ExecutePendingTimelock.Dockerfile \ | |||||||||||||||||
| -t image-test:${{ steps.vars.outputs.sha_short }} . | |||||||||||||||||
|
Comment on lines
+83
to
+102
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 4 months ago To fix the issue, add a The changes will be made in the
Suggested changeset
1
.github/workflows/build-and-push.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ fi | |
| echo "" | ||
| echo "" | ||
| echo "Running 'bun lint-staged' now:" | ||
| bun lint-staged | ||
| # bun lint-staged | ||
|
|
||
|
Comment on lines
15
to
17
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. 💡 Verification agent 🧩 Analysis chainDisabling lint-staged removes an important safety net — reconsider or gate behind an env flag -# bun lint-staged
+if [ -z "$SKIP_LINT" ]; then
+ bun lint-staged
+fiDevelopers can then opt-out with 🏁 Script executed: #!/bin/bash
# Search for any use of lint-staged in code, config, and scripts
rg -n "lint-?staged"
# Check for lint-staged configuration files
fd -HI ".lintstagedrc*"
fd -HI "lint-staged.config.js"
# Inspect the beginning of the pre-commit hook to confirm context
sed -n '1,30p' .husky/pre-commitLength of output: 2142 Re-enable lint-staged in pre-commit hook or gate behind an env flag • File: - echo "Running 'bun lint-staged' now:"
- # bun lint-staged
+ if [ -z "$SKIP_LINT" ]; then
+ echo "Running 'bun lint-staged' now:"
+ bun lint-staged
+ fiDevelopers can skip the hook with: SKIP_LINT=1 git commit …🤖 Prompt for AI Agents |
||
| echo "" | ||
| echo "" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy the repo | ||
| COPY . . | ||
|
|
||
| # Install deps including nodejs (for better compatibility) | ||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential \ | ||
| python3 \ | ||
| nodejs \ | ||
| npm \ | ||
| libudev-dev \ | ||
| libusb-1.0-0-dev \ | ||
| curl \ | ||
| jq \ | ||
| sudo \ | ||
| unzip \ | ||
| git \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Bun | ||
| RUN curl -fsSL https://bun.sh/install | bash | ||
| ENV PATH="/root/.bun/bin:$PATH" | ||
|
|
||
|
Comment on lines
+23
to
+26
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. 💡 Verification agent ❓ Verification inconclusiveRemote install script executed without checksum ⇒ supply version pin or signature check ARG BUN_VERSION=1.0.17
RUN curl -fsSL https://bun.sh/install | bash -s -- --version $BUN_VERSION --yes \
&& echo "$BUN_SHA256 /root/.bun/bin/bun" | sha256sum -c -Pin Bun installer and verify checksum in Dockerfile • Define build arguments for the Bun version and its expected SHA-256 checksum Example snippet: # Install Bun (pinned version + checksum verification)
ARG BUN_VERSION=1.0.17
ARG BUN_SHA256=<insert-official-sha256-here>
RUN curl -fsSL https://bun.sh/install \
| bash -s -- --version "$BUN_VERSION" --yes \
&& echo "$BUN_SHA256 /root/.bun/bin/bun" | sha256sum -c -
ENV PATH="/root/.bun/bin:$PATH"– Replace 🤖 Prompt for AI Agents |
||
| # Install Foundry | ||
| RUN curl -L https://foundry.paradigm.xyz | bash | ||
| ENV PATH="/root/.foundry/bin:$PATH" | ||
|
|
||
| RUN foundryup | ||
|
Comment on lines
+27
to
+31
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. 🛠️ Refactor suggestion Same integrity concern for Foundry install 🤖 Prompt for AI Agents |
||
| RUN bun install --frozen-lockfile --production | ||
| RUN bun run typechain | ||
| RUN forge install | ||
|
|
||
| ENTRYPOINT ["bun", "run", "script/deploy/safe/execute-pending-timelock-tx.ts"] | ||
This file was deleted.
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
Second job misses explicit
permissionsblock — tighten token scopeStatic analysis flagged this. Add a minimal permissions block to
build-branch-dockerfilefor parity and least-privilege:🤖 Prompt for AI Agents