Skip to content

Conversation

@Graysonbarton
Copy link
Collaborator

@Graysonbarton Graysonbarton commented Jan 14, 2025

Why:

Closes:

What's being changed (if available, include any code snippets, screenshots, or gifs):

Check off the following:

  • I have reviewed my changes in staging, available via the View deployment link in this PR's timeline (this link will be available after opening the PR).

    • For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the data directory.
  • For content changes, I have completed the self-review checklist.

Summary by Sourcery

CI:

  • Add a CI workflow to build and tag the Docker image.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 14, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new GitHub Actions workflow file named .github/workflows/docker-image.yml. This workflow automates the process of building a Docker image based on the project's Dockerfile whenever code is pushed to the main branch or a pull request is opened against it. The built image is tagged with the current Unix timestamp.

Sequence diagram for Docker image build workflow

sequenceDiagram
    participant G as GitHub
    participant R as Runner
    participant D as Docker

    Note over G: Push to main or PR
    G->>R: Trigger workflow
    R->>R: Checkout code
    R->>D: Build image
    Note over D: Tag with timestamp
    D-->>R: Image built
    R-->>G: Workflow complete
Loading

File-Level Changes

Change Details Files
A new GitHub Actions workflow is added to build and tag a Docker image.
  • The workflow is triggered by pushes and pull requests to the main branch.
  • It uses actions/checkout@v4 to check out the code.
  • It builds the Docker image using the project's Dockerfile.
  • The image is tagged with my-image-name and the current Unix timestamp.
.github/workflows/docker-image.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Graysonbarton - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a more meaningful tagging strategy for the Docker image (e.g., git SHA or semantic versioning) instead of timestamps. This will make it easier to track which version is deployed and roll back if needed.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): Consider using git SHA instead of timestamp for image tagging

Using timestamps as tags could lead to collisions if multiple builds occur simultaneously. Consider using github.sha (e.g., my-image-name:${{ github.sha }}) for better traceability and uniqueness.

@Graysonbarton Graysonbarton merged commit bd37ec6 into main Jan 14, 2025
21 of 23 checks passed
@Graybar-codespace Graybar-codespace locked as resolved and limited conversation to collaborators Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants