Skip to content

Conversation

@piyush-zlai
Copy link
Contributor

@piyush-zlai piyush-zlai commented Oct 30, 2024

Summary

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Enhanced Docker image tagging in the build workflow for better version control based on GitHub events.
    • Introduced a dynamic environment variable for container images in the testing workflow, allowing for context-based image selection.
  • Bug Fixes

    • Updated job definitions to use the new dynamic container image variable, improving consistency across workflows.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Walkthrough

The changes include updates to two GitHub Actions workflow files. The .github/workflows/build_and_push_docker.yaml file has been modified to enhance the Docker image build and push process, introducing new triggers and a step for setting dynamic Docker tags based on event types. The .github/workflows/test_scala_and_python.yaml file now includes a new job that determines the Docker image dynamically, affecting several job definitions to use this new image assignment.

Changes

File Change Summary
.github/workflows/build_and_push_docker.yaml Updated workflow triggers for pushes to main and changes to .github/image/Dockerfile; added a step to set Docker tags based on event type.
.github/workflows/test_scala_and_python.yaml Introduced a new job determine-image to dynamically assign Docker images for multiple jobs based on the event type.

Possibly related PRs

  • Wire up Play frontend + server in docker setup #24: Updates to the Dockerfile, directly related to the modifications in the GitHub Actions workflow for building and pushing Docker images.
  • Numpy vuln #39: Modifications to the start.sh script, relevant to the Docker environment setup and related to the main PR's changes on Docker image handling.

Suggested reviewers

  • chewy-zlai

🐰 In the garden where we play,
New workflows bloom, bright as day.
Docker images, tagged with care,
Pull requests dance, a joyful affair!
With every push, the changes flow,
Hopping along, we watch them grow! 🌼


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build_and_push_docker.yaml (2)

Line range hint 44-50: Critical: Build action ignores metadata tags.

The build-push-action is using a hardcoded 'latest' tag instead of the tags generated by the metadata action. This breaks the PR-specific image functionality.

Fix this by using the metadata action's tags:

      - name: Build and push Docker image
        uses: docker/build-push-action@v6
        with:
          context: .github/image
          push: true
-         tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
+         tags: ${{ steps.docker_meta.outputs.tags }}
+         labels: ${{ steps.docker_meta.outputs.labels }}

Also, add an id to the metadata step:

      - name: Extract metadata for Docker
+       id: docker_meta
        uses: docker/metadata-action@v5

Line range hint 1-50: Consider additional architectural improvements.

Since this is a WIP PR for setting up PR-specific Docker images, consider these architectural improvements:

  1. Add image cleanup strategy to prevent storage bloat from PR-specific images
  2. Configure build cache to speed up builds
  3. Add multi-platform build support if needed

Example improvements:

# Add cleanup workflow
name: Cleanup PR Docker Images
on:
  pull_request:
    types: [closed]

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
      - name: Delete PR-specific image
        uses: actions/delete-package-versions@v3
        with:
          package-name: ${{ env.IMAGE_NAME }}
          tag-prefix: 'pr-${{ github.event.pull_request.number }}'

For the build workflow:

      - name: Build and push Docker image
        uses: docker/build-push-action@v6
        with:
          context: .github/image
          push: true
          tags: ${{ steps.docker_meta.outputs.tags }}
+         platforms: linux/amd64,linux/arm64
+         cache-from: type=gha
+         cache-to: type=gha,mode=max
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a34a594 and c35532e.

📒 Files selected for processing (2)
  • .github/workflows/build_and_push_docker.yaml (2 hunks)
  • .github/workflows/test_scala_and_python.yaml (7 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/test_scala_and_python.yaml

19-19: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


60-60: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


79-79: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


98-98: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


117-117: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


136-136: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)


160-160: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)

🔇 Additional comments (1)
.github/workflows/test_scala_and_python.yaml (1)

9-13: Well-structured environment variable implementation!

The CONTAINER_IMAGE environment variable elegantly handles both PR-specific and default cases, supporting the goal of PR-specific docker images. The conditional logic and formatting are clear and maintainable.

Comment on lines +5 to +8
branches: [ main ]
paths:
- '.github/image/Dockerfile'
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using a more inclusive path pattern for Docker-related changes.

The current path filter might miss other Docker-related files that should trigger the workflow. Consider using a pattern like:

    paths:
-      - '.github/image/Dockerfile'
+      - '.github/image/**/*'
+      - '**/Dockerfile'
+      - '**/docker-compose*.yml'
+      - '**/docker-compose*.yaml'
📝 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.

Suggested change
branches: [ main ]
paths:
- '.github/image/Dockerfile'
pull_request:
branches: [ main ]
paths:
- '.github/image/**/*'
- '**/Dockerfile'
- '**/docker-compose*.yml'
- '**/docker-compose*.yaml'
pull_request:

Comment on lines 34 to 42
# Build and push pr specific images when there's changes to Dockerfile as part of a PR
# Update the 'latest' tag when the change hits master
- name: Extract metadata for Docker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance Docker image tagging strategy.

While the PR-specific tagging is good, consider these improvements:

  1. Add SHA-based tags for immutability
  2. Add semantic versioning tags for releases
  3. Move the embedded comments to the PR description or documentation
      - name: Extract metadata for Docker
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=ref,event=pr
            type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
+           type=sha,prefix=
+           type=semver,pattern={{version}}
+           type=semver,pattern={{major}}.{{minor}}
📝 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.

Suggested change
# Build and push pr specific images when there's changes to Dockerfile as part of a PR
# Update the 'latest' tag when the change hits master
- name: Extract metadata for Docker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
# Build and push pr specific images when there's changes to Dockerfile as part of a PR
# Update the 'latest' tag when the change hits master
- name: Extract metadata for Docker
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,prefix=
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}-ci:latest
image: ${{ env.CONTAINER_IMAGE }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix environment variable context usage in job containers.

The env context is not available in container definitions. This needs to be moved to the job level for proper context availability.

Apply this pattern to each job:

  python_tests:
    runs-on: ubuntu-latest
+   env:
+     CONTAINER_IMAGE: ${{ github.event_name == 'pull_request' && format('{0}/{1}-ci:pr-{2}', 'ghcr.io', github.repository, github.event.pull_request.number) || format('{0}/{1}-ci:latest', 'ghcr.io', github.repository) }}
    container:
-     image: ${{ env.CONTAINER_IMAGE }}
+     image: ${{ vars.CONTAINER_IMAGE }}
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

Alternatively, consider using a reusable workflow or composite action to avoid duplicating the environment variable definition across jobs.

Also applies to: 60-60, 79-79, 98-98, 117-117, 136-136, 160-160

🧰 Tools
🪛 actionlint

19-19: context "env" is not allowed here. available contexts are "github", "inputs", "matrix", "needs", "strategy", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details

(expression)

Comment on lines 9 to 13
# Define the container image we'd like to use:
# If this is in a PR we use the pr specific docker image (as there might be docker file changes)
# Else we use the 'latest' image
env:
CONTAINER_IMAGE: ${{ github.event_name == 'pull_request' && format('{0}/{1}-ci:pr-{2}', 'ghcr.io', github.repository, github.event.pull_request.number) || format('{0}/{1}-ci:latest', 'ghcr.io', github.repository) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Integration issue found with Docker image tagging

The Docker build workflow doesn't properly align with the test workflow's image reference pattern. While the test workflow expects PR-specific images with format ghcr.io/{repo}-ci:pr-{number}, the build workflow:

  • Uses different tag format via type=ref,event=pr
  • Always pushes with :latest tag instead of PR-specific tags

This mismatch will cause the test workflow to fail when looking for PR-specific images.

Required changes in build_and_push_docker.yaml:

  • Update tags configuration to use pr-${{ github.event.pull_request.number }} format for PRs
  • Use the tags output from metadata-action in the build-push-action
🔗 Analysis chain

Verify integration with Docker build workflow.

Since this workflow depends on PR-specific Docker images, let's verify the build workflow configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Docker build workflow configuration

# Check if the Docker build workflow exists and contains PR-specific image building
rg -l 'build.*docker' .github/workflows/ | xargs rg 'pr-\${{ github.event.pull_request.number }}'

# Verify the image naming pattern matches between workflows
rg -l 'CONTAINER_IMAGE' .github/workflows/ | xargs rg 'ghcr.io/.*-ci:'

Length of output: 302


Script:

#!/bin/bash
# Let's try a different approach to verify Docker-related workflows

# Find Docker-related workflow files
echo "=== Docker-related workflow files ==="
fd workflow .github/workflows/ --exec grep -l "docker" {} \;

# Check contents of these files for PR-specific image building
echo -e "\n=== Checking PR-specific image building patterns ==="
rg "pr-.*github.*pull_request" .github/workflows/

# Check container image patterns
echo -e "\n=== Container image patterns ==="
rg "CONTAINER_IMAGE|ghcr.io" .github/workflows/

Length of output: 1638


Script:

#!/bin/bash
# Let's check the build_and_push_docker.yaml workflow content

echo "=== Docker build workflow content ==="
cat .github/workflows/build_and_push_docker.yaml

Length of output: 1443

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (2)
.github/workflows/build_and_push_docker.yaml (1)

44-50: Consider enhancing Docker build configuration.

The current build configuration could benefit from:

  1. Enabling layer caching to speed up builds
  2. Supporting multi-stage builds
  3. Handling build arguments

Example enhancement:

       - name: Build and push Docker image
         uses: docker/build-push-action@v6
         with:
           context: .github/image
           push: true
           tags: ${{ steps.docker_tag.outputs.tag }}
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
+          build-args: |
+            BUILDKIT_INLINE_CACHE=1
🧰 Tools
🪛 yamllint

[error] 50-50: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/test_scala_and_python.yaml (1)

Line range hint 27-182: Consider using reusable workflow to reduce configuration duplication.

The container configuration is duplicated across all test jobs. Consider extracting it into a reusable workflow to improve maintainability.

Create a new file .github/workflows/reusable-container-job.yml:

name: Reusable Container Job
on:
  workflow_call:
    inputs:
      container_image:
        required: true
        type: string
      working_directory:
        required: true
        type: string
    secrets:
      GITHUB_TOKEN:
        required: true

jobs:
  container_job:
    runs-on: ubuntu-latest
    container:
      image: ${{ inputs.container_image }}
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}
    defaults:
      run:
        working-directory: ${{ inputs.working_directory }}

Then simplify the test jobs:

python_tests:
  needs: determine-image
  uses: ./.github/workflows/reusable-container-job.yml
  with:
    container_image: ${{ needs.determine-image.outputs.container_image }}
    working_directory: ${{ github.workspace }}
  secrets:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  steps:
    - uses: actions/checkout@v4
    # ... rest of the steps
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a64340a and b26812a.

📒 Files selected for processing (2)
  • .github/workflows/build_and_push_docker.yaml (2 hunks)
  • .github/workflows/test_scala_and_python.yaml (7 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/build_and_push_docker.yaml

38-38: shellcheck reported issue in this script: SC2086:info:2:86: Double quote to prevent globbing and word splitting

(shellcheck)


38-38: shellcheck reported issue in this script: SC2086:info:4:50: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/test_scala_and_python.yaml

19-19: shellcheck reported issue in this script: SC2086:info:3:99: Double quote to prevent globbing and word splitting

(shellcheck)


19-19: shellcheck reported issue in this script: SC2086:info:5:63: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 yamllint
.github/workflows/build_and_push_docker.yaml

[error] 50-50: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (2)
.github/workflows/build_and_push_docker.yaml (1)

5-8: Path pattern improvement already suggested.

A previous review has already suggested improving the path patterns for Docker-related changes.

.github/workflows/test_scala_and_python.yaml (1)

13-25: LGTM! Well-structured job for dynamic image selection.

The job correctly implements the logic for selecting PR-specific or latest Docker images, with clear output variable definition and proper GitHub context usage.

🧰 Tools
🪛 actionlint

19-19: shellcheck reported issue in this script: SC2086:info:3:99: Double quote to prevent globbing and word splitting

(shellcheck)


19-19: shellcheck reported issue in this script: SC2086:info:5:63: Double quote to prevent globbing and word splitting

(shellcheck)

Comment on lines +34 to +43
# Build and push pr specific images when there's changes to Dockerfile as part of a PR
# Update the 'latest' tag when the change hits master
- name: Set Docker tag
id: docker_tag
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "tag=${REGISTRY}/${IMAGE_NAME}:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "tag=${REGISTRY}/${IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Improve shell script robustness and move comments to documentation.

  1. The embedded comments should be moved to documentation or PR description
  2. Shell script variables should be quoted
  3. Consider using GitHub Actions expressions instead of shell script

Apply this diff to fix the shell script issues and use Actions expressions:

-      # Build and push pr specific images when there's changes to Dockerfile as part of a PR
-      # Update the 'latest' tag when the change hits master
-      - name: Set Docker tag
-        id: docker_tag
-        run: |
-          if [[ "${{ github.event_name }}" == "pull_request" ]]; then
-            echo "tag=${REGISTRY}/${IMAGE_NAME}:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
-          else
-            echo "tag=${REGISTRY}/${IMAGE_NAME}:latest" >> $GITHUB_OUTPUT
-          fi
+      - name: Set Docker tag
+        id: docker_tag
+        run: |
+          if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+            echo "tag=${REGISTRY}/${IMAGE_NAME}:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
+          else
+            echo "tag=${REGISTRY}/${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
+          fi

Alternative implementation using GitHub Actions expressions:

      - name: Set Docker tag
        id: docker_tag
        run: echo "tag=${{ format('{0}/{1}:{2}', env.REGISTRY, env.IMAGE_NAME, 
          github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'latest') }}" >> "$GITHUB_OUTPUT"
🧰 Tools
🪛 actionlint

38-38: shellcheck reported issue in this script: SC2086:info:2:86: Double quote to prevent globbing and word splitting

(shellcheck)


38-38: shellcheck reported issue in this script: SC2086:info:4:50: Double quote to prevent globbing and word splitting

(shellcheck)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add newline at end of file.

Add a newline character at the end of the file to comply with POSIX standards.

-          tags: ${{ steps.docker_tag.outputs.tag }}
+          tags: ${{ steps.docker_tag.outputs.tag }}
+
📝 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.

Suggested change
tags: ${{ steps.docker_tag.outputs.tag }}
tags: ${{ steps.docker_tag.outputs.tag }}
🧰 Tools
🪛 yamllint

[error] 50-50: no new line character at the end of file

(new-line-at-end-of-file)

Comment on lines +19 to +25
run: |
REPOSITORY="${{ github.repository }}"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:latest" >> $GITHUB_OUTPUT
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add quotes around variables in shell script.

The shell script should have proper quoting to prevent word splitting and globbing issues.

Apply this diff:

  run: |
-   REPOSITORY="${{ github.repository }}"
+   REPOSITORY="${{ github.repository }}"
    if [[ "${{ github.event_name }}" == "pull_request" ]]; then
-     echo "container_image=ghcr.io/${REPOSITORY,,}-ci:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
+     echo "container_image=ghcr.io/${REPOSITORY,,}-ci:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
    else
-     echo "container_image=ghcr.io/${REPOSITORY,,}-ci:latest" >> $GITHUB_OUTPUT
+     echo "container_image=ghcr.io/${REPOSITORY,,}-ci:latest" >> "$GITHUB_OUTPUT"
    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.

Suggested change
run: |
REPOSITORY="${{ github.repository }}"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:latest" >> $GITHUB_OUTPUT
fi
run: |
REPOSITORY="${{ github.repository }}"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
else
echo "container_image=ghcr.io/${REPOSITORY,,}-ci:latest" >> "$GITHUB_OUTPUT"
fi
🧰 Tools
🪛 actionlint

19-19: shellcheck reported issue in this script: SC2086:info:3:99: Double quote to prevent globbing and word splitting

(shellcheck)


19-19: shellcheck reported issue in this script: SC2086:info:5:63: Double quote to prevent globbing and word splitting

(shellcheck)

@piyush-zlai
Copy link
Contributor Author

Closing as the docker image update scenario is not frequent and the more reliable way here is publishing a image per commit which slows down our CI / dev process a bunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants