-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update actions #28
Update actions #28
Conversation
WalkthroughThis update introduces several new GitHub Actions workflows, enhancing CI/CD capabilities. The new actions include Changes
Sequence Diagram(s)sequenceDiagram
participant CI as CI/CD Pipeline
participant DB as Docker Build Action
participant PL as Print Logs Action
participant RS as Retry Script Action
participant UA as Upload Artifacts Action
CI->>DB: Trigger Docker build
DB->>DB: Build and push Docker image
CI->>PL: Trigger log printing
PL->>PL: Print logs from specified path
CI->>RS: Trigger script execution
RS->>RS: Execute script with retries
CI->>UA: Trigger file upload
UA->>UA: Upload files to S3 and print URLs
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (4)
Additional comments not posted (14)
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
- name: print logs | ||
shell: bash | ||
working-directory: ${{ inputs.path }} | ||
run: > | ||
for log in ./*; | ||
do | ||
if [ -d ./"$log" ]; then | ||
for logInDir in "$log"/*; | ||
do | ||
echo "::group::$logInDir"; | ||
/bin/cat "$logInDir"; | ||
echo "::endgroup::"; | ||
done; | ||
else | ||
echo "::group::$log"; | ||
/bin/cat "$log"; | ||
echo "::endgroup::"; | ||
fi; | ||
done |
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.
Improve readability and efficiency of log printing steps.
The current logic is correct but can be improved for readability and efficiency. Consider using find
to simplify the iteration over files and directories.
- for log in ./*;
- do
- if [ -d ./"$log" ]; then
- for logInDir in "$log"/*;
- do
- echo "::group::$logInDir";
- /bin/cat "$logInDir";
- echo "::endgroup::";
- done;
- else
- echo "::group::$log";
- /bin/cat "$log";
- echo "::endgroup::";
- fi;
- done
+ find . -type f | while read log;
+ do
+ echo "::group::$log";
+ /bin/cat "$log";
+ echo "::endgroup::";
+ done
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: print logs | |
shell: bash | |
working-directory: ${{ inputs.path }} | |
run: > | |
for log in ./*; | |
do | |
if [ -d ./"$log" ]; then | |
for logInDir in "$log"/*; | |
do | |
echo "::group::$logInDir"; | |
/bin/cat "$logInDir"; | |
echo "::endgroup::"; | |
done; | |
else | |
echo "::group::$log"; | |
/bin/cat "$log"; | |
echo "::endgroup::"; | |
fi; | |
done | |
- name: print logs | |
shell: bash | |
working-directory: ${{ inputs.path }} | |
run: > | |
find . -type f | while read log; | |
do | |
echo "::group::$log"; | |
/bin/cat "$log"; | |
echo "::endgroup::"; | |
done |
- name: retry script | ||
shell: bash | ||
env: | ||
SCRIPT: ${{ inputs.script }} | ||
MAX_ATTEMPTS: ${{ inputs.attempts }} | ||
run: > | ||
set +e && for i in $(seq 1 "${{ env.MAX_ATTEMPTS }}"); | ||
do | ||
${{ env.SCRIPT }}; | ||
res="$?"; | ||
if [[ "$res" == "0" ]]; then | ||
exit "$res"; | ||
fi; | ||
if [[ "$i" == "${{ env.MAX_ATTEMPTS }}" ]]; then | ||
exit "$res"; | ||
fi; | ||
echo "::warning title=Retry::Current run $i failed of ${{ env.MAX_ATTEMPTS }} attempts"; | ||
done |
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.
Improve readability and efficiency of script retrying steps.
The current logic is correct but can be improved for readability and efficiency. Consider using a function to encapsulate the retry logic.
- set +e && for i in $(seq 1 "${{ env.MAX_ATTEMPTS }}");
- do
- ${{ env.SCRIPT }};
- res="$?";
- if [[ "$res" == "0" ]]; then
- exit "$res";
- fi;
- if [[ "$i" == "${{ env.MAX_ATTEMPTS }}" ]]; then
- exit "$res";
- fi;
- echo "::warning title=Retry::Current run $i failed of ${{ env.MAX_ATTEMPTS }} attempts";
- done
+ retry() {
+ for i in $(seq 1 "$1"); do
+ $2
+ res="$?"
+ if [[ "$res" == "0" ]]; then
+ return 0
+ fi
+ echo "::warning title=Retry::Current run $i failed of $1 attempts"
+ done
+ return "$res"
+ }
+ set +e
+ retry "${{ env.MAX_ATTEMPTS }}" "${{ env.SCRIPT }}"
+ exit "$?"
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: retry script | |
shell: bash | |
env: | |
SCRIPT: ${{ inputs.script }} | |
MAX_ATTEMPTS: ${{ inputs.attempts }} | |
run: > | |
set +e && for i in $(seq 1 "${{ env.MAX_ATTEMPTS }}"); | |
do | |
${{ env.SCRIPT }}; | |
res="$?"; | |
if [[ "$res" == "0" ]]; then | |
exit "$res"; | |
fi; | |
if [[ "$i" == "${{ env.MAX_ATTEMPTS }}" ]]; then | |
exit "$res"; | |
fi; | |
echo "::warning title=Retry::Current run $i failed of ${{ env.MAX_ATTEMPTS }} attempts"; | |
done | |
- name: retry script | |
shell: bash | |
env: | |
SCRIPT: ${{ inputs.script }} | |
MAX_ATTEMPTS: ${{ inputs.attempts }} | |
run: > | |
retry() { | |
for i in $(seq 1 "$1"); do | |
$2 | |
res="$?" | |
if [[ "$res" == "0" ]]; then | |
return 0 | |
fi | |
echo "::warning title=Retry::Current run $i failed of $1 attempts" | |
done | |
return "$res" | |
} | |
set +e | |
retry "${{ env.MAX_ATTEMPTS }}" "${{ env.SCRIPT }}" | |
exit "$?" |
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
env: | ||
PROJECT: ${{ inputs.name }} | ||
with: | ||
no-cache: true | ||
push: true | ||
tags: allthings/${{ env.PROJECT }}:${{ steps.export_tag_name_and_platforms.outputs.tag_name }} | ||
platforms: ${{ steps.export_tag_name_and_platforms.outputs.platforms }} | ||
context: ${{ inputs.context }} |
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.
Improve readability and efficiency of Docker build and push steps.
The current logic is correct but can be improved for readability and efficiency. Consider using environment variables to simplify the inputs.
- uses: docker/build-push-action@v6
- env:
- PROJECT: ${{ inputs.name }}
- with:
- no-cache: true
- push: true
- tags: allthings/${{ env.PROJECT }}:${{ steps.export_tag_name_and_platforms.outputs.tag_name }}
- platforms: ${{ steps.export_tag_name_and_platforms.outputs.platforms }}
- context: ${{ inputs.context }}
+ uses: docker/build-push-action@v6
+ with:
+ no-cache: true
+ push: true
+ tags: allthings/${{ inputs.name }}:${{ steps.export_tag_name_and_platforms.outputs.tag_name }}
+ platforms: ${{ steps.export_tag_name_and_platforms.outputs.platforms }}
+ context: ${{ inputs.context }}
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: Build and push | |
uses: docker/build-push-action@v6 | |
env: | |
PROJECT: ${{ inputs.name }} | |
with: | |
no-cache: true | |
push: true | |
tags: allthings/${{ env.PROJECT }}:${{ steps.export_tag_name_and_platforms.outputs.tag_name }} | |
platforms: ${{ steps.export_tag_name_and_platforms.outputs.platforms }} | |
context: ${{ inputs.context }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
no-cache: true | |
push: true | |
tags: allthings/${{ inputs.name }}:${{ steps.export_tag_name_and_platforms.outputs.tag_name }} | |
platforms: ${{ steps.export_tag_name_and_platforms.outputs.platforms }} | |
context: ${{ inputs.context }} |
Update actions from workflow
Summary by CodeRabbit