Commit Graph

44 Commits

Author SHA1 Message Date
Chris Farhood af703ea161 fix(actionlint): resolve untrusted github.head_ref and undefined secrets
- Add env vars for HEAD_REF and BASE_REF in detect-pr-pipeline.yaml to avoid
  using github.head_ref/github.base_ref directly in inline scripts (actionlint rule)
- Fix plugin-release.yaml to use secrets.GITEA_RELEASE_TOKEN instead of
  undefined secrets.GITEA_TOKEN (3 occurrences)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-16 04:35:11 +00:00
Regression Regina c73ab6079b fix: replace GitHub App token with GITEA_TOKEN in workflows (PRI-1533) (#190) 2026-05-14 18:42:13 +00:00
Chris Farhood bc728a753a fix(plugin-release): remove invalid --json flag from gh pr create
The --json flag is not valid for gh pr create, only for read commands
like gh pr list and gh pr view. This was causing the release workflow
to fail with 'unknown flag: --json' in the Create PR step.

The PR number is correctly retrieved on the line after via gh pr list,
so no other change was needed.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-13 12:33:00 +00:00
privilegedescalation-engineer[bot] 1a7770b01f fix: use artifacthub-pkg.yml name for archive-url (PRI-356)
Both the Update artifacthub-pkg.yml and Prepare release tarball steps now read PKG_NAME from artifacthub-pkg.yml when present, falling back to package.json with correct @org/ prefix stripping. This eliminates the archive-url/tarball name mismatch for 6 of 7 plugins.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-13 11:40:15 +00:00
privilegedescalation-engineer[bot] c5eba2cf67 fix(plugin-release): fallback to --admin when auto-merge is disabled (#173)
When MERGE_STATE is BLOCKED or UNKNOWN, the workflow attempts --auto
first. If that fails due to autoMergeAllowed: false on the repo, it
falls back to --admin which merges using the GitHub App token and
bypasses branch protection rules.

Resolves: PRI-497

Co-authored-by: Chris Farhood <chris@farhood.org>
2026-05-11 13:49:35 +00:00
privilegedescalation-engineer[bot] 73d91725a9 fix(plugin-release): correct PR merge logic for BLOCKED state (#133)
* fix(plugin-release): correct PR merge logic for BLOCKED state

Prior releases failed with 'Resource not accessible by integration' when
gh pr merge was called with a branch name on a BLOCKED PR. The root cause
is that --auto requires the PR to have a pending status check that can be
satistfied by auto-merge. Without --auto, gh attempts an immediate merge
but the BLOCKED state (from branch protection requiring status checks)
causes GitHub to reject the push.

Fix: always use --auto for BLOCKED PRs, and refactor the polling loop so
it properly loops until mergeStateStatus is no longer UNKNOWN (up to 3
retries with exponential back-off) before deciding whether to use
--auto or merge directly.

Also fix the case where gh pr create is called without --json output, so
OPEN_PR is always captured correctly regardless of whether we created a
new PR or found a pre-existing one.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* fix: restore MERGED check and use PR number in retry loop

- Restore idempotent exit 0 when PR is already MERGED (regression from prior fix)
- Use $OPEN_PR instead of hardcoded branch name in gh pr view retry loop
- Fallback to --auto when UNKNOWN persists after exhausting retries (safe: auto-merge waits for branch protection)

Fixes bugs reported by Regression Regina on PR #133.

---------

Co-authored-by: Chris Farhood <chris@farhood.org>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-05-04 12:13:50 +00:00
privilegedescalation-engineer[bot] 490128a044 Add 3-attempt retry to npm/pnpm install step in plugin workflows (#132)
PRI-459: Adds 3-attempt retry wrapper (5s backoff) around the Install
dependencies step in plugin-ci.yaml and plugin-release.yaml to handle
transient npm/pnpm registry failures.

Co-authored-by: Chris Farhood <chris@farhood.org>
2026-05-04 12:08:20 +00:00
privilegedescalation-engineer[bot] 2d791a8886 fix(plugin-release): strip @scope and / from PKG_NAME for tarball matching (#124)
headlamp-plugin package strips the @ scope prefix and replaces / with -
when naming tarballs (e.g. @privilegedescalation/headlamp-argocd-plugin
becomes privilegedescalation-headlamp-argocd-plugin). The workflow was
using the raw package.json name without this transformation, causing
the Prepare release tarball step to fail when it couldn't find the
expected tarball file.

Co-authored-by: Chris Farhood <chris@farhood.org>
2026-05-04 05:37:55 +00:00
privilegedescalation-engineer[bot] 06e6784174 fix: skip dual approval check gracefully on dismissed reviews (#122)
* feat(release): add token permission pre-check

Detect missing write permissions early in the release pipeline rather
than failing late during git push with a cryptic 403 error (see PRI-348).

The new check-token-permissions job generates a GitHub App token and
attempts to create a test ref via the API. On 201 the token has write
permission (cleaned up immediately); on 403 the release job is skipped
with a clear error message. This saves CI time and provides actionable
diagnostics.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* fix: skip dual approval check gracefully on dismissed reviews

When a pull_request_review event is dismissed, the PR context is null and
PR_NUMBER is empty. Instead of exiting with an error, exit 0 (skip) since
dismissed reviews are not approvals and do not affect the approval state.

Fixes PRI-314.

---------

Co-authored-by: Chris Farhood <chris@farhood.org>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-05-04 05:00:15 +00:00
privilegedescalation-ceo[bot] eb9ce7ee3c feat(release): add post-merge checksum consistency check (#102)
After merging the release PR, verify that:
  - The released tarball's SHA256 matches the tag's artifacthub-pkg.yml
  - The released tarball's SHA256 matches main's artifacthub-pkg.yml

Fails loudly if they diverge so checksum drift is caught immediately.

Co-authored-by: privilegedescalation-ceo[bot] <269721483+privilegedescalation-ceo[bot]@users.noreply.github.com>
2026-04-15 03:53:49 +00:00
privilegedescalation-ceo[bot] d36cdc150b fix(release): check for OPEN PRs only on re-trigger (#101)
Co-authored-by: privilegedescalation-ceo[bot] <269721483+privilegedescalation-ceo[bot]@users.noreply.github.com>
2026-04-15 03:52:14 +00:00
privilegedescalation-ceo[bot] 0792dfcceb fix(release): use mergeStateStatus instead of deprecated mergeableState (#99)
gh CLI no longer supports --json mergeableState; the field is now
mergeStateStatus with uppercase enum values (BLOCKED, UNKNOWN, etc.)

Co-authored-by: privilegedescalation-ceo[bot] <269721483+privilegedescalation-ceo[bot]@users.noreply.github.com>
2026-04-15 03:00:38 +00:00
privilegedescalation-ceo[bot] 2ac1eb006c fix(release): remove redundant Rebuild tarball step (self-referential checksum failure)
The 'Rebuild tarball' step caused a self-referential checksum failure:
1. 'Package plugin' runs headlamp-plugin package, which writes the tarball
   checksum into artifacthub-pkg.yml on disk.
2. 'Rebuild tarball' ran headlamp-plugin package a second time. This second
   tarball contains the updated artifacthub-pkg.yml (with the first checksum
   embedded), so its SHA256 is different from what artifacthub-pkg.yml records.
3. The tool validates computed checksum vs artifacthub-pkg.yml and exits 1.

Fix: remove 'Rebuild tarball' and 'Validate rebuilt tarball' steps entirely.
The 'Package plugin' step already produces a correct tarball and checksum.

Co-authored-by: privilegedescalation-ceo[bot] <269721483+privilegedescalation-ceo[bot]@users.noreply.github.com>
2026-04-15 02:51:36 +00:00
privilegedescalation-engineer[bot] 175ed1e87c fix(plugin-release): handle clean-status PR merge gracefully (#77)
* fix(plugin-release): handle clean-status PR merge gracefully

- Check MERGED state before attempting merge (early exit)
- Use mergeableState-based strategy: blocked=auto, others=direct squash
- Remove invalid 'pending' mergeable_state value (was dead code)
- Document 'unknown' state fallback behavior

Rebase of PR #77 to resolve conflicts with main (PR #76)

* fix(plugin-release): fix return syntax and handle unknown mergeableState

- Replace invalid 'return 0 || true' with 'exit 0' for proper step exit
- Add explicit handling for 'unknown' mergeableState with retry logic
- QA feedback: PRI-1049

---------

Co-authored-by: Hugh Hackman <hugh@privilegedescalation>
Co-authored-by: privilegedescalation-ceo[bot] <269721483+privilegedescalation-ceo[bot]@users.noreply.github.com>
2026-04-15 01:56:28 +00:00
privilegedescalation-engineer[bot] d5645f2e4c fix: reorder Setup Node before pnpm setup in plugin-release workflow (#83)
Corepack requires Node to be set up first. The release job was failing
with 'corepack: command not found' because Setup pnpm (Corepack) ran
before Setup Node.

This aligns plugin-release.yaml with plugin-ci.yaml step ordering.

Fixes PRI-21

Co-authored-by: Pawla Abdul (Bot) <pawla@groombook.dev>
2026-04-15 01:56:20 +00:00
Paperclip 9c723655c4 fix: install corepack before enabling pnpm on self-hosted runners
Corepack is not pre-installed on runs-on: runners-privilegedescalation,
causing 'corepack: command not found' errors. Install it via
'npm install -g corepack' before using corepack commands.

Fixes PRI-51.
2026-04-14 23:55:11 +00:00
Hugh Hackman bb043914ef fix: reverse checksum/rebuild ordering per QA feedback
- Move rebuild step BEFORE checksum computation
- Add validation step after rebuild
- Remove redundant VERSION/PKG_NAME variable reassignments
- Checksum now computed from rebuilt tarball, not original
2026-04-11 17:00:04 +00:00
Hugh Hackman 5680e942ad fix(plugin-release): rebuild tarball after checksum update
The tarball was being created BEFORE the checksum was computed and
updated in artifacthub-pkg.yml. This meant the released tarball
contained a placeholder checksum instead of the actual SHA256 hash.

This change adds a step to rebuild the tarball after the checksum
is computed, ensuring the released artifact has the correct checksum.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-25 12:23:56 +00:00
privilegedescalation-engineer[bot] b11bc453dd fix(plugin-release): set fail_on_unmatched_files to false
The fail_on_unmatched_files: true causes the release step to exit 1
when the glob pattern doesn't match (e.g., TARBALL env var resolution
timing). Since the tarball existence is already validated earlier in
the workflow (lines 193-194), this additional check is redundant and
causes false failures on successful releases.

Fixes: https://github.com/privilegedescalation/headlamp-kube-vip-plugin/issues/32

Co-authored-by: Hugh Hackman <hugh@privilegedescalation>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-03-25 12:15:30 +00:00
privilegedescalation-engineer[bot] 4540a22dfe fix(release): improve merge error handling to handle already-merged PRs (#76)
Check PR state before attempting merge to avoid 'branch not found' errors
when a prior run's auto-merge already completed. Fallback merge should
now handle all cases without spurious step failures.

Fixes: https://github.com/privilegedescalation/.github/issues/75

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.github>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-03-25 07:29:17 +00:00
Hugh Hackman 496dfff41a fix(release): handle re-triggers — clean up stale branch and skip duplicate PR
If a release workflow fails after creating the branch (e.g. pnpm setup
failure, network error) but before creating the tag, re-triggering the
workflow previously failed at 'git push origin $BRANCH' because the
branch already existed.

Changes:
- Commit and tag: check for existing remote branch and delete it before
  re-creating, so re-triggers are clean. Safe because check-tag skips
  when the tag already exists — we only reach this point when the tag
  does NOT exist yet.
- Create PR: guard with 'gh pr view' so a pre-existing PR from a failed
  run is reused instead of causing 'pr already exists' failure.

Split the single 'git push origin $BRANCH --tags' into two pushes
(branch and tag separately) to avoid any flag ambiguity.
2026-03-24 23:13:16 +00:00
privilegedescalation-engineer[bot] 0ac29784ee fix(release): fall back to direct merge when auto-merge is rejected (#71)
On repos without required status checks in branch protection, GitHub
rejects enablePullRequestAutoMerge with 'clean status' error. Add a
fallback to direct squash merge so releases complete without manual
intervention.

Fixes: https://github.com/privilegedescalation/.github/issues/70

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.github>
2026-03-24 22:59:27 +00:00
Hugh Hackman 3b734dfa69 fix: add pnpm setup fallback when packageManager field is absent
The release job used pnpm/action-setup@v5 without a version input,
which requires a packageManager field in package.json. Repos that
don't have this field fail at Setup pnpm, blocking all releases.

Mirror the resilient two-step pattern already used in plugin-ci.yaml:
- If packageManager is present: use Corepack (respects pinned version)
- If absent: fall back to pnpm/action-setup@v5 with version: latest

Fixes the systemic v1.0.0 release failures across kube-vip, sealed-secrets,
tns-csi, and rook (PRI-866).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 22:25:13 +00:00
Hugh Hackman e21ab550e4 ci: upgrade GitHub Actions to Node.js 24-compatible versions
Update shared workflow action versions ahead of the June 2, 2026 deadline
when GitHub forces all actions from Node.js 20 to Node.js 24:

- actions/setup-node@v4 → @v6
- actions/cache@v4 → @v5
- pnpm/action-setup@v4 → @v5
- actions/create-github-app-token@v1 → @v3

Affects: plugin-ci.yaml, plugin-release.yaml, ci-health-check.yaml

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-24 16:10:18 +00:00
Hugh Hackman ca5ab75f6b ci: remove version: latest from pnpm setup in plugin-release
pnpm/action-setup@v4 errors with ERR_PNPM_BAD_PM_VERSION when both
`version` (in the workflow) and `packageManager` (in package.json) are
specified. Remove the hardcoded `version: latest` from plugin-release
so that repos can pin their pnpm version via the packageManager field
in package.json.

When packageManager is absent the action falls back to latest (same
prior behavior). When packageManager is set it is used exclusively,
which prevents silent version drift.

The plugin-ci.yaml change is handled separately in PR #54.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-22 05:09:31 +00:00
Hugh Hackman a62d4181ee ci: add pnpm detection to plugin-release workflow
Mirrors the pnpm-detection logic from plugin-ci.yaml. When a repo has
pnpm-lock.yaml, the release job now: sets up pnpm, caches with pnpm,
runs pnpm install --frozen-lockfile, and commits pnpm-lock.yaml (not
package-lock.json) in the release branch.

Fixes the CI/release divergence where headlamp-polaris-plugin's CI used
pnpm strict hoisting but releases installed with npm, allowing dependency
resolution differences to reach production.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-22 04:40:27 +00:00
Hugh Hackman f564499a79 fix: use printf to avoid multi-line YAML literal block break
The multi-line --body string had cc @cpfarhood at column 0, which
terminated the YAML literal block scalar prematurely and caused
actionlint to reject the workflow file. Use printf to construct
the body string without embedding a literal newline in the YAML.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-21 23:09:49 +00:00
github-actions[bot] 494a8051af fix: add cc @cpfarhood to release PR body per org policy
All PRs must include cc @cpfarhood. The automated release PR
body generated by plugin-release.yaml was missing this.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-21 22:57:47 +00:00
privilegedescalation-engineer[bot] 3d7e7d1dff fix: skip release gracefully when RELEASE_APP_ID is not configured
Adds a check-secrets job that runs before any expensive work. When
RELEASE_APP_ID is empty (org secret not yet set, tracked in PRI-380),
the workflow exits cleanly with a notice instead of running the full
build and failing at the GitHub App token step.

Previously this left dangling state: a pushed tag, a GitHub Release,
and a release branch — but no version-bump PR. Now the workflow skips
all of that and exits clean.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-21 00:31:37 +00:00
privilegedescalation-ceo[bot] 507e8633eb fix: skip duplicate release gracefully when tag already exists
* fix: skip duplicate release gracefully when tag already exists

Replace inline exit-1 tag check with a dedicated check-tag job that uses
the GitHub API. When the tag already exists, check-tag outputs skip=true
and the release job is conditionally skipped via if: condition. Workflow
now reports success (not failure) for duplicate release attempts.

Fixes #30 (partial) — resolves the tag-already-exists failure mode.

Co-Authored-By: Hugh Hackman <hugh@privilegedescalation.io>

* fix: use curl instead of gh CLI in check-tag job for portability

gh CLI may not be pre-installed on ARC runners. curl is always available
in container images. Avoids potential startup failure if gh binary is absent.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* fix: drop -f flag from curl in check-tag to avoid exit on 404

With -f, curl exits non-zero when the tag does not exist (404). In GitHub
Actions bash steps (set -e), this could cause the step to fail before the
if-block runs. Using -s alone: curl always exits 0 on network success,
HTTP_CODE is captured correctly for both 200 and 404 cases.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

---------

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.io>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-03-20 22:33:28 +00:00
privilegedescalation-paperclip[bot] 453e320f35 fix: use GitHub App token for release PR creation (#31)
The org blocks GITHUB_TOKEN from creating pull requests
("Write permissions for workflows are disabled by the organization").
Switch to a GitHub App installation token generated via
actions/create-github-app-token for the PR creation step.

Requires org-level secrets RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY
to be configured. Calling workflows must pass these secrets.

Closes #30

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 13:24:28 +00:00
privilegedescalation-paperclip[bot] d733a720af fix: install gh CLI to user-writable path on ARC runners (#29)
ARC runner containers run as non-root, so `mv` to /usr/local/bin fails
with permission denied. Install to $HOME/.local/bin instead and add to
GITHUB_PATH.

Co-authored-by: Hugh Hackman [bot] <hugh-hackman[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:32:56 +00:00
Hugh Hackman bff9014cf8 fix: update runner label from local-ubuntu-latest to runners-privilegedescalation
ARC runner scale set was recreated on 2026-03-19 with label
`runners-privilegedescalation` but all shared workflows still referenced
`local-ubuntu-latest`. This label mismatch caused startup_failure on
every Release workflow and queued CI jobs with no runner to pick them up.

Updates all 4 workflows and the actionlint config to match the current
ARC runner scale set label.

Closes #27
2026-03-19 20:11:51 +00:00
Hugh Hackman[bot] cfb35fe73d ci: update actions/checkout from v4 to v6 in all reusable workflows
actions/checkout v6 was already adopted in headlamp-agent-skills.
This brings the org-level reusable workflows (plugin-ci, plugin-release,
ci-health-check) up to the same version. Affects all plugin repos that
call these shared workflows.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-18 07:24:02 +00:00
hugh-hackman[bot] 538a7bf024 ci: use binary download for gh CLI install on self-hosted runners (#18)
The apt-based gh CLI install requires sudo which is not available on our
self-hosted container runners. Replace with a direct binary download from
GitHub releases that works without elevated permissions.

Fixes the "gh: command not found" error in the release workflow's
"Create PR for version bump" step.

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-03-17 17:44:34 +00:00
Hugh Hackman 4c0ad08db3 ci: install gh CLI in release workflow for self-hosted runners
The self-hosted runner (local-ubuntu-latest) does not have gh CLI
pre-installed, causing the PR creation step to fail with
"gh: command not found" after the release is published.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-17 12:34:16 +00:00
hugh-hackman[bot] 510569be7b ci: remove Docker container from release workflow
Remove container: node from the release job to avoid Docker Hub rate
limits on self-hosted runners. Uses actions/setup-node@v4 instead,
matching the pattern already applied in plugin-ci.yaml (PR#14).

Changes:
- Remove container: node:${{ inputs.node-version }}
- Add setup-node@v4 step with npm cache after checkout
- Remove apt-get install step (jq, curl, git already on runner)
- Remove manual GitHub CLI install step (gh already on runner)

Co-authored-by: Hugh Hackman <hugh@privilegedescalation.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-03-16 10:52:05 +00:00
hugh-hackman[bot] d0b4428af7 fix: remove Docker container from CI, use setup-node instead
Eliminates Docker Hub rate limit by replacing container: node:22 with setup-node@v4.
Also fixes release workflow branch creation order.

Closes privilegedescalation/.github#14

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-15 16:55:37 +00:00
hugh-hackman[bot] 0ef78ac580 feat: make reusable workflows strictly container-native (#10)
Co-authored-by: gandalf-the-greybeard[bot] <gandalf-the-greybeard[bot]@users.noreply.github.com>
2026-03-10 23:44:40 +00:00
Chris Farhood 4361c131f0 Merge pull request #9 from privilegedescalation/fix/release-workflow-branch-protection
fix: release workflow creates PR instead of pushing to main
2026-03-09 17:09:10 -04:00
gandalf-the-greybeard[bot] 7a035654c9 feat: auto-merge and cleanup release version bump PRs
The release PR is just a version bump + checksum update. Enable
auto-merge with squash and delete the release branch after merge
to prevent branch accumulation.
2026-03-09 19:22:10 +00:00
gandalf-the-greybeard[bot] caee689f15 fix: release workflow creates PR instead of pushing to main
The release workflow pushed directly to main which fails on repos
with branch protection enabled. This broke the polaris plugin v0.7.0
release.

Changes:
- Create release/vX.Y.Z branch instead of committing to main
- Push to the release branch + tags
- Create a PR to merge the version bump back to main
- Add pull-requests: write permission
2026-03-09 19:18:07 +00:00
gandalf-the-greybeard[bot] 254bd4fbc3 fix: add tag-exists guard to release workflow
Fail fast when a release tag already exists instead of running the
full build+package cycle only to fail at git push. Saves CI time on
duplicate workflow_dispatch triggers.
2026-03-09 06:20:52 +00:00
hugh-hackman[bot] 521d120425 feat: add reusable CI and release workflows for Headlamp plugins 2026-03-08 00:44:51 +00:00