Skip to content

Fail the entire build when a requested credential cannot be found#144

Merged
jglick merged 5 commits intojenkinsci:masterfrom
nattofriends:missing-credential-fails-build
Apr 9, 2024
Merged

Fail the entire build when a requested credential cannot be found#144
jglick merged 5 commits intojenkinsci:masterfrom
nattofriends:missing-credential-fails-build

Conversation

@nattofriends
Copy link
Contributor

JENKINS-32104

This is my first contribution to any public Jenkins code, hopefully didn't miss anything.

I also edited the message to interpolate the name of the requested credential; Credential Binding's message also does this.

Testing done

  • Added SSHAgentStepWorkflowTest.testMissingCredential
### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [x] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue

@nattofriends nattofriends requested a review from a team as a code owner April 4, 2024 01:04
@nattofriends nattofriends force-pushed the missing-credential-fails-build branch from 3ca664d to eec7d02 Compare April 4, 2024 10:37
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! I left some minor suggestions (nothing blocking merge, if you are out of time).

I marked the issue In Review but could not find a Jira identifier for you to assign it to.

@jglick jglick added the bug label Apr 8, 2024
@jglick jglick merged commit f8027ab into jenkinsci:master Apr 9, 2024
@torbendury
Copy link

@nattofriends This bug was old enough for me to never notice it was actually buggy behavior :-)

Do I understand the new flag ignoreMissing correctly that it is going to "restore" the old behavior of pipeline scripts not failing completely when sshagent is unable to find credentials?

@nattofriends
Copy link
Contributor Author

@nattofriends This bug was old enough for me to never notice it was actually buggy behavior :-)

Do I understand the new flag ignoreMissing correctly that it is going to "restore" the old behavior of pipeline scripts not failing completely when sshagent is unable to find credentials?

That flag isn't new, it has always been there. But my understanding is that it can be used to achieve the behavior you are looking for.

@deribaucourt
Copy link

This also broke my existing pipelines which relied on configurable Credentials. We used to have a non existent 'None' credential by default as a placeholder.
When upgrading over 360.vf8027a_b_0c912, people relying on non existing Jenkins credentials should update their pipeline files with ignoreMissing like so:

// Old
sshagent(credentials: [ExampleCred1, ExampleCred2]) {
    ...
}
// New
sshagent(credentials: [ExampleCred1, ExampleCred2], ignoreMissing: true) {
    ...
}

@jglick
Copy link
Member

jglick commented May 30, 2024

(added a warning to https://github.com/jenkinsci/ssh-agent-plugin/releases/tag/360.vf8027a_b_0c912)

ti-chi-bot bot referenced this pull request in PingCAP-QE/ee-ops Sep 9, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ssh-agent](https://togithub.com/jenkinsci/ssh-agent-plugin) | major |
`346.vda_a_c4f2c8e50` -> `376.v8933585c69d3` |

---

### Release Notes

<details>
<summary>jenkinsci/ssh-agent-plugin (ssh-agent)</summary>

###
[`v376.v8933585c69d3`](https://togithub.com/jenkinsci/ssh-agent-plugin/releases/tag/376.v8933585c69d3)

[Compare
Source](https://togithub.com/jenkinsci/ssh-agent-plugin/compare/367.vf9076cd4ee21...376.v8933585c69d3)

<!-- Optional: add a release summary here -->

#### 🐛 Bug fixes

- Simplified plugin impl, removed unreliable `onResume`
([#&#8203;152](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/152))
[@&#8203;jglick](https://togithub.com/jglick)

#### 📦 Dependency updates

- Bump org.jenkins-ci.plugins:plugin from 4.80 to 4.85
([#&#8203;151](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/151))
[@&#8203;dependabot](https://togithub.com/dependabot)
- Bump io.jenkins.tools.incrementals:git-changelist-maven-extension from
1.7 to 1.8
([#&#8203;148](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/148))
[@&#8203;dependabot](https://togithub.com/dependabot)

###
[`v367.vf9076cd4ee21`](https://togithub.com/jenkinsci/ssh-agent-plugin/releases/tag/367.vf9076cd4ee21)

[Compare
Source](https://togithub.com/jenkinsci/ssh-agent-plugin/compare/360.vf8027a_b_0c912...367.vf9076cd4ee21)

<!-- Optional: add a release summary here -->

#### 👷 Changes for plugin developers

- Add `trilead-api` to test classpath
([#&#8203;145](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/145))
[@&#8203;jglick](https://togithub.com/jglick)

#### 📦 Dependency updates

- Bump io.jenkins.tools.bom:bom-2.387.x from 2423.vce598171d115 to
2543.vfb\_1a\_5fb\_9496d
([#&#8203;139](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/139))
[@&#8203;dependabot](https://togithub.com/dependabot)
- Bump org.jenkins-ci.plugins:plugin from 4.78 to 4.80
([#&#8203;143](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/143))
[@&#8203;dependabot](https://togithub.com/dependabot)

###
[`v360.vf8027a_b_0c912`](https://togithub.com/jenkinsci/ssh-agent-plugin/releases/tag/360.vf8027a_b_0c912)

[Compare
Source](https://togithub.com/jenkinsci/ssh-agent-plugin/compare/346.vda_a_c4f2c8e50...360.vf8027a_b_0c912)

:warning: You may need to add `ignoreMissing: true` to certain
pipelines:
[https://github.com/jenkinsci/ssh-agent-plugin/pull/144#issuecomment-2139534739](https://togithub.com/jenkinsci/ssh-agent-plugin/pull/144#issuecomment-2139534739)

#### 🐛 Bug fixes

- Fail the entire build when a requested credential cannot be found
([#&#8203;144](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/144))
[@&#8203;nattofriends](https://togithub.com/nattofriends)

#### 📦 Dependency updates

- Bump org.jenkins-ci.plugins:plugin from 4.77 to 4.78
([#&#8203;142](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/142))
[@&#8203;dependabot](https://togithub.com/dependabot)
- Bump org.jenkins-ci.plugins:plugin from 4.76 to 4.77
([#&#8203;141](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/141))
[@&#8203;dependabot](https://togithub.com/dependabot)
- Bump org.jenkins-ci.plugins:plugin from 4.75 to 4.76
([#&#8203;140](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/140))
[@&#8203;dependabot](https://togithub.com/dependabot)
- Update to 2.387.x
([#&#8203;138](https://togithub.com/jenkinsci/ssh-agent-plugin/issues/138))
[@&#8203;jglick](https://togithub.com/jglick)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/PingCAP-QE/ee-ops).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xOC4xNyIsInVwZGF0ZWRJblZlciI6IjM4LjU2LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants