Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Abdullah Khabir
meo
Commits
aabc8b89
Commit
aabc8b89
authored
5 months ago
by
Abdullah Khabir
Browse files
Options
Download
Email Patches
Plain Diff
adding input param using api
parent
ee915ed3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
Jenkinsfile
Jenkinsfile
+11
-5
No files found.
Jenkinsfile
View file @
aabc8b89
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
"""
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment