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
2c177f1c
Commit
2c177f1c
authored
Mar 15, 2020
by
mantou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add env inject feature for upload path part
parent
dddd126d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
pom.xml
pom.xml
+1
-1
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
+10
-3
No files found.
pom.xml
View file @
2c177f1c
...
...
@@ -9,7 +9,7 @@
</parent>
<groupId>
io.jenkins.plugins
</groupId>
<artifactId>
aliyun-oss-uploader
</artifactId>
<version>
1.
2
-SNAPSHOT
</version>
<version>
1.
3
-SNAPSHOT
</version>
<packaging>
hpi
</packaging>
<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
...
...
src/main/java/org/inurl/jenkins/plugin/OSSPublisher.java
View file @
2c177f1c
...
...
@@ -10,6 +10,7 @@ import com.aliyun.oss.OSSClient;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.EnvVars
;
import
hudson.model.AbstractProject
;
import
hudson.model.Run
;
import
hudson.model.TaskListener
;
...
...
@@ -89,17 +90,23 @@ public class OSSPublisher extends Publisher implements SimpleBuildStep {
public
void
perform
(
@Nonnull
Run
<?,
?>
run
,
@Nonnull
FilePath
workspace
,
@Nonnull
Launcher
launcher
,
@Nonnull
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
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
);
FilePath
p
=
new
FilePath
(
workspace
,
local
);
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
,
r
emote
,
p
,
true
);
upload
(
client
,
logger
,
expandR
emote
,
p
,
true
);
logger
.
println
(
"upload dir success"
);
}
else
{
logger
.
println
(
"upload file => "
+
p
);
uploadFile
(
client
,
logger
,
r
emote
,
p
);
uploadFile
(
client
,
logger
,
expandR
emote
,
p
);
logger
.
println
(
"upload file success"
);
}
...
...
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