-
Notifications
You must be signed in to change notification settings - Fork 69
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
Staging workflow #4053
Staging workflow #4053
Conversation
WalkthroughThis pull request introduces a new GitHub Actions workflow file named Changes
Possibly related PRs
Poem
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: 1
π§Ή Outside diff range and nitpick comments (4)
.github/workflows/build-push-deploy-staging.yaml (4)
31-63
: Improve shell script robustness in secrets validationWhile the validation logic is good, the shell script could be more robust.
Apply these improvements:
- secret_value=$(printenv $secret) + secret_value=$(printenv "$secret")Also consider adding quotes around variable expansions in other places:
if [[ -z "${secret_value}" ]]; then𧰠Tools
πͺ actionlint
49-49: shellcheck reported issue in this script: SC2086:info:4:27: Double quote to prevent globbing and word splitting
(shellcheck)
70-84
: Consider optimizing cache configurationThe current cache setup is functional but could be more efficient.
Consider adding a restore-keys fallback to potentially reuse cache from previous builds:
with: path: '**/node_modules' key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-
130-148
: Improve Docker build script robustnessThe Docker build script needs proper variable quoting.
Apply these improvements:
- docker build -f Dockerfile.staging \ - --cache-from=$ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \ - -t $ECR_REGISTRY/$ECR_REPO_NAME:$SHA_TAG \ - -t $ECR_REGISTRY/$ECR_REPO_NAME:$LATEST_TAG \ - -t $ECR_REGISTRY/$ECR_REPO_NAME:$ENVIRONMENT_TAG \ + docker build -f Dockerfile.staging \ + --cache-from="${ECR_REGISTRY}/${ECR_REPO_NAME}:${LATEST_TAG}" \ + -t "${ECR_REGISTRY}/${ECR_REPO_NAME}:${SHA_TAG}" \ + -t "${ECR_REGISTRY}/${ECR_REPO_NAME}:${LATEST_TAG}" \ + -t "${ECR_REGISTRY}/${ECR_REPO_NAME}:${ENVIRONMENT_TAG}" \π§° Tools
πͺ actionlint
137-137: shellcheck reported issue in this script: SC2086:info:5:27: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:5:41: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:5:56: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:10:13: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:10:27: Double quote to prevent globbing and word splitting
(shellcheck)
159-170
: Add error handling to E2E test triggerWhile the implementation works, it could benefit from error handling.
Consider adding error handling:
curl -L \ + --fail \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ env.E2E_TESTS_PAT }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OasisDEX/e2e-tests/actions/workflows/ci_e2e_tests.yml/dispatches \ - -d "{\"ref\":\"main\", \"inputs\":{\"run_id\":\"${{ github.run_id }}\", \"repository\":\"${{ github.repository }}\"}}" + -d "{\"ref\":\"main\", \"inputs\":{\"run_id\":\"${{ github.run_id }}\", \"repository\":\"${{ github.repository }}\"}}" || { + echo "Failed to trigger E2E tests" + exit 1 + }
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
π Files selected for processing (1)
.github/workflows/build-push-deploy-staging.yaml
(1 hunks)
π§° Additional context used
πͺ actionlint
.github/workflows/build-push-deploy-staging.yaml
49-49: shellcheck reported issue in this script: SC2086:info:4:27: Double quote to prevent globbing and word splitting
(shellcheck)
67-67: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT
instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
(deprecated-commands)
137-137: shellcheck reported issue in this script: SC2086:info:5:27: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:5:41: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:5:56: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:6:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:7:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:17: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:31: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:8:46: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:10:13: Double quote to prevent globbing and word splitting
(shellcheck)
137-137: shellcheck reported issue in this script: SC2086:info:10:27: Double quote to prevent globbing and word splitting
(shellcheck)
151-151: shellcheck reported issue in this script: SC2086:info:1:34: Double quote to prevent globbing and word splitting
(shellcheck)
151-151: shellcheck reported issue in this script: SC2086:info:1:114: Double quote to prevent globbing and word splitting
(shellcheck)
π Additional comments (4)
.github/workflows/build-push-deploy-staging.yaml (4)
1-15
: LGTM! Well-structured workflow triggers and environment setup
The workflow configuration properly separates staging environment concerns and securely handles sensitive values through secrets.
16-30
: LGTM! Appropriate job configuration and environment setup
Good practices observed:
- Explicit Node.js version pinning
- Proper permissions configuration
- Latest Ubuntu runner
85-119
: LGTM! Well-configured build process
The build step is properly configured with:
- Appropriate NODE_OPTIONS for memory management
- Comprehensive environment variable setup
- Next.js build caching
120-129
: LGTM! Secure AWS authentication setup
Good use of OIDC for AWS authentication, which is a security best practice.
- name: Extract commit hash | ||
id: vars | ||
shell: bash | ||
run: | | ||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
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
Update deprecated GitHub Actions syntax
The set-output
command is deprecated.
Replace with the new syntax:
- echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
+ echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
π 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 commit hash | |
id: vars | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Extract commit hash | |
id: vars | |
shell: bash | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
π§° Tools
πͺ actionlint
67-67: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT
instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
(deprecated-commands)
Title
Changes π·ββοΈ
- item 1How to test π§ͺ
- step 1 ...Summary by CodeRabbit
New Features
dev
branch.Improvements