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
8fdca7df
Unverified
Commit
8fdca7df
authored
Mar 22, 2020
by
raylax
Committed by
GitHub
Mar 22, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from seanchan/master
add env inject feature for upload path part
parents
dddd126d
2c177f1c
Changes
2
Show 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 @
8fdca7df
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
</parent>
</parent>
<groupId>
io.jenkins.plugins
</groupId>
<groupId>
io.jenkins.plugins
</groupId>
<artifactId>
aliyun-oss-uploader
</artifactId>
<artifactId>
aliyun-oss-uploader
</artifactId>
<version>
1.
2
-SNAPSHOT
</version>
<version>
1.
3
-SNAPSHOT
</version>
<packaging>
hpi
</packaging>
<packaging>
hpi
</packaging>
<properties>
<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<!-- 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 @
8fdca7df
...
@@ -10,6 +10,7 @@ import com.aliyun.oss.OSSClient;
...
@@ -10,6 +10,7 @@ import com.aliyun.oss.OSSClient;
import
hudson.Extension
;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.Launcher
;
import
hudson.EnvVars
;
import
hudson.model.AbstractProject
;
import
hudson.model.AbstractProject
;
import
hudson.model.Run
;
import
hudson.model.Run
;
import
hudson.model.TaskListener
;
import
hudson.model.TaskListener
;
...
@@ -89,17 +90,23 @@ public class OSSPublisher extends Publisher implements SimpleBuildStep {
...
@@ -89,17 +90,23 @@ public class OSSPublisher extends Publisher implements SimpleBuildStep {
public
void
perform
(
@Nonnull
Run
<?,
?>
run
,
@Nonnull
FilePath
workspace
,
@Nonnull
Launcher
launcher
,
public
void
perform
(
@Nonnull
Run
<?,
?>
run
,
@Nonnull
FilePath
workspace
,
@Nonnull
Launcher
launcher
,
@Nonnull
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
@Nonnull
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
PrintStream
logger
=
listener
.
getLogger
();
PrintStream
logger
=
listener
.
getLogger
();
EnvVars
envVars
=
run
.
getEnvironment
(
listener
);
OSSClient
client
=
new
OSSClient
(
endpoint
,
accessKeyId
,
accessKeySecret
.
getPlainText
());
OSSClient
client
=
new
OSSClient
(
endpoint
,
accessKeyId
,
accessKeySecret
.
getPlainText
());
String
local
=
localPath
.
substring
(
1
);
String
local
=
localPath
.
substring
(
1
);
String
remote
=
remotePath
.
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
())
{
if
(
p
.
isDirectory
())
{
logger
.
println
(
"upload dir => "
+
p
);
logger
.
println
(
"upload dir => "
+
p
);
upload
(
client
,
logger
,
r
emote
,
p
,
true
);
upload
(
client
,
logger
,
expandR
emote
,
p
,
true
);
logger
.
println
(
"upload dir success"
);
logger
.
println
(
"upload dir success"
);
}
else
{
}
else
{
logger
.
println
(
"upload file => "
+
p
);
logger
.
println
(
"upload file => "
+
p
);
uploadFile
(
client
,
logger
,
r
emote
,
p
);
uploadFile
(
client
,
logger
,
expandR
emote
,
p
);
logger
.
println
(
"upload file success"
);
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