diff --git a/Jenkinsfile b/Jenkinsfile index f2f87bb142dd38852cac484826890a06d5e84fa8..f905dad21258a89dae467c848493bac9eed79fca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ 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 """