Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aliyun-oss-uploader
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
aliyun-oss-uploader
Commits
bbbeddc9
Commit
bbbeddc9
authored
Mar 11, 2021
by
mantou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add one local with multiple remotes support
parent
e9fc426d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
17 deletions
+23
-17
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
+20
-16
src/main/resources/org/inurl/jenkins/plugin/OSSPublisher/help-remotePath.html
...rg/inurl/jenkins/plugin/OSSPublisher/help-remotePath.html
+2
-1
src/main/resources/org/inurl/jenkins/plugin/OSSPublisher/help-remotePath_zh.html
...inurl/jenkins/plugin/OSSPublisher/help-remotePath_zh.html
+1
-0
No files found.
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
View file @
bbbeddc9
...
...
@@ -92,24 +92,28 @@ public class OSSPublisher extends Publisher implements SimpleBuildStep {
PrintStream
logger
=
listener
.
getLogger
();
EnvVars
envVars
=
run
.
getEnvironment
(
listener
);
OSSClient
client
=
new
OSSClient
(
endpoint
,
accessKeyId
,
accessKeySecret
.
getPlainText
());
String
local
=
localPath
.
substring
(
1
);
String
remote
=
remotePath
.
substring
(
1
);
String
expandLocal
=
envVars
.
expand
(
local
);
String
expandRemote
=
envVars
.
expand
(
remote
);
logger
.
println
(
"expandLocalPath =>"
+
expandLocal
);
logger
.
println
(
"expandRemotePath =>"
+
expandRemote
);
FilePath
p
=
new
FilePath
(
workspace
,
expandLocal
);
if
(
p
.
isDirectory
())
{
logger
.
println
(
"upload dir => "
+
p
);
upload
(
client
,
logger
,
expandRemote
,
p
,
true
);
logger
.
println
(
"upload dir success"
);
}
else
{
logger
.
println
(
"upload file => "
+
p
);
uploadFile
(
client
,
logger
,
expandRemote
,
p
);
logger
.
println
(
"upload file success"
);
String
[]
remotes
=
remotePath
.
split
(
","
);
for
(
String
remote
:
remotes
)
{
remote
=
remote
.
substring
(
1
);
String
expandLocal
=
envVars
.
expand
(
local
);
String
expandRemote
=
envVars
.
expand
(
remote
);
logger
.
println
(
"expandLocalPath =>"
+
expandLocal
);
logger
.
println
(
"expandRemotePath =>"
+
expandRemote
);
FilePath
p
=
new
FilePath
(
workspace
,
expandLocal
);
if
(
p
.
isDirectory
())
{
logger
.
println
(
"upload dir => "
+
p
);
upload
(
client
,
logger
,
expandRemote
,
p
,
true
);
logger
.
println
(
"upload dir success"
);
}
else
{
logger
.
println
(
"upload file => "
+
p
);
uploadFile
(
client
,
logger
,
expandRemote
,
p
);
logger
.
println
(
"upload file success"
);
}
}
}
private
void
upload
(
OSSClient
client
,
PrintStream
logger
,
String
base
,
FilePath
path
,
boolean
root
)
...
...
src/main/resources/org/inurl/jenkins/plugin/OSSPublisher/help-remotePath.html
View file @
bbbeddc9
<div>
Remote file or directory, must begin with `/`
Remote file or directory, must begin with `/`,
one local with multiple remotes distination require,pass "," for each remote path
</div>
\ No newline at end of file
src/main/resources/org/inurl/jenkins/plugin/OSSPublisher/help-remotePath_zh.html
View file @
bbbeddc9
<div>
远程路径,必须以`/`开头
如果有本地单文件(目录),远程多文件(目录)需求,请使用","进行远程路径分隔.
</div>
\ No newline at end of file
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