Skip to content

Bind the pgpass credential where there is a workspace to write it to - #299

Merged
adrpo merged 1 commit into
masterfrom
fix-pgpass-credential-binding
Aug 11, 2026
Merged

Bind the pgpass credential where there is a workspace to write it to#299
adrpo merged 1 commit into
masterfrom
fix-pgpass-credential-binding

Conversation

@adrpo

@adrpo adrpo commented Aug 11, 2026

Copy link
Copy Markdown
Member

Every build of the library testing has failed since #296 was merged, before a single stage ran:

org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 5702cefc-25a7-4169-bb69-e0a675255226
org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
Perhaps you forgot to surround the withCredentials step with a step that provides this, such as: node
    at PluginClassLoader for credentials-binding//org.jenkinsci.plugins.credentialsbinding.impl.BindingStep$Execution2.doStart(BindingStep.java:131)
Finished: FAILURE

What was wrong

The password of the results database is a secret file, and Jenkins materialises such a credential by writing it into the workspace of a node. #296 bound it in the environment of the pipeline:

pipeline {
  agent none
  environment {
    PGPASSFILE = credentials('omdb-pgpass')   // no node here, no workspace
  }

The pipeline runs with agent none and gives every stage its own agent, so at the level where the binding was written there is no hudson.FilePath to write the file to, and the build dies before it starts. A secret text credential would have survived this; a file cannot.

The fix

The credential is bound where a node exists, in the two places that read the database:

  • in the environment of the two report stages, beside the IDA_EMAIL credential they already bind that way, and
  • around the test run and the cleanup in runRegressiontest, the way withSccache already binds its key.

LIBTEST_DB stays in the environment of the pipeline: it is a string and needs no workspace.

Nothing changes about how the scripts get the password — libpq still reads it through PGPASSFILE, and it still never reaches a command line or the build log.

Note

This is a hole in what I could check before merging #296: the selection logic and every script were exercised locally, but a credential binding only fails on a real Jenkins, and I have none. The right check for this change is a build.


Generated by Claude Code.

Every build of the library testing has failed since #296 with

  org.jenkinsci.plugins.workflow.steps.MissingContextVariableException:
  Required context class hudson.FilePath is missing

before a single stage ran. The password of the results database is a secret
file, and Jenkins writes such a file into the workspace of a node; #296 bound
it in the environment of the pipeline, which has agent none and therefore no
workspace at all.

It is now bound where a node exists: in the environment of the two report
stages, beside the IDA_EMAIL credential they already bind that way, and around
the test run and the cleanup in runRegressiontest, the way withSccache already
binds its key. LIBTEST_DB stays in the environment of the pipeline; it is a
string and needs nothing.

Nothing about how the scripts read the password changes: libpq still finds it
through PGPASSFILE.

---
Generated by Claude Code.
@adrpo
adrpo enabled auto-merge (squash) August 11, 2026 17:08
@adrpo
adrpo merged commit 5a54c35 into master Aug 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant