Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ THE SOFTWARE.
data-url="${rootURL}/${it.url}/test" data-context="${rootURL}">
<form method="post" action="${rootURL}/${it.url}/act" name="${it.id}">
<f:submit name="yes" value="${%More Info}"/>
<l:isAdmin>
<f:submit name="no" value="${%Dismiss}"/>
</l:isAdmin>
<l:isAdmin>
<button type="submit"
name="no"
class="jenkins-button jenkins-button--icon"
aria-label="${%Dismiss}"
tooltip="${%Dismiss}">
<l:icon src="symbol-close" />
</button>
</l:isAdmin>

</form>
<div>${%blurb}</div>
<div class="js-context-message reverse-proxy__hidden">${%missingContextMessage(rootURL)}</div>
Expand Down
11 changes: 7 additions & 4 deletions core/src/main/resources/lib/form/repeatableDeleteButton.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ THE SOFTWARE.
<st:adjunct includes="lib.form.repeatable.repeatable"/>

<j:set var="deleteText" value="${attrs.value ?: '%Delete'}" />
<button class="repeatable-delete danger" type="button" style="--width: ${deleteText.length()}ch">
<l:icon src="symbol-close" />
<span>${deleteText}</span>
</button>
<button
type="button"
class="repeatable-delete"
aria-label="${deleteText}"
tooltip="${deleteText}">
<l:icon src="symbol-close" />
</button>
</j:jelly>
94 changes: 94 additions & 0 deletions docs/useful-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Useful Usage Examples

This document provides practical, real-world usage examples for commonly used Jenkins plugins.
The goal is to help new users understand how these plugins are typically used in day-to-day Jenkins setups.

---

## 1. Git Plugin

### When to use
The Git plugin is used when your source code is stored in a Git repository such as GitHub, GitLab, or Bitbucket.

### Example: Checkout source code in a Pipeline

```groovy
pipeline {
agent any

stages {
stage('Checkout') {
steps {
git(
url: 'https://github.com/example/project.git',
branch: 'main'
)
}
}
}
}


### Example: Basic CI Pipeline

pipeline {
agent any

stages {
stage('Build') {
steps {
echo 'Building the application'
}
}

stage('Test') {
steps {
echo 'Running tests'
}
}
}
}

### Example: Using credentials securely in a pipeline

pipeline {
agent any

stages {
stage('Deploy') {
steps {
withCredentials([
string(credentialsId: 'api-token', variable: 'API_TOKEN')
]) {
sh 'echo Deploying with token $API_TOKEN'
}
}
}
}
}

### Example: Send email on build failure

pipeline {
agent any

stages {
stage('Build') {
steps {
error 'Simulated failure'
}
}
}

post {
failure {
emailext(
subject: 'Build Failed: ${env.JOB_NAME}',
body: 'The build has failed. Please check the Jenkins console output.',
to: 'team@example.com'
)
}
}
}