-
Notifications
You must be signed in to change notification settings - Fork 205
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
Dev 105/preview githubaction #2879
Conversation
|
WalkthroughThis pull request introduces comprehensive updates to GitHub Actions workflows and application configurations across multiple projects. The changes focus on enhancing preview environment deployment, build processes, and Docker configurations. Key modifications include updating workflow permissions, adding manual trigger capabilities, adjusting job dependencies, and creating preview Dockerfiles for backoffice, KYB, and workflows dashboard applications. The changes streamline the deployment and build processes for different application components. Changes
Possibly Related PRs
Suggested Reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
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: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-preview-environment.yml (1)
71-71
: Fix formatting: Add space after comma in job dependenciesAdd space after comma in the
needs
array for better readability.- needs: [deploy-dev-pr-environment,build-wf-service] + needs: [deploy-dev-pr-environment, build-wf-service] - needs: [deploy-dev-pr-environment,build-backoffice] + needs: [deploy-dev-pr-environment, build-backoffice] - needs: [deploy-dev-pr-environment,build-kyb] + needs: [deploy-dev-pr-environment, build-kyb]Also applies to: 81-81, 91-91
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 71-71: too few spaces after comma
(commas)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
.github/workflows/build-preview-environment.yml
(5 hunks).github/workflows/build-push-docker-images.yml
(2 hunks).github/workflows/destroy-preview-environment.yml
(3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 71-71: too few spaces after comma
(commas)
[warning] 81-81: too few spaces after comma
(commas)
[warning] 91-91: too few spaces after comma
(commas)
🔇 Additional comments (8)
.github/workflows/build-push-docker-images.yml (2)
30-30
: LGTM: Permission addition is appropriate
The addition of packages: write
permission is necessary for pushing Docker images to the GitHub Container Registry (ghcr.io).
Line range hint 52-58
: Verify the impact of tag name change
The tag prefix has been changed from workflows-service@
to workflow-service@
. While this appears to be a bug fix, we should verify there are no existing tags using the old prefix.
✅ Verification successful
Let me verify if there are any references to the old tag prefix in the codebase to ensure we haven't missed any occurrences.
No existing tags or references found with either prefix
Based on the verification results, there are no existing tags with either the old prefix (workflows-service@
) or the new prefix (workflow-service@
). Additionally, there are no references to either prefix in the codebase. This suggests that this is likely a new tagging convention being introduced, and the change from workflows-service@
to workflow-service@
won't impact any existing tags or references.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for existing tags with both old and new prefixes
echo "Tags with old prefix (workflows-service@):"
git tag -l "workflows-service@*" | sort -V
echo "Tags with new prefix (workflow-service@):"
git tag -l "workflow-service@*" | sort -V
Length of output: 276
Script:
#!/bin/bash
# Search for any references to the old tag prefix in the codebase
echo "Files containing 'workflows-service@':"
rg -l "workflows-service@"
echo -e "\nFiles containing 'workflow-service@':"
rg -l "workflow-service@"
Length of output: 242
🧰 Tools
🪛 actionlint (1.7.4)
49-49: if: condition "${{ inputs.image_name }} == 'workflows-service'" is always evaluated to true because extra characters are around ${{ }}
(if-cond)
51-51: shellcheck reported issue in this script: SC2116:style:1:19: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'
(shellcheck)
.github/workflows/build-preview-environment.yml (3)
14-16
: LGTM: Permission updates are appropriate
The expanded write permissions are necessary for:
contents: write
: Checking out code and managing repository contentspull-requests: write
: Updating PR status and labelspackages: write
: Publishing Docker images
23-23
: LGTM: Manual trigger support added
Adding workflow_dispatch
support improves operational flexibility by allowing manual reruns when needed.
49-51
: Verify consistent branch name trimming across workflows
The branch name trimming has been changed from 8 to 7 characters. This change must be consistent across all workflows to prevent environment name mismatches.
✅ Verification successful
Branch name trimming is consistent across workflows
The verification shows that both workflow files (build-preview-environment.yml
and destroy-preview-environment.yml
) use the same trimming length of 7 characters (cut -c 1-7
), ensuring consistent environment naming.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for branch name trimming across all workflow files
echo "Checking branch name trimming in workflow files:"
rg -A 1 "cut -c" .github/workflows/
Length of output: 657
.github/workflows/destroy-preview-environment.yml (3)
21-21
: LGTM: Manual trigger support added
Adding workflow_dispatch
support allows manual cleanup of preview environments when needed.
46-48
: LGTM: Branch name trimming aligned with build workflow
The branch name trimming is now consistent with the build workflow, using 7 characters.
63-64
: LGTM: Manual trigger condition added
The destroy job's conditions now properly include the manual trigger case.
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: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/destroy-preview-environment.yml (1)
21-26
: Fix trailing whitespace and LGTM!The job conditions are well-structured and cover all necessary scenarios. However, there's a trailing space on line 22 that should be removed.
- (github.event_name == 'pull_request' && github.event.action == 'unlabeled' && github.event.label.name == 'deploy-pr') + (github.event_name == 'pull_request' && github.event.action == 'unlabeled' && github.event.label.name == 'deploy-pr')🧰 Tools
🪛 yamllint (1.35.1)
[error] 22-22: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/destroy-preview-environment.yml
(3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/destroy-preview-environment.yml
[error] 22-22: trailing spaces
(trailing-spaces)
🔇 Additional comments (3)
.github/workflows/destroy-preview-environment.yml (3)
68-69
: LGTM! Manual trigger support added consistently
The addition of workflow_dispatch
trigger support is well-aligned with the manual trigger capability in the deploy job, maintaining consistency throughout the workflow.
51-53
: Verify the impact of reducing branch name length
The change from 8 to 7 characters in TRIMMED_BRANCH_NAME
could affect existing environments or related workflows. Let's verify this change is consistent across all workflows.
✅ Verification successful
Branch name trimming length is consistent across workflows
The change to 7 characters is already consistent with the build-preview-environment.yml workflow, which also uses cut -c 1-7
. Both the build and destroy workflows are aligned in their branch name trimming approach.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any other workflows that might be affected by the branch name length change
# Search for similar branch name trimming patterns
rg -l 'cut -c 1-[0-9]' .github/workflows/
Length of output: 141
Script:
#!/bin/bash
# Let's check the exact trimming length in build-preview-environment.yml
rg 'cut -c 1-[0-9]' .github/workflows/build-preview-environment.yml -A 2 -B 2
Length of output: 466
Line range hint 74-91
: Verify GIT_TOKEN permissions for cross-repo operations
The workflow uses secrets.GIT_TOKEN
to trigger a workflow in the cloud-infra-config
repository. Please ensure this token has sufficient permissions to create repository dispatch events in the target repository.
🧰 Tools
🪛 yamllint (1.35.1)
[error] 22-22: trailing spaces
(trailing-spaces)
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: 6
🧹 Outside diff range and nitpick comments (3)
apps/backoffice-v2/Dockerfile.preview (2)
13-13
: Inconsistent PATH environment variable formatThe PATH variable uses an absolute path
/app/node_modules/.bin
while the kyb-app uses a relative path./node_modules/.bin
.Maintain consistency across Dockerfiles:
- ENV PATH="$PATH:/app/node_modules/.bin" + ENV PATH="$PATH:./node_modules/.bin"
1-17
: Consider creating a base Dockerfile templateBoth Dockerfiles (kyb-app and backoffice-v2) share almost identical configuration.
Consider:
- Creating a base Dockerfile template with ARG variables for customization:
# Base Dockerfile.template ARG NODE_VERSION=18.17.1 FROM node:${NODE_VERSION}-bullseye-slim ARG PORT=3000 ARG APP_USER=appuser WORKDIR /app # Security setup RUN groupadd -r ${APP_USER} && useradd -r -g ${APP_USER} ${APP_USER} COPY package.json . RUN npm install --strict-peer-deps COPY . . RUN npm run build --verbose ENV PATH="$PATH:./node_modules/.bin" EXPOSE ${PORT} USER ${APP_USER} CMD ["npm", "run", "prod:next", "--host"]
- Using it in individual Dockerfiles:
# apps/backoffice-v2/Dockerfile.preview ARG NODE_VERSION=18.17.1 ARG PORT=5137 ARG APP_USER=backoffice INCLUDE Dockerfile.template.github/workflows/build-preview-environment.yml (1)
72-72
: Fix formatting: Add space after comma in job dependenciesThe job dependencies list has formatting issues. Add a space after each comma for better readability.
- needs: [deploy-dev-pr-environment,build-wf-service] + needs: [deploy-dev-pr-environment, build-wf-service] - needs: [deploy-dev-pr-environment,build-backoffice] + needs: [deploy-dev-pr-environment, build-backoffice] - needs: [deploy-dev-pr-environment,build-kyb] + needs: [deploy-dev-pr-environment, build-kyb]Also applies to: 83-83, 94-94
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 72-72: too few spaces after comma
(commas)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.github/workflows/build-preview-environment.yml
(3 hunks).github/workflows/build-push-docker-images.yml
(3 hunks)apps/backoffice-v2/Dockerfile.preview
(1 hunks)apps/backoffice-v2/package.json
(1 hunks)apps/kyb-app/Dockerfile.preview
(1 hunks)apps/kyb-app/package.json
(1 hunks)apps/workflows-dashboard/Dockerfile.preview
(1 hunks)apps/workflows-dashboard/package.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/workflows-dashboard/Dockerfile.preview
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 72-72: too few spaces after comma
(commas)
[warning] 83-83: too few spaces after comma
(commas)
[warning] 94-94: too few spaces after comma
(commas)
🔇 Additional comments (5)
apps/workflows-dashboard/package.json (1)
11-11
: Verify script usage across applications
Ensure consistent usage of the new prod:next
script across all applications using Vite.
✅ Verification successful
Consistent prod:next
script configuration found across Vite applications
The verification shows that multiple applications are using the same prod:next
script configuration vite build && vite
, which indicates consistency in the build and serve commands across the Vite applications.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for prod:next script usage
fd -e json package.json -x jq -r '.scripts["prod:next"] // empty' {} \;
# Check for vite configuration
fd -e ts -e js vite.config -x cat {} \;
Length of output: 8767
.github/workflows/build-push-docker-images.yml (2)
26-29
: LGTM! Workflow enhancements look good
The changes improve the workflow by:
- Adding file parameter for flexible Dockerfile selection
- Adding necessary packages write permission
- Adding conditional build arguments for workflows-service
Also applies to: 34-34, 123-125
56-58
: Verify the version tag pattern change
The version tag pattern has changed from workflows-service@*
to workflow-service@*
. Please ensure this change is intentional and consistent with your tagging strategy.
.github/workflows/build-preview-environment.yml (2)
14-16
: LGTM! Workflow improvements look good
The changes enhance the workflow by:
- Adding manual trigger support
- Adding necessary write permissions
- Specifying correct Dockerfile for each service
- Establishing clear build dependencies
Also applies to: 23-23, 69-69, 80-80, 91-91, 102-102
49-49
: Verify impact of environment name length change
The branch name trimming has been reduced from 8 to 7 characters. This change could affect existing preview environments or cause naming conflicts.
✅ Verification successful
Let me gather more information about the environment naming pattern and its usage.
Based on the gathered information, I can now provide the final response:
Environment name length change is safe to proceed
The change from 8 to 7 characters for branch name trimming is safe because:
- The same change is consistently applied in both creation (
build-preview-environment.yml
) and cleanup (destroy-preview-environment.yml
) workflows - No other files in the codebase reference the preview environment names directly
- Recent workflow runs show no active, long-running preview environments that could be affected
- The change maintains uniqueness as demonstrated by the branch name samples (e.g., 'origin-d' vs 'origin-')
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for potential conflicts with existing environment names
echo "Checking for potential naming conflicts:"
git branch -r | while read -r branch; do
sanitized=$(echo "$branch" | tr "/" "-")
old_name=${sanitized:0:8}
new_name=${sanitized:0:7}
if [ "$old_name" != "$new_name" ]; then
echo "Branch: $branch"
echo " Old name (8 chars): $old_name"
echo " New name (7 chars): $new_name"
fi
done
Length of output: 841
Script:
#!/bin/bash
# Check the workflow file for environment name usage
echo "Checking environment name usage in workflow:"
rg -A 5 "TRIMMED_BRANCH_NAME" .github/workflows/
# Check for any other files that might use the environment name
echo -e "\nChecking other files for environment name references:"
rg "preview-env-"
# Check if there are any existing preview environments
echo -e "\nChecking for existing preview environments in workflow runs:"
gh run list --workflow=build-preview-environment.yml --json conclusion,headBranch,databaseId --limit 10
Length of output: 2853
apps/kyb-app/Dockerfile.preview
Outdated
FROM node:18.17.1-bullseye-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY ./package.json . | ||
|
||
RUN npm install --legacy-peer-deps | ||
|
||
COPY . . | ||
|
||
RUN npm run build --verbose | ||
|
||
ENV PATH="$PATH:./node_modules/.bin" | ||
|
||
EXPOSE 5201 | ||
|
||
CMD ["npm", "run", "prod:next", "--host"] |
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 Docker best practices
Several improvements could enhance security and efficiency:
- Add multi-stage build to reduce image size:
# Build stage
FROM node:18.17.1-bullseye-slim AS builder
WORKDIR /app
COPY package.json .
RUN npm install --strict-peer-deps
COPY . .
RUN npm run build --verbose
# Production stage
FROM node:18.17.1-bullseye-slim
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY package.json .
RUN npm install --production
ENV PATH="$PATH:./node_modules/.bin"
EXPOSE 5201
USER node
CMD ["npm", "run", "prod:next", "--host"]
- Add security measures:
+ RUN groupadd -r appuser && useradd -r -g appuser appuser
+ USER appuser
- Add health check:
+ HEALTHCHECK --interval=30s --timeout=3s \
+ CMD curl -f http://localhost:5201/health || exit 1
Committable suggestion skipped: line range outside the PR's diff.
@@ -8,6 +8,7 @@ | |||
"dev": "vite --host", | |||
"start": "vite", | |||
"build": "tsc && vite build", | |||
"prod:next": "vite build && vite", |
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.
Review production deployment configuration
The prod:next
script runs vite
without production mode after building, which could expose development features.
Consider:
- Using
vite preview
for production serving:
- "prod:next": "vite build && vite",
+ "prod:next": "vite build && vite preview --host",
- Adding environment configuration:
- "prod:next": "vite build && vite",
+ "prod:next": "NODE_ENV=production vite build && vite preview --host",
📝 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.
"prod:next": "vite build && vite", | |
"prod:next": "NODE_ENV=production vite build && vite preview --host", |
apps/kyb-app/package.json
Outdated
@@ -7,6 +7,7 @@ | |||
"dev": "vite", | |||
"start": "vite", | |||
"build": "tsc && vite build", | |||
"prod:next": "vite build && vite", |
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 potentially incorrect production script
The prod:next
script appears to be running Vite in development mode after building for production. This could lead to serving the development version instead of the production build.
Consider one of these alternatives:
- "prod:next": "vite build && vite",
+ "prod:next": "vite build && vite preview",
or
- "prod:next": "vite build && vite",
+ "prod:next": "vite build && serve dist",
📝 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.
"prod:next": "vite build && vite", | |
"prod:next": "vite build && vite preview", |
apps/backoffice-v2/package.json
Outdated
@@ -42,6 +42,7 @@ | |||
"start": "vite", | |||
"dev": "vite", | |||
"build": "cross-env NODE_OPTIONS=--max-old-space-size=32768 vite build", | |||
"prod:next": "vite build && vite", |
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.
Review the "prod:next" script implementation
The new script "prod:next": "vite build && vite"
has potential issues:
- Running
vite
aftervite build
starts the dev server with source files, not the built files - For production environments, you should serve the built files using
vite preview
- The existing
preview
script already handles this use case correctly
Consider one of these alternatives:
- "prod:next": "vite build && vite",
+ "prod:next": "vite build && vite preview",
Or use the existing preview
script:
# First build
npm run build
# Then preview the built files
npm run preview
Could you clarify the specific use case this script is intended to address? This would help ensure we implement the most appropriate solution.
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: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-preview-environment.yml (1)
72-72
: Fix formatting: Add space after comma in job dependenciesThe job dependencies list should have spaces after commas for better readability.
-needs: [deploy-dev-pr-environment,build-wf-service] +needs: [deploy-dev-pr-environment, build-wf-service] -needs: [deploy-dev-pr-environment,build-backoffice] +needs: [deploy-dev-pr-environment, build-backoffice] -needs: [deploy-dev-pr-environment,build-kyb] +needs: [deploy-dev-pr-environment, build-kyb]Also applies to: 83-83, 94-94
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 72-72: too few spaces after comma
(commas)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-preview-environment.yml
(3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 72-72: too few spaces after comma
(commas)
[warning] 83-83: too few spaces after comma
(commas)
[warning] 94-94: too few spaces after comma
(commas)
🔇 Additional comments (5)
.github/workflows/build-preview-environment.yml (5)
14-16
: LGTM: Permissions are correctly configured
The write permissions for contents, pull-requests, and packages are appropriate for the workflow's requirements of pushing Docker images and updating PR status.
69-69
: LGTM: Improved Dockerfile configuration
The addition of the file
parameter provides better flexibility in specifying different Dockerfiles for preview environments.
Also applies to: 80-80, 91-91, 102-102
Line range hint 104-127
: LGTM: Well-implemented deploy preview trigger
The deploy preview implementation includes proper error handling, logging, and secure usage of tokens.
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 72-72: too few spaces after comma
(commas)
[warning] 83-83: too few spaces after comma
(commas)
[warning] 94-94: too few spaces after comma
(commas)
[warning] 105-105: too few spaces after comma
(commas)
[warning] 105-105: too few spaces after comma
(commas)
[warning] 105-105: too few spaces after comma
(commas)
[warning] 105-105: too few spaces after comma
(commas)
80-80
: Verify the existence of preview Dockerfiles
Let's ensure that all required preview Dockerfiles exist in their respective locations.
Also applies to: 91-91, 102-102
✅ Verification successful
All required preview Dockerfiles are present
All the necessary Dockerfile.preview files exist in their expected locations:
- apps/backoffice-v2/Dockerfile.preview
- apps/kyb-app/Dockerfile.preview
- apps/workflows-dashboard/Dockerfile.preview
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for the existence of preview Dockerfiles
files_to_check=(
"apps/backoffice-v2/Dockerfile.preview"
"apps/kyb-app/Dockerfile.preview"
"apps/workflows-dashboard/Dockerfile.preview"
)
for file in "${files_to_check[@]}"; do
if [ ! -f "$file" ]; then
echo "Missing file: $file"
fi
done
Length of output: 414
Script:
#!/bin/bash
# Let's use fd to find all Dockerfile.preview files in the repository
fd "Dockerfile.preview$"
Length of output: 140
23-23
: Verify potential naming collisions with shortened environment names
The change from 8 to 7 characters for environment names could potentially increase the risk of naming collisions between different branches.
Let's analyze the potential impact:
Also applies to: 49-51
✅ Verification successful
After analyzing the workflow files and environment name generation logic, I can provide a definitive response regarding the potential naming collisions concern.
Environment naming scheme is safe from collisions
The environment naming implementation has several safeguards against collisions:
- Branch names are sanitized by replacing "/" with "-"
- The 7-character limit is applied after sanitization
- The environment names are used in a concurrency group that includes the full branch ref
- Each PR environment has its own isolated deployment through the concurrency group:
"deploy-${{ github.event.pull_request.head.ref }}"
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for potential naming collisions with 7-character prefixes
git branch -r | sed 's/origin\///' | while read branch; do
prefix=$(echo "$branch" | tr "/" "-" | cut -c 1-7)
echo "Branch: $branch, Prefix: $prefix"
done | sort -k3 | uniq -D -f2
Length of output: 311
Script:
#!/bin/bash
# Let's check the actual environment name generation logic in the workflow file
cat .github/workflows/build-preview-environment.yml
Length of output: 4777
Script:
#!/bin/bash
# Let's also check for any other workflow files that might be using similar environment naming patterns
fd -e yml -e yaml . .github/workflows/ --exec cat {}
Length of output: 66996
Script:
#!/bin/bash
# Let's check the git history to see if there were any past issues with environment names
git log --oneline -S "ENVIRONMENT_NAME" .github/workflows/
Length of output: 0
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: 0
♻️ Duplicate comments (3)
.github/workflows/build-preview-environment.yml (2)
49-49
:⚠️ Potential issueRevert branch name trimming to prevent naming conflicts
Reducing the branch name length to 7 characters increases the likelihood of naming conflicts in preview environments. This could lead to environment overwrites and deployment issues.
Apply this fix:
- TRIMMED_BRANCH_NAME=$(echo -n "$SANITIZED_BRANCH_NAME" | cut -c 1-7) + TRIMMED_BRANCH_NAME=$(echo -n "$SANITIZED_BRANCH_NAME" | cut -c 1-8)
91-91
: 🛠️ Refactor suggestionOptimize preview Dockerfiles for development environments
The preview Dockerfiles should be optimized specifically for development environments.
Consider implementing:
- Multi-stage builds to reduce image size
- Development-specific configurations
- Preview-specific build arguments
- Standardized PATH environment variables
Also applies to: 102-102, 113-113
.github/workflows/build-push-docker-images.yml (1)
49-64
:⚠️ Potential issueFix security vulnerabilities in AWS secret handling
The current implementation has several security issues:
- Secrets are exposed in GitHub outputs and environment variables
- Secret ID is not properly quoted
- AWS credentials action version needs updating
Apply these fixes:
- uses: aws-actions/configure-aws-credentials@v3 + uses: aws-actions/configure-aws-credentials@v4- secret_value=$(aws secretsmanager get-secret-value --secret-id ${{ vars.PREVIEW_SECRET }} --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET') - echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_ENV - echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_OUTPUT + secret_value=$(aws secretsmanager get-secret-value --secret-id "${{ vars.PREVIEW_SECRET }}" --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET') + echo "SUBMODULE_SECRET=***" >> $GITHUB_ENV + echo "::add-mask::$secret_value" + echo "SUBMODULE_SECRET=$secret_value" >> "$GITHUB_OUTPUT"🧰 Tools
🪛 actionlint (1.7.4)
51-51: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
60-60: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
60-60: shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting
(shellcheck)
🧹 Nitpick comments (2)
.github/workflows/build-preview-environment.yml (1)
83-83
: Add spaces after commas in job dependenciesFor better readability, add spaces after commas in the needs array.
Apply this formatting:
- needs: [deploy-dev-pr-environment,build-wf-service-ee] + needs: [deploy-dev-pr-environment, build-wf-service-ee]Also applies to: 94-94, 105-105, 116-116
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 83-83: too few spaces after comma
(commas)
.github/workflows/build-push-docker-images.yml (1)
166-166
: Simplify build arguments conditional logicThe current build arguments use complex inline conditionals that are hard to read and maintain.
Consider refactoring to use a separate step for build arguments:
- name: Set build arguments id: build-args run: | if [[ "${{ inputs.image_name }}" == "workflows-service" ]]; then echo "args=RELEASE=${{ steps.version.outputs.tag }},SHORT_SHA=${{ steps.version.outputs.sha_short }}" >> $GITHUB_OUTPUT elif [[ "${{ inputs.image_name }}" == "workflows-service-ee" ]]; then echo "args=BASE_IMAGE=ghcr.io/ballerine-io/workflows-service:${{ inputs.tag }}" >> $GITHUB_OUTPUT fi - name: Build and push Docker image uses: docker/build-push-action@v5 with: # ... other options ... build-args: ${{ steps.build-args.outputs.args }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/build-preview-environment.yml
(3 hunks).github/workflows/build-push-docker-images.yml
(4 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 83-83: too few spaces after comma
(commas)
[warning] 94-94: too few spaces after comma
(commas)
[warning] 105-105: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
.github/workflows/build-push-docker-images.yml
[error] 65-65: trailing spaces
(trailing-spaces)
🪛 actionlint (1.7.4)
.github/workflows/build-push-docker-images.yml
51-51: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
60-60: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
60-60: shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting
(shellcheck)
92-92: if: condition "${{ inputs.image_name }} == 'workflows-service'" is always evaluated to true because extra characters are around ${{ }}
(if-cond)
🔇 Additional comments (4)
.github/workflows/build-preview-environment.yml (2)
14-16
: LGTM: Permissions are correctly configured
The write permissions for contents, pull-requests, and packages are appropriate for the workflow's operations.
60-70
: Verify the impact of switching to EE service
The workflow now uses the Enterprise Edition service instead of the original workflow service. Please verify:
- That this change is intentional
- That all dependent services are compatible with the EE version
Also applies to: 71-80
✅ Verification successful
Switching to Enterprise Edition service is intentional and properly configured
Based on the workflow file analysis:
- The change is intentional as all dependent services (backoffice, kyb, dashboard) are explicitly configured to depend on
build-wf-service-ee
job - The EE service is built using a dedicated Dockerfile (
Dockerfile.ee
) in the workflows-service directory - The change maintains the same interface with dependent services, just using the EE version instead
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for dependencies on the original workflow service
echo "Checking service dependencies:"
rg "workflows-service(?!-ee)" --type yaml
Length of output: 359
Script:
#!/bin/bash
# Check for dependencies on the original workflow service using a simpler pattern
echo "Checking service dependencies:"
rg "workflows-service" --type yaml -A 3
# Also check for any docker-compose references
echo -e "\nChecking docker-compose files:"
fd docker-compose | xargs cat
# Check for any k8s manifests that might reference the service
echo -e "\nChecking k8s manifests:"
fd -e yaml -e yml . k8s/ 2>/dev/null | xargs cat
Length of output: 13752
Script:
#!/bin/bash
# Let's check for any references to the EE version
echo "Checking EE service references:"
rg "workflows-service-ee" --type yaml -A 3
# Check the actual changes in the workflow file
echo -e "\nChecking the workflow file changes:"
cat .github/workflows/build-preview-environment.yml
Length of output: 5515
.github/workflows/build-push-docker-images.yml (2)
26-29
: LGTM: File parameter is well-defined
The file input parameter is properly documented and marked as required, which ensures proper specification of Dockerfile paths.
95-103
: Verify version management changes
The git tag retrieval logic is commented out, which could affect version consistency. Please verify:
- How versions will be managed without git tags
- The impact on existing version tracking
✅ Verification successful
Let me analyze the workflow service tags to understand the version management approach.
Based on the analysis of the workflow file and git tags, I can now provide a final response:
Version management is handled through GitHub Actions workflow
The commented out git tag retrieval logic has been replaced with a more robust version management system:
- The workflow now uses a custom GitHub Action (
bump-version
) to handle versioning - Version information is passed through workflow inputs and metadata actions
- Docker image tags are managed via
docker/metadata-action@v4
- Build args include
RELEASE
andSHORT_SHA
for the workflow service image
The changes represent an improvement to the versioning system rather than a regression, as:
- Version bumping is now handled by a dedicated action
- The workflow supports both regular and EE (Enterprise Edition) versions
- Version metadata is consistently applied across image builds
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check current version management
echo "Checking version tags:"
git fetch --tags origin
git tag -l "workflow-service@*" | sort -V
Length of output: 80235
Script:
#!/bin/bash
# Check the workflow file for version/tag references
echo "Checking workflow file for version references:"
cat .github/workflows/build-push-docker-images.yml
Length of output: 5975
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
🧹 Nitpick comments (3)
services/workflows-service/package.json (1)
15-15
: Add documentation for the preview environment setup.Consider adding a comment in the package.json to document the purpose and requirements of the preview environment setup. This will help other developers understand when and how to use this script.
Add this documentation above the scripts section:
"description": "workflow-service", + "scripts-documentation": { + "start:preview": "Prepares and starts the preview environment by running database migrations, data migrations, data sync, and starting the production server" + }, "scripts": {.github/workflows/build-preview-environment.yml (1)
116-116
: Fix comma spacing in job dependenciesAdd spaces after commas in the needs array for better readability:
-needs: [deploy-dev-pr-environment,build-wf-service,build-wf-service-ee,build-backoffice,build-kyb,build-dashboard] +needs: [deploy-dev-pr-environment, build-wf-service, build-wf-service-ee, build-backoffice, build-kyb, build-dashboard]🧰 Tools
🪛 yamllint (1.35.1)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
.github/workflows/build-push-docker-images.yml (1)
166-166
: Simplify build arguments logicThe current implementation is hard to read with multiple conditions in a single line:
- ${{ (inputs.image_name == 'workflows-service' && format('"RELEASE={0}"\n"SHORT_SHA={1}"', steps.version.outputs.tag, steps.version.outputs.sha_short)) || (inputs.image_name == 'workflows-service-ee' && format('"BASE_IMAGE=ghcr.io/ballerine-io/workflows-service:{0}"', inputs.tag)) || '' }} + ${{ inputs.image_name == 'workflows-service' && + format('"RELEASE={0}"\n"SHORT_SHA={1}"', + steps.version.outputs.tag, + steps.version.outputs.sha_short) || + inputs.image_name == 'workflows-service-ee' && + format('"BASE_IMAGE=ghcr.io/ballerine-io/workflows-service:{0}"', + inputs.tag) || + '' + }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/build-preview-environment.yml
(3 hunks).github/workflows/build-push-docker-images.yml
(5 hunks)services/workflows-service/package.json
(1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 72-72: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
[warning] 116-116: too few spaces after comma
(commas)
.github/workflows/build-push-docker-images.yml
[error] 65-65: trailing spaces
(trailing-spaces)
🪛 actionlint (1.7.4)
.github/workflows/build-push-docker-images.yml
51-51: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
60-60: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
60-60: shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting
(shellcheck)
94-94: shellcheck reported issue in this script: SC2116:style:3:19: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'
(shellcheck)
🔇 Additional comments (7)
services/workflows-service/package.json (1)
15-15
: LGTM! Verify the script dependencies.
The new start:preview
script combines database migrations, data migrations, data sync, and production server start in the correct order. All required dependencies are present in the package.json.
Let's verify the dependencies for each command in the script:
✅ Verification successful
All required scripts and dependencies are present and properly configured
The verification confirms that:
- All required scripts exist in package.json:
db:migrate-up
uses Prisma for database migrationsdb:data-migration:migrate
builds and runs data migration scriptsdb:data-sync
runs data sync scriptsstart:prod
runs the production server
- Required Prisma dependencies are present with matching versions:
prisma
v4.16.2@prisma/client
v4.16.2
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the presence and usage of dependencies required by the start:preview script
# Check if all the required scripts exist
echo "Checking for required scripts..."
for script in "db:migrate-up" "db:data-migration:migrate" "db:data-sync" "start:prod"; do
rg "\"$script\":" services/workflows-service/package.json
done
# Check for Prisma dependencies (required for migrations)
echo "Checking Prisma dependencies..."
rg "\"prisma\":" services/workflows-service/package.json
rg "\"@prisma/client\":" services/workflows-service/package.json
Length of output: 1241
.github/workflows/build-preview-environment.yml (4)
14-16
: LGTM: Permissions are correctly configured
The write permissions are appropriately set for the workflow's requirements.
49-49
: Revert branch name trimming to prevent naming conflicts
Reducing the branch name length to 7 characters increases the risk of naming conflicts in preview environments. This could lead to environment overwrites and deployment issues.
91-91
: Preview Dockerfiles need optimization and standardization
The preview Dockerfiles should be optimized for preview environments.
Also applies to: 102-102, 113-113
71-80
: Verify Dockerfile paths and dependencies
The workflow service EE job is well-structured with appropriate dependencies. Let's verify the Dockerfile paths exist:
✅ Verification successful
Dockerfile paths are correctly configured
Both required Dockerfile paths exist in the repository:
services/workflows-service/Dockerfile
services/workflows-service/Dockerfile.ee
The workflow job configuration is properly set up with the correct file paths and dependencies.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify Dockerfile paths exist
files=(
"services/workflows-service/Dockerfile"
"services/workflows-service/Dockerfile.ee"
)
for file in "${files[@]}"; do
if [ -f "$file" ]; then
echo "✓ Found $file"
else
echo "✗ Missing $file"
fi
done
Length of output: 461
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 72-72: too few spaces after comma
(commas)
.github/workflows/build-push-docker-images.yml (2)
97-97
: Incorrect tag pattern change needs to be reverted
The change from workflows-service@
to workflow-service@
breaks naming consistency.
61-64
:
Improve secret handling security
The current implementation exposes secrets in GitHub outputs and environment variables without proper masking:
- echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_ENV
- echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_OUTPUT
+ echo "::add-mask::$secret_value"
+ echo "SUBMODULE_SECRET=$secret_value" >> "$GITHUB_ENV"
+ echo "SUBMODULE_SECRET=***" >> "$GITHUB_OUTPUT"
Likely invalid or redundant comment.
run: git fetch --tags origin | ||
- name: Configure AWS credentials | ||
if: inputs.image_name == 'workflows-service-ee' | ||
uses: aws-actions/configure-aws-credentials@v3 |
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.
Update AWS credentials action version
The current version of aws-actions/configure-aws-credentials is outdated:
- uses: aws-actions/configure-aws-credentials@v3
+ uses: aws-actions/configure-aws-credentials@v4
📝 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.
uses: aws-actions/configure-aws-credentials@v3 | |
uses: aws-actions/configure-aws-credentials@v4 |
🧰 Tools
🪛 actionlint (1.7.4)
51-51: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
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: 0
🧹 Nitpick comments (4)
.github/workflows/deploy-wf-service.yml (4)
Line range hint
22-24
: Consider simplifying the SHORT_HASH environment variable logicThe current nested ternary expression is complex and hard to read. Consider refactoring to use a more explicit approach.
- SHORT_HASH: ${{ (inputs.environment == 'dev' && inputs.sha) || (inputs.environment == 'prod' && vars.SB_WF_SHORT_SHA) || (vars.DEV_WF_SHORT_SHA) }} + SHORT_HASH: ${{ + inputs.environment == 'dev' + && inputs.sha + || inputs.environment == 'prod' + && vars.SB_WF_SHORT_SHA + || vars.DEV_WF_SHORT_SHA + }}
Line range hint
155-162
: Optimize Docker layer cachingThe current cache configuration could be improved to reduce build times and resource usage.
Consider these optimizations:
- Use BuildKit's native caching instead of the actions/cache
- Implement cache versioning based on both Dockerfile and dependencies
- key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} + key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile', '**/package-lock.json', '**/yarn.lock') }}-v1
Line range hint
236-252
: Enhance error handling in Helm chart updatesThe current implementation doesn't explicitly handle potential failures in the YAML update process.
Consider adding error handling and validation:
- Validate the YAML structure before applying changes
- Add a post-update verification step
- Implement a rollback mechanism for failed updates
Line range hint
270-277
: Enhance Slack notifications with more deployment detailsThe current Slack message could provide more valuable information to help track and debug deployments.
Consider adding:
- Link to the GitHub Actions run
- Deployment duration
- List of changed components
- Link to the commit that triggered the deployment
- slack-message: "Test Wf-service Deployment in ${{ inputs.environment }} with tag ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }} build result: ${{ job.status }}. successfully updated the wf-service helm values for ${{ inputs.environment }}." + slack-message: | + 🚀 Wf-service Deployment Status + Environment: ${{ inputs.environment }} + Tag: ${{ env.SHORT_HASH }}-${{ needs.build-and-push-ee-image.outputs.SUBMODULE_SHORT_HASH }}-${{ inputs.environment }} + Result: ${{ job.status }} + Duration: ${{ steps.deploy-time.outputs.duration }} + + 📦 Updated Components: + - Wf-service + - Prisma Migrate + - DB Migrate + - Data Sync + + 🔗 Links: + - Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + - Commit: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/deploy-wf-service.yml
(1 hunks)
🔇 Additional comments (1)
.github/workflows/deploy-wf-service.yml (1)
114-114
: Be aware of potential race conditions with the 'latest' tag
While adding the 'latest' tag for production deployments is a common practice, be cautious of potential race conditions if multiple production deployments occur simultaneously. The 'latest' tag might not always reflect the most recent deployment.
Consider implementing a deployment lock mechanism or verifying that your deployment process prevents concurrent production deployments.
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
♻️ Duplicate comments (1)
.github/workflows/build-preview-environment.yml (1)
49-49
:⚠️ Potential issueCritical: Branch name trimming to 7 characters increases collision risk
As previously identified, reducing the branch name length to 7 characters significantly increases the risk of naming conflicts in preview environments. For example:
- Branches "feature-123" and "feature-124" would both become "feature"
- Branches "bal-2983" and "bal-2984" would both become "bal-298"
Recommendation: Maintain the previous 8-character length or implement a collision-safe naming strategy.
🧹 Nitpick comments (1)
.github/workflows/build-preview-environment.yml (1)
153-153
: Improve readability of job dependenciesThe comma-separated list of job dependencies could be more readable with proper spacing.
- needs: [deploy-dev-pr-environment,build-wf-service,build-wf-service-ee,build-backoffice,build-kyb,build-dashboard,build-unified-api] + needs: [ + deploy-dev-pr-environment, + build-wf-service, + build-wf-service-ee, + build-backoffice, + build-kyb, + build-dashboard, + build-unified-api + ]🧰 Tools
🪛 yamllint (1.35.1)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-preview-environment.yml
(3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-preview-environment.yml
120-120: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
123-123: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
127-127: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
135-135: shellcheck reported issue in this script: SC2086:info:2:42: Double quote to prevent globbing and word splitting
(shellcheck)
135-135: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 72-72: too few spaces after comma
(commas)
[error] 114-114: trailing spaces
(trailing-spaces)
[error] 150-150: trailing spaces
(trailing-spaces)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
[warning] 153-153: too few spaces after comma
(commas)
🔇 Additional comments (2)
.github/workflows/build-preview-environment.yml (2)
14-16
: LGTM: Permissions are correctly configured for the workflow requirements
The elevated permissions are necessary for:
- Pushing Docker images to GHCR
- Updating PR status
- Repository operations
23-23
: LGTM: Added manual trigger support while maintaining label-based automation
The condition correctly handles both automated (PR label) and manual (workflow_dispatch) triggers.
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: 'arm64,arm' | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v3 |
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 Docker-related action versions
The following actions have newer versions available:
docker/setup-buildx-action@v2
docker/setup-qemu-action@v2
aws-actions/configure-aws-credentials@v3
Update to the latest versions to ensure compatibility and security:
- uses: docker/setup-buildx-action@v2
+ uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
+ uses: docker/setup-qemu-action@v3
- uses: aws-actions/configure-aws-credentials@v3
+ uses: aws-actions/configure-aws-credentials@v4
📝 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: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64,arm' | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 |
🧰 Tools
🪛 actionlint (1.7.4)
120-120: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
123-123: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
127-127: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
docker pull ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest | ||
docker tag ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:${{ needs.deploy-dev-pr-environment.outputs.env_name }} |
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 Docker operations
The Docker pull and tag commands lack error handling and proper formatting.
- docker pull ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest
- docker tag ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:${{ needs.deploy-dev-pr-environment.outputs.env_name }}
+ if ! docker pull ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest; then
+ echo "Failed to pull latest image"
+ exit 1
+ fi
+ if ! docker tag ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest \
+ ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:${{ needs.deploy-dev-pr-environment.outputs.env_name }}; then
+ echo "Failed to tag image"
+ exit 1
+ fi
📝 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.
docker pull ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest | |
docker tag ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:${{ needs.deploy-dev-pr-environment.outputs.env_name }} | |
if ! docker pull ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest; then | |
echo "Failed to pull latest image" | |
exit 1 | |
fi | |
if ! docker tag ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:latest \ | |
ghcr.io/${{ github.repository_owner }}/${{ vars.UNIFIED_IMAGE_NAME }}:${{ needs.deploy-dev-pr-environment.outputs.env_name }}; then | |
echo "Failed to tag image" | |
exit 1 | |
fi |
🧰 Tools
🪛 yamllint (1.35.1)
[error] 150-150: trailing spaces
(trailing-spaces)
run: | | ||
secret_value=$(aws secretsmanager get-secret-value --secret-id ${{ vars.PREVIEW_SECRET }} --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET') | ||
echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_ENV | ||
echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_OUTPUT |
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 quotes to prevent shell word splitting
The secret retrieval script should properly quote variables to prevent potential issues with special characters.
- secret_value=$(aws secretsmanager get-secret-value --secret-id ${{ vars.PREVIEW_SECRET }} --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET')
+ secret_value=$(aws secretsmanager get-secret-value --secret-id "${{ vars.PREVIEW_SECRET }}" --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET')
- echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_ENV
+ echo "SUBMODULE_SECRET=${secret_value}" >> "$GITHUB_ENV"
- echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_OUTPUT
+ echo "SUBMODULE_SECRET=${secret_value}" >> "$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.
run: | | |
secret_value=$(aws secretsmanager get-secret-value --secret-id ${{ vars.PREVIEW_SECRET }} --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET') | |
echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_ENV | |
echo "SUBMODULE_SECRET=$secret_value" >> $GITHUB_OUTPUT | |
run: | | |
secret_value=$(aws secretsmanager get-secret-value --secret-id "${{ vars.PREVIEW_SECRET }}" --query 'SecretString' --output text | jq -r '.SUBMODULE_SECRET') | |
echo "SUBMODULE_SECRET=${secret_value}" >> "$GITHUB_ENV" | |
echo "SUBMODULE_SECRET=${secret_value}" >> "$GITHUB_OUTPUT" |
🧰 Tools
🪛 actionlint (1.7.4)
135-135: shellcheck reported issue in this script: SC2086:info:2:42: Double quote to prevent globbing and word splitting
(shellcheck)
135-135: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
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
♻️ Duplicate comments (4)
.github/workflows/build-preview-environment.yml (4)
49-49
:⚠️ Potential issueBranch name trimming may cause naming conflicts
Reducing the branch name length to 7 characters increases the risk of naming conflicts in preview environments. This could lead to environment overwrites when branch names share the same first 7 characters.
Consider keeping the original 8-character length to reduce collision probability.
119-127
: 🛠️ Refactor suggestionUpdate Docker-related action versions
The following actions have newer versions available:
docker/setup-buildx-action@v2
→v3
docker/setup-qemu-action@v2
→v3
aws-actions/configure-aws-credentials@v3
→v4
🧰 Tools
🪛 actionlint (1.7.4)
120-120: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
123-123: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
127-127: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
135-138
:⚠️ Potential issueAdd quotes to prevent shell word splitting
Shell variables should be properly quoted to prevent word splitting issues.
🧰 Tools
🪛 actionlint (1.7.4)
135-135: shellcheck reported issue in this script: SC2086:info:2:42: Double quote to prevent globbing and word splitting
(shellcheck)
135-135: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
149-151
: 🛠️ Refactor suggestionAdd error handling for Docker operations
The Docker commands should include error handling and proper formatting.
🧰 Tools
🪛 yamllint (1.35.1)
[error] 151-151: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-preview-environment.yml
(3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-preview-environment.yml
120-120: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
123-123: the runner of "docker/setup-qemu-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
127-127: the runner of "aws-actions/configure-aws-credentials@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
135-135: shellcheck reported issue in this script: SC2086:info:2:42: Double quote to prevent globbing and word splitting
(shellcheck)
135-135: shellcheck reported issue in this script: SC2086:info:3:42: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint (1.35.1)
.github/workflows/build-preview-environment.yml
[warning] 72-72: too few spaces after comma
(commas)
[error] 114-114: trailing spaces
(trailing-spaces)
[error] 151-151: trailing spaces
(trailing-spaces)
[warning] 154-154: too few spaces after comma
(commas)
[warning] 154-154: too few spaces after comma
(commas)
[warning] 154-154: too few spaces after comma
(commas)
[warning] 154-154: too few spaces after comma
(commas)
[warning] 154-154: too few spaces after comma
(commas)
[warning] 154-154: too few spaces after comma
(commas)
🔇 Additional comments (2)
.github/workflows/build-preview-environment.yml (2)
14-16
: LGTM: Permissions are correctly configured
The elevated write permissions are necessary for:
- Updating repository contents
- Managing pull request statuses
- Publishing container images to GitHub packages
23-23
: LGTM: Job condition properly handles both trigger types
The condition correctly handles both manual triggers and labeled PRs.
build-wf-service-ee: | ||
needs: [deploy-dev-pr-environment,build-wf-service] | ||
uses: ./.github/workflows/build-push-docker-images.yml | ||
with: | ||
registry: ghcr.io/${{ github.repository_owner }} | ||
context: services/workflows-service | ||
image_name: workflows-service-ee | ||
ref: ${{ needs.deploy-dev-pr-environment.outputs.ref }} | ||
tag: ${{ needs.deploy-dev-pr-environment.outputs.env_name }} | ||
file: 'services/workflows-service/Dockerfile.ee' |
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.
💡 Codebase verification
Dockerfile.ee needs to be updated with proper EE-specific configurations
The Dockerfile.ee appears to be incomplete compared to the base Dockerfile. While it exists at the correct location, it's missing critical configurations:
- No multi-stage build setup (dev/prod stages)
- Missing necessary dependencies installation (dumb-init)
- Missing build steps and file copies
- Missing environment variable configurations (RELEASE, SHORT_SHA)
The current EE Dockerfile seems to be just a minimal configuration that relies heavily on the BASE_IMAGE argument, but it should properly extend the base configuration with EE-specific additions.
🔗 Analysis chain
Verify the existence of Dockerfile.ee
Please verify that the Dockerfile.ee exists and contains the necessary EE-specific configurations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify Dockerfile.ee exists and contains EE-specific configurations
if [ -f "services/workflows-service/Dockerfile.ee" ]; then
echo "✓ Found Dockerfile.ee"
echo "Contents:"
cat "services/workflows-service/Dockerfile.ee"
else
echo "✗ Missing Dockerfile.ee"
fi
Length of output: 354
Script:
#!/bin/bash
# Let's verify if there's a non-EE Dockerfile to compare against
if [ -f "services/workflows-service/Dockerfile" ]; then
echo "✓ Found base Dockerfile"
echo "Contents of base Dockerfile:"
cat "services/workflows-service/Dockerfile"
else
echo "✗ Missing base Dockerfile"
fi
Length of output: 1181
🧰 Tools
🪛 yamllint (1.35.1)
[warning] 72-72: too few spaces after comma
(commas)
Modified the actions and resolved the action failures
Summary by CodeRabbit
New Features
backoffice-v2
,kyb-app
, andworkflows-dashboard
applications.package.json
forbackoffice-v2
,kyb-app
, andworkflows-dashboard
.package.json
forworkflows-service
.Improvements
latest
in the deployment workflow.Bug Fixes
Chores