Commit aabc8b89 authored by Abdullah Khabir's avatar Abdullah Khabir
Browse files

adding input param using api

parent ee915ed3
pipeline {
agent any
parameters {
// Define a string parameter for the tag selection
string(name: 'TAG', defaultValue: '', description: 'Enter the tag to build from (leave empty to fail the build)')
}
stages {
stage('Select Tag') {
steps {
......@@ -13,11 +18,12 @@ pipeline {
error "No tags found in the repository."
}
// Prompt the user to select a tag
def selectedTag = input(
message: 'Select a tag to build from:',
parameters: [choice(name: 'Tag', choices: tags, description: 'Select a tag to build the Docker image')]
)
// Check if the provided TAG parameter is valid
if (!params.TAG || !tags.contains(params.TAG)) {
error "Invalid tag selected. Available tags: ${tags.join(', ')}"
}
def selectedTag = params.TAG
// Tag and build the Docker image with the selected tag
sh """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment