Skip to content

PF-173: Add logs as artifact for a job#3185

Open
gruntwork-ci wants to merge 1 commit into
mainfrom
claude-pr/PF-173-28140438123
Open

PF-173: Add logs as artifact for a job#3185
gruntwork-ci wants to merge 1 commit into
mainfrom
claude-pr/PF-173-28140438123

Conversation

@gruntwork-ci

@gruntwork-ci gruntwork-ci commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Implements plan for Linear issue PF-173.

Plan source: https://github.com/gruntwork-io-team/linear-claude-plans/blob/main/plans/PF-173.md


Claude's implementation summary
No fixture impact. Implementation complete. Let me provide the summary of changes per repo.

---

## Summary of changes

### `gruntwork-io/pipelines` (this repo)

Added `EXPERIMENT_LOGS_AS_ARTIFACT` opt-in experiment and the CLI plumbing to surface a per-unit Terragrunt log artifact path and "Download Logs" link.

- `internal/features/features.go` — added `LogsAsArtifact` constant + default-OFF entry.
- `internal/features/features_test.go` — added focused test asserting default is false (the existing AST-driven `TestAllFeaturesHaveCase` also picks it up).
- `internal/actions/terragrunt/terragruntexecutor.go` — added `LogsArtifactPath string \`output:"logs_artifact_path,omitempty"\`` to `TerragruntOutput`; populated only when the experiment is enabled and `--combined-output-path` was provided. Added a `combinedOutputAbsPath()` helper shared with `writeCombinedOutput`.
- `internal/step/step.go` — added `LogsArtifactURL string \`json:"logs_artifact_url,omitempty"\`` to `StepSummary`.
- `internal/comment/comment.go` — added `LogsArtifactURL` to `CommentInfraChange` and copied it from `step.Result` in `formatCommentData`.
- `internal/comment/templates/comment.gohtml` — render a `· <a href=...>Download Logs</a>` anchor next to "View Job Logs" when `LogsArtifactURL` is non-empty.
- `internal/comment/comment_test.go` — added two tests covering present-link and absent-link cases.
- `internal/actions/statusupdate/statusupdate.go` — added `logsArtifactURL` field to `Update`, new param on `NewUpdate`, populated `StepSummary.LogsArtifactURL`.
- `main.go` — added `--logs-artifact-url` CLI flag on `status-update update`, threaded into `NewUpdate`.
- `internal/actions/gitlabyml/templates/execute.goyml` — extended the generated child-pipeline execute job's `artifacts:` stanza to include `access: developer`, `expire_in: 30 days`, and the `pipelines-artifacts/` directory.
- `internal/actions/gitlabyml/gitlabdynamicchildren_test.go` — updated the `TestExecutePlan` snapshot to match the new artifacts block.
- `test/plumbing/statusupdate/update/update_test.go` and `test/porcelain/add-units-consolidated/add-unit-consolidated_test.go` — added the new `logsArtifactURL` constructor arg (empty string) to existing `NewUpdate(...)` call sites.

### `gruntwork-io/pipelines-workflows`

Added a conditional artifact upload step in the matrix execute jobs and passed the resulting URL through to the comment-job-update step.

- `.github/workflows/pipelines.yml` — added `Sanitize artifact name fragment` shell step (replaces `/` with `-` in the working directory) and `Upload unit logs as artifact` using `actions/upload-artifact@v6.0.0`, both gated on `steps.terragrunt.outputs.pipelines_logs_artifact_path != ''`. Added `logs_artifact_url: ${{ steps.upload_logs.outputs.artifact-url }}` to the `Update comment` step.
- `.github/workflows/pipelines-root.yml` — same change, with the AccountsRequested/AccountsAdded skip condition propagated to the new steps.

### `gruntwork-io/pipelines-actions`

Declared the new step output on the execute action and accepted/forwarded the new URL on the comment-job-update action.

- `.github/actions/pipelines-execute/action.yml` — declared `pipelines_logs_artifact_path` in the top-level `outputs:` block so the CLI's `OutputWriter`-emitted value bubbles to the calling workflow.
- `.github/actions/pipelines-comment-job-update/action.yml` — added `logs_artifact_url` input (default empty) and plumbed it into the composite's `env:` as `LOGS_ARTIFACT_URL`.
- `.github/actions/pipelines-comment-job-update/scripts/update.sh` — defaulted `LOGS_ARTIFACT_URL` to empty and appended `--logs-artifact-url "$LOGS_ARTIFACT_URL"` to the `pipelines status-update update` invocation.

### `gruntwork-io/docs`

- `docs/2.0/reference/pipelines/feature-flags.md` — documented `PIPELINES_FEATURE_EXPERIMENT_LOGS_AS_ARTIFACT` between `IGNORE_UNITS_WITHOUT_ENVIRONMENT` and `MINIMIZE_BLAST_RADIUS`, including a note about workflow/action version requirements and the dual env-var / HCL `env { }` enablement options.

### Missing / out-of-scope repos

The plan calls for changes in two GitLab-side repositories that are **not** present in this checked-out workspace:

- `gitlab.com/gruntwork-io/pipelines-workflows` (referred to as `gitlab-pipelines-workflows`) — the plan said no template changes were required here; only the `pipelines` CLI change (already applied to `internal/actions/gitlabyml/templates/execute.goyml`) was needed. **Effectively done from this repo.**
- `gitlab.com/gruntwork-io/pipelines-actions` (referred to as `pipelines-gitlab-actions`) — the plan required edits to `scripts/pipelines-execute.sh` to: extract `LogsArtifactPath` from the CLI JSON via `jq`, conditionally stage the log to `./pipelines-artifacts/`, derive the GitLab raw-artifact URL from `CI_SERVER_URL`/`CI_PROJECT_PATH`/`CI_JOB_ID`, and forward it as `--logs-artifact-url` to `status-update update`. **This repo is not checked out — these changes are skipped here and must be applied in a follow-up PR against `pipelines-gitlab-actions`.**

Tests run: `go build ./...`, `go vet ./...`, and `go test ./internal/features/ ./internal/comment/ ./internal/actions/gitlabyml/ ./internal/platform/outputs/ ./internal/step/` all pass. Two preexisting test failures (`TestTerragruntPlanOutDirNestsByUnitPath` and `TestExecuteTerragrunt`) are environmental — they require the `terragrunt` binary on `$PATH` and are unrelated to these changes.

Related PRs in this change set

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 25, 2026 1:42am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@gruntwork-ci, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7e46a4c8-7e4e-49e1-815b-c611bbc1a213

📥 Commits

Reviewing files that changed from the base of the PR and between 4d020ac and ae679d6.

📒 Files selected for processing (1)
  • docs/2.0/reference/pipelines/feature-flags.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude-pr/PF-173-28140438123

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

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

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.

1 participant