Skip to content

[WIP] Convert Patcher spec.json usage to temp file usage #2546

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

Merged
merged 4 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/2.0/docs/patcher/concepts/grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,3 @@ for each $environment e.g., glob patterns like dev-* or prod-*)
for each $target output
run patcher update --target=$target
```


**Pseudocode:**
24 changes: 15 additions & 9 deletions docs/2.0/docs/patcher/guides/promotion-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ The initial GitHub Actions workflow file, `update-dev.yml` in this example, high
* The `patcher update` command reads the `spec` file, checks out the repository code, commits the changes, and pushes a pull request.
* For the pull request workflow to function correctly, the `pull_request_branch` must follow the format `$PREFIX$DEPENDENCYID`. This format allows the workflow to track and process updates accurately. The `trigger-next-env` job strips out the prefix.

:::info
As of `v0.14.x` (`patcher-action` `v2.10.x`), Patcher has deprecated support of checking in the spec output file from a `patcher report` run into your codebase.
This file, similar to an OpenTofu plan file, is intended to be a temporary artifact to capture run details between `report` and `update`.
We recommend that you delete and `.gitignore` any spec files in your codebase.
:::

<!-- spell-checker: disable -->
```yml
name: Update Dev Dependencies
Expand Down Expand Up @@ -113,7 +119,7 @@ jobs:
github_token: ${{ secrets.PIPELINES_READ_TOKEN }}
include_dirs: "{*dev*}/**"
working_dir: ./
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json

update-env:
needs: [patcher-report]
Expand All @@ -128,15 +134,15 @@ jobs:
- name: Create the spec file
shell: bash
run: |
echo '${{ needs.patcher-report.outputs.spec }}' > patcher-spec.json
echo '${{ needs.patcher-report.outputs.spec }}' > /tmp/patcher-spec.json

- uses: gruntwork-io/patcher-action@main
with:
patcher_command: update
github_token: ${{ secrets.PIPELINES_READ_TOKEN }}
working_dir: ${{ env.ENV_FOLDER_NAME }}
dependency: ${{ matrix.dependency.ID }}
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json
pull_request_title: "[Patcher] [dev] Update ${{ matrix.dependency.ID }}"
pull_request_branch: "${{ env.PR_BRANCH_PREFIX }}${{ matrix.dependency.ID }}"
```
Expand Down Expand Up @@ -203,7 +209,7 @@ jobs:
github_token: ${{ secrets.PIPELINES_READ_TOKEN }}
patcher_command: report
working_dir: ./
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json
include_dirs: "{*stage*}/**"

update-env:
Expand All @@ -219,14 +225,14 @@ jobs:
- name: Create the spec file
shell: bash
run: |
echo '${{ needs.patcher-report.outputs.spec }}' > patcher-spec.json
echo '${{ needs.patcher-report.outputs.spec }}' > /tmp/patcher-spec.json

- uses: gruntwork-io/patcher-action@main
with:
github_token: ${{ secrets.PIPELINES_READ_TOKEN }}
dependency: ${{ matrix.dependency.ID }}
patcher_command: update
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json
pull_request_title: "[Patcher] [stage] Update ${{ matrix.dependency.ID }}"
pull_request_branch: "${{ env.PR_BRANCH_PREFIX }}${{ matrix.dependency.ID }}"
```
Expand Down Expand Up @@ -271,7 +277,7 @@ jobs:
patcher_command: report
working_dir: ./
dependency: ${{ github.event.client_payload.dependency }}
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json
include_dirs: "{*prod*}/**"

update-env:
Expand All @@ -287,14 +293,14 @@ jobs:
- name: Create the spec file
shell: bash
run: |
echo '${{ needs.patcher-report.outputs.spec }}' > patcher-spec.json
echo '${{ needs.patcher-report.outputs.spec }}' > /tmp/patcher-spec.json

- uses: gruntwork-io/patcher-action@main
with:
github_token: ${{ secrets.PIPELINES_READ_TOKEN }}
dependency: ${{ matrix.dependency.ID }}
patcher_command: update
spec_file: patcher-spec.json
spec_file: /tmp/patcher-spec.json
pull_request_title: "[Patcher] [prod] Update ${{ matrix.dependency.ID }}"
pull_request_branch: "${{ env.PR_BRANCH_PREFIX }}${{ matrix.dependency.ID }}"
```