Skip to content

forgejo Op generator: per-Op variables and secrets, so a pull-request job need not hold the apply credential #2290

Closed

Description

@lex00

What

ComponentPipelineOptions.variables becomes the workflow's top-level env: in the forgejo Op generator, so every job in a generated pipeline sees every variable and secret the project declares. There is no per-Op equivalent of the github generator's setup + permissions route to per-job credentials, because the forgejo dialect drops permissions: and Forgejo Actions mints no OIDC token.

Consequence in INTENTIUS/choudoufu's examples/ci-pipelines: on GitHub and GitLab each Op assumes its own AWS role and live-check assumes none. On Forgejo all five jobs carry one AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair, which has to be able to apply, so the two jobs that run on a pull request hold a credential that can change infrastructure. A pull_request run uses the head's own workflow file, so a collaborator can print it.

Do

Give ScheduledOpSpec a per-Op way to declare variables and secrets that lands on the job rather than the workflow, in the forgejo generator (and github's, where it should produce job-level env:). Refuse or warn where a forge cannot express it, the way permissions and environment already do.

Ordering matters for the consuming project: live-check must be able to declare nothing at all and inherit nothing.

Proof

A generated forgejo workflow whose live-check job carries no credential while its live-apply job does, asserted in the lexicon's own tests, and shown red by moving the declaration back to the forge-wide options.

Part of #2289. Refs INTENTIUS/choudoufu#1028.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions