Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F971614
UploadArtifactBuildStepImplementation.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
UploadArtifactBuildStepImplementation.php
View Options
<?php
final
class
UploadArtifactBuildStepImplementation
extends
BuildStepImplementation
{
public
function
getName
()
{
return
pht
(
'Upload Artifact'
);
}
public
function
getGenericDescription
()
{
return
pht
(
'Upload an artifact from a Drydock host to Phabricator.'
);
}
public
function
getDescription
()
{
$settings
=
$this
->
getSettings
();
return
pht
(
'Upload artifact located at
\'
%s
\'
on
\'
%s
\'
.'
,
$settings
[
'path'
],
$settings
[
'hostartifact'
]);
}
public
function
execute
(
HarbormasterBuild
$build
,
HarbormasterBuildTarget
$build_target
)
{
$settings
=
$this
->
getSettings
();
$variables
=
$build_target
->
getVariables
();
$path
=
$this
->
mergeVariables
(
'vsprintf'
,
$settings
[
'path'
],
$variables
);
$artifact
=
$build
->
loadArtifact
(
$settings
[
'hostartifact'
]);
$lease
=
$artifact
->
loadDrydockLease
();
$interface
=
$lease
->
getInterface
(
'filesystem'
);
// TODO: Handle exceptions.
$file
=
$interface
->
saveFile
(
$path
,
$settings
[
'name'
]);
// Insert the artifact record.
$artifact
=
$build
->
createArtifact
(
$build_target
,
$settings
[
'name'
],
HarbormasterBuildArtifact
::
TYPE_FILE
);
$artifact
->
setArtifactData
(
array
(
'filePHID'
=>
$file
->
getPHID
()));
$artifact
->
save
();
}
public
function
getArtifactInputs
()
{
return
array
(
array
(
'name'
=>
pht
(
'Upload From Host'
),
'key'
=>
$this
->
getSetting
(
'hostartifact'
),
'type'
=>
HarbormasterBuildArtifact
::
TYPE_HOST
,
),
);
}
public
function
getArtifactOutputs
()
{
return
array
(
array
(
'name'
=>
pht
(
'Uploaded File'
),
'key'
=>
$this
->
getSetting
(
'name'
),
'type'
=>
HarbormasterBuildArtifact
::
TYPE_FILE
,
),
);
}
public
function
getFieldSpecifications
()
{
return
array
(
'path'
=>
array
(
'name'
=>
pht
(
'Path'
),
'type'
=>
'text'
,
'required'
=>
true
,
),
'name'
=>
array
(
'name'
=>
pht
(
'Local Name'
),
'type'
=>
'text'
,
'required'
=>
true
,
),
'hostartifact'
=>
array
(
'name'
=>
pht
(
'Host Artifact'
),
'type'
=>
'text'
,
'required'
=>
true
,
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 5:52 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
228340
Default Alt Text
UploadArtifactBuildStepImplementation.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment