Skip to content

class: fix multi instance behaviour - #6

Closed
BacLuc wants to merge 1 commit into
projectsyn:masterfrom
bacluc-agent:fix-multi-instance-output-path
Closed

BacLuc wants to merge 1 commit into
projectsyn:masterfrom
bacluc-agent:fix-multi-instance-output-path

Conversation

@BacLuc

@BacLuc BacLuc commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

The main.jsonnet compile entry used a hard-coded output_path (solution-backup/), so compiling multiple instances of this component into one catalog would make every instance render into the same directory, overwriting each other's manifests.

Use ${_instance} as output_path, like the newer component templates do, and move the golden test dirs accordingly (instance name == test name). Also update the espejote render test's manifest path.

Mirrors appuio/component-solution-base-monitoring#13.

Checklist

  • The PR has a meaningful title. It will be used to auto-generate the
    changelog.
    The PR has a meaningful description that sums up the change. It will be
    linked in the changelog.
  • PR contains a single logical change (to build a better changelog).
  • Categorize the PR by adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog.

The main.jsonnet compile entry used a hard-coded output_path
(solution-backup/), so compiling multiple instances of this component
into one catalog would make every instance render into the same
directory, overwriting each other's manifests.

Use ${_instance} as output_path, like the newer component templates do,
and move the golden test dirs accordingly (instance name == test name).
Also update the espejote render test's manifest path.

Mirrors appuio/component-solution-base-monitoring#13.
@BacLuc BacLuc added bug Something isn't working bump:patch Create a new patch release when merging the labeled PR labels Nov 4, 2026

@vshntea vshntea left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, did you check why the release job fails?

bacluc-agent pushed a commit to bacluc-agent/component-solution-backup that referenced this pull request Nov 4, 2026
The Autorelease workflow failed on projectsyn#6
(run 41829920010) with:

  HttpError: Resource not accessible by integration
  POST /repos/projectsyn/issues/6/comments -> 403

Root cause: the job runs on `pull_request`. That PR was opened from the
bacluc-agent fork, and GitHub always hands such runs a read-only
GITHUB_TOKEN with no secrets ("GITHUB_TOKEN Permissions ... Issues: read"
and "Secret source: None" in the run log). The permissions key cannot lift
that restriction for fork runs, so every API write done by
projectsyn/pr-label-tag-action fails: the PR comment (issues), the release
tag (contents) and the "Release" workflow dispatch (actions).

PRs on branches inside the repository (for example the Renovate ones, or
component-solution-backup#1 which released v0.1.0) are unaffected, which is
why the same workflow file works in the other component repositories.

Switch the trigger to `pull_request_target`, which runs the base branch's
workflow with a write token even for public forks, and declare the three
permissions the action needs so the job no longer depends on the
repository's default workflow permissions. The job only reads the PR
metadata from the event payload and never checks out or executes code from
the PR, which is what makes pull_request_target safe here.

Consequence: runs for PRs from contributors without write access now need a
maintainer to approve them, as they carry a write token.
bacluc-agent pushed a commit to bacluc-agent/component-solution-backup that referenced this pull request Nov 4, 2026
The Autorelease workflow failed on projectsyn#6
(run 41829920010) with:

  HttpError: Resource not accessible by integration
  POST /repos/projectsyn/issues/6/comments -> 403

Root cause: the job runs on `pull_request`. That PR was opened from the
bacluc-agent fork, and GitHub always hands such runs a read-only
GITHUB_TOKEN with no secrets ("GITHUB_TOKEN Permissions ... Issues: read"
and "Secret source: None" in the run log). The permissions key cannot lift
that restriction for fork runs, so every API write done by
projectsyn/pr-label-tag-action fails: the PR comment (issues), the release
tag (contents) and the "Release" workflow dispatch (actions).

PRs on branches inside the repository (for example the Renovate ones, or
component-solution-backup#1 which released v0.1.0) are unaffected, which is
why the same workflow file works in the other component repositories.

Switch the trigger to `pull_request_target`, which runs the base branch's
workflow with a write token even for public forks, and declare the three
permissions the action needs so the job no longer depends on the
repository's default workflow permissions. The job only reads the PR
metadata from the event payload and never checks out or executes code from
the PR, which is what makes pull_request_target safe here.

Consequence: runs for PRs from contributors without write access now need a
maintainer to approve them, as they carry a write token.
@bacluc-agent

Copy link
Copy Markdown

The Autorelease failure here is not caused by the contents of this PR — it is the workflow's token.

Why it fails: auto-release.yaml runs on pull_request, and this PR comes from a fork. GitHub always gives such runs a read-only GITHUB_TOKEN with no secrets (see run 41829920010: "GITHUB_TOKEN Permissions … Issues: read", "Secret source: None"), so the first API write of projectsyn/pr-label-tag-action — the "Merging this PR will release v0.1.1" comment — is rejected: 403 Resource not accessible by integration. The permissions: key cannot lift that limit for fork runs; pull_request_target can. Same-repo PRs (Renovate, and #1 which released v0.1.0) never hit this, which is why the identical file works in the other component repos.

Fix, ready to review: branch bacluc-agent:autorelease-fork-pr-writes (single commit 88da95d off current master, .github/workflows/auto-release.yaml + release.yaml). It switches the job to pull_request_target (safe: the job never checks out or runs PR code, it only reads the PR metadata the action already uses), requests pull-requests: write — PR conversation comments are authorized against that resource, issues: write alone is still rejected with the same 403 — and gives release.yaml the contents: write / pull-requests: read it needs to create the release when the tag job dispatches it. Verified end-to-end on the fork (comment → tag → Release run), evidence table in bacluc-agent#2 (comment). I cannot open the PR into this repo (the agent token has read-only access to projectsyn), so please open it from that branch.

Two consequences once it is merged into master:

  • runs for PRs from contributors without write access now need a maintainer to approve them, since they carry a write token;
  • merge master into fix-multi-instance-output-path so this PR stops running the old pull_request copy of the workflow, then toggle the bump:patch label to get the release comment. The v0.1.1 tag itself is created from the closed event, which uses master's workflow file, so merging this PR will release as soon as the fix is on master.

@BacLuc

BacLuc commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Will use branch from own repo

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

Labels

bug Something isn't working bump:patch Create a new patch release when merging the labeled PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants