Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-sb-devops
Commits
603e09ae
Unverified
Commit
603e09ae
authored
5 years ago
by
Harsha
Committed by
GitHub
5 years ago
Browse files
Options
Download
Patches
Plain Diff
Create copy_file_to_wksp.groovy
parent
3bd9a772
release-3.4.0-shared-lib
release-2.7.0-shared-lib
release-2.6.0-shared-lib
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vars/copy_file_to_wksp.groovy
+43
-0
vars/copy_file_to_wksp.groovy
with
43 additions
and
0 deletions
+43
-0
vars/copy_file_to_wksp.groovy
0 → 100644
+
43
−
0
View file @
603e09ae
def
inputGetFile
(
Map
pipelineParams
,
String
savedfile
=
null
)
{
def
filedata
=
null
def
filename
=
null
// Get file using input step, will put it in build directory
// the filename will not be included in the upload data, so optionally allow it to be specified
ansiColor
(
'xterm'
)
{
String
ANSI_GREEN
=
"\u001B[32m"
String
ANSI_NORMAL
=
"\u001B[0m"
String
ANSI_BOLD
=
"\u001B[1m"
String
ANSI_RED
=
"\u001B[31m"
String
ANSI_YELLOW
=
"\u001B[33m"
if
(
savedfile
==
null
)
{
def
inputFile
=
input
message:
'Upload file'
,
parameters:
[
file
(
name:
'library_data_upload'
),
string
(
name:
'filename'
,
defaultValue:
'token.xlsx'
)]
filedata
=
inputFile
[
'library_data_upload'
]
filename
=
inputFile
[
'filename'
]
}
else
{
def
inputFile
=
input
message:
'Upload file'
,
parameters:
[
file
(
name:
'library_data_upload'
)]
filedata
=
inputFile
filename
=
savedfile
}
// Read contents and write to workspace
writeFile
(
file:
filename
,
encoding:
'Base64'
,
text:
filedata
.
read
().
getBytes
().
encodeBase64
().
toString
())
filedata
.
delete
()
stage
(
'ansible-run'
)
{
println
pipelineParams
inventory_path
=
"${pipelineParams.currentWs}/ansible/inventory/env"
sh
"""
cp --preserve=links ${pipelineParams.currentWs}/private/ansible/inventory/${pipelineParams.env}/${
pipelineParams.module
}/* ${pipelineParams.currentWs}/ansible/inventory/env/
ansible-playbook -i ${
inventory_path
} $pipelineParams.ansiblePlaybook $pipelineParams.ansibleExtraArgs
"""
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets