Skip to content

Expose artifact name from build-image job#84

Merged
ejfine merged 4 commits intomainfrom
build-artifact
Aug 21, 2025
Merged

Expose artifact name from build-image job#84
ejfine merged 4 commits intomainfrom
build-artifact

Conversation

@ejfine
Copy link
Contributor

@ejfine ejfine commented Aug 21, 2025

Why is this change necessary?

Needs to be accessible for other steps in a pipeline that download that artifact

How does this change address the issue?

Adds it as an output

What side effects does this change have?

None

How is this change tested?

Downstream repo

Other

Add vitest version in context

Summary by CodeRabbit

  • New Features
    • Reusable Docker build workflow now exposes an artifact name output, enabling callers to easily reference and download the built image tarball.
  • Chores
    • Added vitest version to the template context, making it available for downstream tooling and configurations.
    • Removed the deprecated devcontainer dependency setup script template to streamline environment setup.

@ejfine ejfine requested a review from Copilot August 21, 2025 10:36
@ejfine ejfine self-assigned this Aug 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 21, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Warning

Rate limit exceeded

@ejfine has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a043819 and 6252430.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .devcontainer/devcontainer.json (1 hunks)
  • extensions/context.py (2 hunks)
  • pyproject.toml (1 hunks)

Walkthrough

Adds vitest_version to template context in two places, introduces an artifact-name output in the reusable Docker build workflow, and removes the devcontainer manual dependency setup script template. No control-flow changes to existing hooks or jobs.

Changes

Cohort / File(s) Summary of Changes
Context updates (vitest_version)
extensions/context.py, template/extensions/context.py.jinja-base
Adds context entry vitest_version; no other logic or signatures changed.
Reusable Docker build workflow outputs
template/.github/reusable_workflows/build-docker-image.yaml.jinja-base
Adds artifact-name output at workflow_call and job levels, sourced from image_name_no_slashes step output.
Devcontainer script removal
template/.devcontainer/manual-setup-deps.sh.jinja-base
Deletes template for manual dependency setup script (uv-based), removing locking/auth/setup logic.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A whisk of code, a hop so light,
Vitest now gleams in context bright.
A tarball’s name hops out to play,
While old dev scripts bounce away.
Carrots of hashes, artifacts neat—
Thump-thump, this merge feels fleet! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch build-artifact

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR exposes the artifact name from the build-docker-image workflow as an output and adds vitest version context for template generation. The primary purpose is to make the Docker image artifact name accessible to downstream pipeline steps.

  • Adds workflow output for the Docker image artifact name
  • Includes vitest version in context for template rendering
  • Removes an unused manual setup script

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
template/.github/reusable_workflows/build-docker-image.yaml.jinja-base Adds workflow and job outputs to expose artifact name
template/extensions/context.py.jinja-base Adds vitest_version to template context
extensions/context.py Sets vitest version to ^3.2.4 in context
template/.devcontainer/manual-setup-deps.sh.jinja-base Removes entire manual setup dependencies script

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

name: Build Docker Image
runs-on: {% endraw %}{{ gha_linux_runner }}{% raw %}
outputs:
artifact-name: ${{ steps.calculate-build-context-hash.outputs.image_name_no_slashes }}
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The output references steps.calculate-build-context-hash.outputs.image_name_no_slashes but there's no visible step with id calculate-build-context-hash in the diff. Verify this step exists and produces the expected output.

Copilot uses AI. Check for mistakes.
@ejfine ejfine merged commit 0201a5b into main Aug 21, 2025
6 checks passed
Copy link

@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: 1

🧹 Nitpick comments (5)
extensions/context.py (1)

53-53: Keep source-of-truths in sync

Since this repo sets versions both here and in the template Jinja base, consider adding a brief comment line next to vitest_version noting it must remain in sync with template/extensions/context.py.jinja-base (prevents drift).

template/.github/reusable_workflows/build-docker-image.yaml.jinja-base (4)

