mirror of
https://github.com/actions/runner.git
synced 2025-12-16 06:57:25 +00:00
@@ -40,7 +40,8 @@ namespace GitHub.DistributedTask.Pipelines
|
||||
WorkspaceOptions workspaceOptions,
|
||||
IEnumerable<JobStep> steps,
|
||||
IEnumerable<ContextScope> scopes,
|
||||
IList<String> fileTable)
|
||||
IList<String> fileTable,
|
||||
TemplateToken jobOutputs)
|
||||
{
|
||||
this.MessageType = JobRequestMessageTypes.PipelineAgentJobRequest;
|
||||
this.Plan = plan;
|
||||
@@ -52,6 +53,7 @@ namespace GitHub.DistributedTask.Pipelines
|
||||
this.Timeline = timeline;
|
||||
this.Resources = jobResources;
|
||||
this.Workspace = workspaceOptions;
|
||||
this.JobOutputs = jobOutputs;
|
||||
|
||||
m_variables = new Dictionary<String, VariableValue>(variables, StringComparer.OrdinalIgnoreCase);
|
||||
m_maskHints = new List<MaskHint>(maskHints);
|
||||
@@ -138,6 +140,13 @@ namespace GitHub.DistributedTask.Pipelines
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TemplateToken JobOutputs
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int64 RequestId
|
||||
{
|
||||
|
||||
@@ -29,7 +29,9 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
public const String Include = "include";
|
||||
public const String Inputs = "inputs";
|
||||
public const String Job = "job";
|
||||
public const String JobOutputs = "job-outputs";
|
||||
public const String Jobs = "jobs";
|
||||
public const String Labels = "labels";
|
||||
public const String Lfs = "lfs";
|
||||
public const String Matrix = "matrix";
|
||||
public const String MaxParallel = "max-parallel";
|
||||
|
||||
@@ -231,6 +231,42 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
return result;
|
||||
}
|
||||
|
||||
public Dictionary<String, String> EvaluateJobOutput(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
{
|
||||
var result = default(Dictionary<String, String>);
|
||||
|
||||
if (token != null && token.Type != TokenType.Null)
|
||||
{
|
||||
var context = CreateContext(contextData);
|
||||
try
|
||||
{
|
||||
token = TemplateEvaluator.Evaluate(context, PipelineTemplateConstants.JobOutputs, token, 0, null, omitHeader: true);
|
||||
context.Errors.Check();
|
||||
result = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
var mapping = token.AssertMapping("outputs");
|
||||
foreach (var pair in mapping)
|
||||
{
|
||||
// Literal key
|
||||
var key = pair.Key.AssertString("output key");
|
||||
|
||||
// Literal value
|
||||
var value = pair.Value.AssertString("output value");
|
||||
result[key.Value] = value.Value;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!(ex is TemplateValidationException))
|
||||
{
|
||||
context.Errors.Add(ex);
|
||||
}
|
||||
|
||||
context.Errors.Check();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IList<KeyValuePair<String, JobContainer>> EvaluateJobServiceContainers(
|
||||
TemplateToken token,
|
||||
DictionaryContextData contextData)
|
||||
@@ -364,6 +400,7 @@ namespace GitHub.DistributedTask.Pipelines.ObjectTemplating
|
||||
PipelineTemplateConstants.GitHub,
|
||||
PipelineTemplateConstants.Strategy,
|
||||
PipelineTemplateConstants.Matrix,
|
||||
PipelineTemplateConstants.Needs,
|
||||
PipelineTemplateConstants.Secrets,
|
||||
PipelineTemplateConstants.Steps,
|
||||
PipelineTemplateConstants.Inputs,
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"needs",
|
||||
"matrix",
|
||||
"secrets",
|
||||
"steps",
|
||||
@@ -66,6 +67,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
@@ -89,7 +91,8 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"one-of": [
|
||||
"string",
|
||||
@@ -112,6 +115,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -143,16 +147,20 @@
|
||||
"mapping": {
|
||||
"properties": {
|
||||
"needs": "needs",
|
||||
"if": "string",
|
||||
"if": "job-if",
|
||||
"strategy": "strategy",
|
||||
"name": "string-strategy-context",
|
||||
"runs-on": "runs-on",
|
||||
"runs-on": {
|
||||
"type": "runs-on",
|
||||
"required": true
|
||||
},
|
||||
"timeout-minutes": "number-strategy-context",
|
||||
"cancel-timeout-minutes": "number-strategy-context",
|
||||
"continue-on-error": "boolean",
|
||||
"continue-on-error": "boolean-strategy-context",
|
||||
"container": "container",
|
||||
"services": "services",
|
||||
"env": "job-env",
|
||||
"outputs": "job-outputs",
|
||||
"steps": "steps"
|
||||
}
|
||||
}
|
||||
@@ -165,9 +173,22 @@
|
||||
]
|
||||
},
|
||||
|
||||
"job-if": {
|
||||
"context": [
|
||||
"github",
|
||||
"needs",
|
||||
"always(0,0)",
|
||||
"failure(0,MAX)",
|
||||
"cancelled(0,0)",
|
||||
"success(0,MAX)"
|
||||
],
|
||||
"string": {}
|
||||
},
|
||||
|
||||
"strategy": {
|
||||
"context": [
|
||||
"github"
|
||||
"github",
|
||||
"needs"
|
||||
],
|
||||
"mapping": {
|
||||
"properties": {
|
||||
@@ -233,24 +254,23 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"one-of": [
|
||||
"runs-on-string",
|
||||
"non-empty-string",
|
||||
"sequence-of-non-empty-string",
|
||||
"runs-on-mapping"
|
||||
]
|
||||
},
|
||||
|
||||
"runs-on-string": {
|
||||
"string": {
|
||||
"require-non-empty": true
|
||||
}
|
||||
},
|
||||
|
||||
"runs-on-mapping": {
|
||||
"mapping": {
|
||||
"properties": {
|
||||
"pool": "non-empty-string"
|
||||
"pool": {
|
||||
"type": "non-empty-string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -260,7 +280,8 @@
|
||||
"github",
|
||||
"secrets",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"mapping": {
|
||||
"loose-key-type": "non-empty-string",
|
||||
@@ -268,6 +289,13 @@
|
||||
}
|
||||
},
|
||||
|
||||
"job-outputs": {
|
||||
"mapping": {
|
||||
"loose-key-type": "non-empty-string",
|
||||
"loose-value-type": "string-runner-context"
|
||||
}
|
||||
},
|
||||
|
||||
"steps": {
|
||||
"sequence": {
|
||||
"item-type": "steps-item"
|
||||
@@ -301,9 +329,12 @@
|
||||
"properties": {
|
||||
"name": "string-steps-context",
|
||||
"id": "non-empty-string",
|
||||
"if": "string",
|
||||
"if": "step-if",
|
||||
"timeout-minutes": "number-steps-context",
|
||||
"run": "string-steps-context",
|
||||
"run": {
|
||||
"type": "string-steps-context",
|
||||
"required": true
|
||||
},
|
||||
"continue-on-error": "boolean-steps-context",
|
||||
"env": "step-env",
|
||||
"working-directory": "string-steps-context",
|
||||
@@ -317,9 +348,12 @@
|
||||
"properties": {
|
||||
"name": "string-steps-context-in-template",
|
||||
"id": "non-empty-string",
|
||||
"if": "string",
|
||||
"if": "step-if-in-template",
|
||||
"timeout-minutes": "number-steps-context-in-template",
|
||||
"run": "string-steps-context-in-template",
|
||||
"run": {
|
||||
"type": "string-steps-context-in-template",
|
||||
"required": true
|
||||
},
|
||||
"continue-on-error": "boolean-steps-context-in-template",
|
||||
"env": "step-env-in-template",
|
||||
"working-directory": "string-steps-context-in-template",
|
||||
@@ -333,10 +367,13 @@
|
||||
"properties": {
|
||||
"name": "string-steps-context",
|
||||
"id": "non-empty-string",
|
||||
"if": "string",
|
||||
"if": "step-if",
|
||||
"continue-on-error": "boolean-steps-context",
|
||||
"timeout-minutes": "number-steps-context",
|
||||
"uses": "non-empty-string",
|
||||
"uses": {
|
||||
"type": "non-empty-string",
|
||||
"required": true
|
||||
},
|
||||
"with": "step-with",
|
||||
"env": "step-env"
|
||||
}
|
||||
@@ -348,16 +385,56 @@
|
||||
"properties": {
|
||||
"name": "string-steps-context-in-template",
|
||||
"id": "non-empty-string",
|
||||
"if": "string",
|
||||
"if": "step-if-in-template",
|
||||
"continue-on-error": "boolean-steps-context-in-template",
|
||||
"timeout-minutes": "number-steps-context-in-template",
|
||||
"uses": "non-empty-string",
|
||||
"uses": {
|
||||
"type": "non-empty-string",
|
||||
"required": true
|
||||
},
|
||||
"with": "step-with-in-template",
|
||||
"env": "step-env-in-template"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"step-if": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"steps",
|
||||
"job",
|
||||
"runner",
|
||||
"env",
|
||||
"always(0,0)",
|
||||
"failure(0,0)",
|
||||
"cancelled(0,0)",
|
||||
"success(0,0)"
|
||||
],
|
||||
"string": {}
|
||||
},
|
||||
|
||||
"step-if-in-template": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"steps",
|
||||
"inputs",
|
||||
"job",
|
||||
"runner",
|
||||
"env",
|
||||
"always(0,0)",
|
||||
"failure(0,0)",
|
||||
"cancelled(0,0)",
|
||||
"success(0,0)"
|
||||
],
|
||||
"string": {}
|
||||
},
|
||||
|
||||
"steps-template-reference": {
|
||||
"mapping": {
|
||||
"properties": {
|
||||
@@ -383,6 +460,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -400,6 +478,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
@@ -418,6 +497,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -435,6 +515,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
@@ -453,6 +534,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -469,7 +551,8 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"one-of": [
|
||||
"string",
|
||||
@@ -493,7 +576,8 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"mapping": {
|
||||
"loose-key-type": "non-empty-string",
|
||||
@@ -505,7 +589,8 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"one-of": [
|
||||
"non-empty-string",
|
||||
@@ -521,23 +606,24 @@
|
||||
},
|
||||
|
||||
"step-with-in-template": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
"job",
|
||||
"runner",
|
||||
"env"
|
||||
],
|
||||
"mapping": {
|
||||
"loose-key-type": "non-empty-string",
|
||||
"loose-value-type": "string"
|
||||
}
|
||||
},
|
||||
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
"job",
|
||||
"runner",
|
||||
"env"
|
||||
],
|
||||
"mapping": {
|
||||
"loose-key-type": "non-empty-string",
|
||||
"loose-value-type": "string"
|
||||
}
|
||||
},
|
||||
|
||||
"non-empty-string": {
|
||||
"string": {
|
||||
"require-non-empty": true
|
||||
@@ -550,11 +636,22 @@
|
||||
}
|
||||
},
|
||||
|
||||
"boolean-strategy-context": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"boolean": {}
|
||||
},
|
||||
|
||||
"number-strategy-context": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"number": {}
|
||||
},
|
||||
@@ -563,7 +660,8 @@
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix"
|
||||
"matrix",
|
||||
"needs"
|
||||
],
|
||||
"string": {}
|
||||
},
|
||||
@@ -573,6 +671,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -587,6 +686,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
@@ -602,6 +702,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -616,6 +717,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
@@ -626,11 +728,27 @@
|
||||
"number": {}
|
||||
},
|
||||
|
||||
"string-runner-context": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
"runner",
|
||||
"env"
|
||||
],
|
||||
"string": {}
|
||||
},
|
||||
|
||||
"string-steps-context": {
|
||||
"context": [
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"job",
|
||||
@@ -645,6 +763,7 @@
|
||||
"github",
|
||||
"strategy",
|
||||
"matrix",
|
||||
"needs",
|
||||
"secrets",
|
||||
"steps",
|
||||
"inputs",
|
||||
|
||||
Reference in New Issue
Block a user