Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ on:
type: boolean
required: false
default: false
allow-unsigned-in-dev:
description: |
Escape hatch: when true, restore the pre-v8 behaviour of auto-allowing unsigned dev builds in untrusted contexts.
Comment thread
manderson-dev marked this conversation as resolved.
Outdated
Defaults to false (untrusted dev builds hard-fail). See ci.yml for details.
type: boolean
required: false
default: false
signature-type:
description: Specify signature type to use when signing the plugin
type: string
Expand Down Expand Up @@ -789,6 +796,7 @@ jobs:
environment: ${{ inputs.environment }}

allow-unsigned: ${{ inputs.allow-unsigned }}
allow-unsigned-in-dev: ${{ inputs.allow-unsigned-in-dev }}
signature-type: ${{ inputs.signature-type }}

dist-artifacts-prefix: ${{ inputs.dist-artifacts-prefix }}
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ on:
type: boolean
required: false
default: false
allow-unsigned-in-dev:
description: |
Escape hatch: when true, restore the pre-v8 behaviour of auto-allowing unsigned dev builds in untrusted contexts.
Defaults to false (untrusted dev builds hard-fail). PR/fork builds (env=`none`|`''`) keep the fallback either way.
type: boolean
Comment thread
manderson-dev marked this conversation as resolved.
required: false
default: false
signature-type:
description: Specify signature type to use when signing the plugin
type: string
Expand Down Expand Up @@ -381,7 +388,9 @@ jobs:
'dependabot[bot]',
'renovate-sh-app[bot]',
// Used by other shared workflows such as the version bump workflow
'grafana-plugins-platform-bot[bot]'
'grafana-plugins-platform-bot[bot]',
// Only the actor on post-merge pushes from the queue, which already required maintainer approval.
'github-merge-queue[bot]'
].map((s) => s.toLowerCase());

const isPR = context.eventName === 'pull_request';
Expand Down Expand Up @@ -540,6 +549,8 @@ jobs:
secrets: ${{ (fromJson(steps.workflow-context.outputs.result).isTrusted && inputs.backend-secrets != '') && inputs.backend-secrets || '' }}
build-target: ${{ inputs.backend-build-target }}

# Auto-allow-unsigned applies only to untrusted contexts AND envs where shipping unsigned is acceptable:
# `none`/`''` (CI-only) and, opt-in via `allow-unsigned-in-dev`, `dev`. Untrusted dev otherwise hard-fails here.
- name: Package universal ZIP
id: universal-zip
uses: grafana/plugin-ci-workflows/actions/internal/plugins/package@main
Expand All @@ -548,7 +559,7 @@ jobs:
dist-folder: ${{ inputs.plugin-directory }}/dist
output-folder: ${{ inputs.plugin-directory }}/dist-artifacts
access-policy-token: ${{ fromJson(steps.workflow-context.outputs.result).isTrusted && fromJSON(steps.get-secrets.outputs.secrets).SIGN_PLUGIN_ACCESS_POLICY_TOKEN || '' }}
allow-unsigned: ${{ ((inputs.environment == 'dev' || inputs.environment == '' || inputs.environment == 'none') && !(fromJson(steps.workflow-context.outputs.result).isTrusted)) || inputs.allow-unsigned }}
allow-unsigned: ${{ ((inputs.environment == '' || inputs.environment == 'none' || (inputs.environment == 'dev' && inputs.allow-unsigned-in-dev)) && !(fromJson(steps.workflow-context.outputs.result).isTrusted)) || inputs.allow-unsigned }}
signature-type: ${{ inputs.signature-type }}

- name: Package os/arch ZIPs
Expand All @@ -559,7 +570,7 @@ jobs:
dist-folder: ${{ inputs.plugin-directory }}/dist
output-folder: ${{ inputs.plugin-directory }}/dist-artifacts
access-policy-token: ${{ fromJson(steps.workflow-context.outputs.result).isTrusted && fromJSON(steps.get-secrets.outputs.secrets).SIGN_PLUGIN_ACCESS_POLICY_TOKEN || '' }}
allow-unsigned: ${{ ((inputs.environment == 'dev' || inputs.environment == '' || inputs.environment == 'none') && !(fromJson(steps.workflow-context.outputs.result).isTrusted)) || inputs.allow-unsigned }}
allow-unsigned: ${{ ((inputs.environment == '' || inputs.environment == 'none' || (inputs.environment == 'dev' && inputs.allow-unsigned-in-dev)) && !(fromJson(steps.workflow-context.outputs.result).isTrusted)) || inputs.allow-unsigned }}
signature-type: ${{ inputs.signature-type }}

- name: Trufflehog secrets scanning
Expand Down
2 changes: 2 additions & 0 deletions tests/act/internal/workflow/ci/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type WorkflowInputs struct {
RunTruffleHog *bool

AllowUnsigned *bool
AllowUnsignedInDev *bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Might makes sense to add a test case covering the new input.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

added a test!

Testing *bool
BackendBuildTarget *string

Expand Down Expand Up @@ -138,6 +139,7 @@ func SetCIInputs(dst *workflow.Job, inputs WorkflowInputs) {
workflow.SetJobInput(dst, "run-trufflehog", inputs.RunTruffleHog)

workflow.SetJobInput(dst, "allow-unsigned", inputs.AllowUnsigned)
workflow.SetJobInput(dst, "allow-unsigned-in-dev", inputs.AllowUnsignedInDev)
workflow.SetJobInput(dst, "testing", inputs.Testing)
workflow.SetJobInput(dst, "backend-build-target", inputs.BackendBuildTarget)

Expand Down
Loading