47-49: Propagate additional outputs to improve downstream UX (optional)

Downstream steps often need more than the artifact “name”:

  • The artifact filename (with .tar) for docker load or checksum.
  • The build-context tag (already computed as build_context_tag) to disambiguate artifacts and images.

Suggest exporting both at the job level and surfacing them at workflow_call. This is backward-compatible and makes consumers simpler.

Apply this diff to the changed block to add job outputs:

     runs-on: {{ gha_linux_runner }}
     outputs:
       artifact-name: ${{ steps.calculate-build-context-hash.outputs.image_name_no_slashes }}
+      artifact-filename: ${{ steps.calculate-build-context-hash.outputs.artifact_filename }}
+      build-context-tag: ${{ steps.calculate-build-context-hash.outputs.build_context_tag }}

And extend the workflow_call outputs:

     outputs:
       artifact-name:
         description: 'The name of the uploaded artifact of the image tarball'
         value: ${{ jobs.build-image.outputs.artifact-name }}
+      artifact-filename:
+        description: 'The filename of the uploaded tarball (without path)'
+        value: ${{ jobs.build-image.outputs.artifact-filename }}
+      build-context-tag:
+        description: 'The calculated tag derived from the build context hash'
+        value: ${{ jobs.build-image.outputs.build-context-tag }}

Outside the changed ranges, add one line to the “Calculate hash of files in build context” step to emit artifact_filename:

# inside the run: block after setting IMAGE_NAME_NO_SLASHES
echo "artifact_filename=${IMAGE_NAME_NO_SLASHES}.tar" >> "$GITHUB_OUTPUT"

47-49: Consider clarifying semantics when save-as-artifact is false

The artifact-name output is always set even if no artifact is uploaded. This is fine, but it can confuse callers. Two low-effort options:

  • Document that artifact-name is meaningful only when inputs.save-as-artifact == true.
  • Or gate the job output behind a conditional step that only emits when saving.

Happy to add a short README snippet or usage example.


154-160: Optional: include build-context tag in the artifact name to avoid collisions

If this reusable workflow is invoked multiple times within the same run building the same image_name but different build contexts, artifact names can collide and merge. Including the build_context_tag in the artifact name avoids that.

Proposed change outside the current diff:

-          name: ${{ steps.calculate-build-context-hash.outputs.image_name_no_slashes }}
+          name: ${{ steps.calculate-build-context-hash.outputs.image_name_no_slashes }}--${{ steps.calculate-build-context-hash.outputs.build_context_tag }}

If you prefer to keep the shorter name, exposing build-context-tag (suggested above) still lets consumers disambiguate.


77-90: Minor: surface artifact info in the job summary for easier debugging

Not required, but adding a short step to append the artifact name and build-context tag to $GITHUB_STEP_SUMMARY helps troubleshoot downloads in caller workflows.

Example snippet to add after the hash step:

- name: Summarize artifact info
  if: ${{ always() }}
  run: |
    {
      echo "### Build image artifact";
      echo "- image_name_no_slashes: ${{ steps.calculate-build-context-hash.outputs.image_name_no_slashes }}";
      echo "- build_context_tag:     ${{ steps.calculate-build-context-hash.outputs.build_context_tag }}";
      echo "- will_upload_artifact:  ${{ inputs.save-as-artifact }}";
    } >> "$GITHUB_STEP_SUMMARY"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4edca4f and a043819.

📒 Files selected for processing (4)
  • extensions/context.py (1 hunks)
  • template/.devcontainer/manual-setup-deps.sh.jinja-base (0 hunks)
  • template/.github/reusable_workflows/build-docker-image.yaml.jinja-base (2 hunks)
  • template/extensions/context.py.jinja-base (1 hunks)
💤 Files with no reviewable changes (1)
  • template/.devcontainer/manual-setup-deps.sh.jinja-base
🔇 Additional comments (4)
template/extensions/context.py.jinja-base (1)

48-48: Good addition: vitest_version wired into template context

This mirrors the surrounding pattern and keeps the JS tooling versions consistent in the context hook.

extensions/context.py (1)

53-53: LGTM: introduces vitest_version with sane semver range

Placement and naming match the existing Node tool versions block. No behavioral risk.

template/.github/reusable_workflows/build-docker-image.yaml.jinja-base (2)

34-37: Output exposed correctly at workflow_call

The artifact-name output is plumbed through to callers via jobs.build-image.outputs.artifact-name. Syntax and scoping look correct.


34-37: Verify that the new artifact-name output is actually consumed

I’ve searched both template/ and .github/workflows for any callers of the build-docker-image.yaml.jinja-base workflow or references to outputs.artifact-name / actions/download-artifact, but found none.

• No internal workflows call

uses: .github/reusable_workflows/build-docker-image.yaml.jinja-base

• No references to

${{ jobs.build-image.outputs.artifact-name }}

• No uses of the actions/download-artifact step

Please manually verify that any external workflows (in consuming repositories) have been updated to pull the artifact-name output and pass it to actions/download-artifact.

If you haven’t yet added any callers, consider including a minimal example workflow in template/.github/workflows/ that demonstrates downloading the image tarball via the exposed artifact-name output.

context["vue_version"] = "{{ vue_version }}"
context["vue_router_version"] = "{{ vue_router_version }}"
context["faker_version"] = "{{ faker_version }}"
context["vitest_version"] = "{{ vitest_version }}"
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify vitest_version is defined in copier.yaml and test fixtures

To avoid Jinja UndefinedError during template rendering, ensure vitest_version is present wherever other version vars are defined (e.g., copier.yaml and tests/data*.yml).

Run this to confirm coverage:

If missing, I can add a default in copier.yaml matching extensions/context.py ("^3.2.4").


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Search for vitest_version definitions in config and tests"
# copier config(s)
fd -a -t f 'copier.y*ml' | xargs -r -I{} rg -n --no-heading '^\s*vitest_version\s*:' {} || true
# test fixtures
rg -n --no-heading 'vitest_version' tests || true
# ensure used in templates (expect hits)
rg -n --no-heading 'vitest_version' template || true

Length of output: 443


Define vitest_version in copier.yaml and test fixtures

The template at template/extensions/context.py.jinja-base:48 uses {{ vitest_version }}, but our search shows this variable isn’t defined in any copier configuration or in the test fixtures—this will trigger a Jinja UndefinedError when rendering.

Please add a default vitest_version in your copier config and mirror it in your test data. For example:

• In copier.yaml (or .copier.yaml), under your variables section:

 variables:
   # …existing definitions…
+  vitest_version:
+    type: str
+    default: "^3.2.4"
+    help: "Version of Vitest to install in the generated project"

• In your test fixtures (e.g. tests/data-common.yml or similar):

 # …existing test data…
+vitest_version: "^3.2.4"

These additions will ensure that vitest_version is always defined during both normal usage and in CI/test runs.

📝 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
context["vitest_version"] = "{{ vitest_version }}"
# In copier.yaml (or .copier.yaml), under your `variables:` section
variables:
# …existing definitions…
vitest_version:
type: str
default: "^3.2.4"
help: "Version of Vitest to install in the generated project"
Suggested change
context["vitest_version"] = "{{ vitest_version }}"
# In your test fixtures file (e.g. tests/data-common.yml)
# …existing test data…
vitest_version: "^3.2.4"
🤖 Prompt for AI Agents
In template/extensions/context.py.jinja-base around line 48, the template
references {{ vitest_version }} but that variable is not defined in copier
configuration or test fixtures; add a default vitest_version entry to your
copier config (e.g., in copier.yaml / .copier.yaml under the variables section)
and add the same key/value to your test fixture data file (e.g.,
tests/data-common.yml or the fixtures file your test suite loads) so rendering
never raises a Jinja UndefinedError.

@ejfine ejfine deleted the build-artifact branch August 21, 2025 10:45
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