mirror of
https://github.com/actions/runner.git
synced 2025-12-13 10:05:23 +00:00
Print immutable action package details in set up job logs (#3645)
* Print immutable action package details in set up job logs * "Source commit SHA" instead of "Commit SHA" for immutable actions logs --------- Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
This commit is contained in:
@@ -775,8 +775,20 @@ namespace GitHub.Runner.Worker
|
||||
// make sure we get a clean folder ready to use.
|
||||
IOUtil.DeleteDirectory(destDirectory, executionContext.CancellationToken);
|
||||
Directory.CreateDirectory(destDirectory);
|
||||
|
||||
if (downloadInfo.PackageDetails != null)
|
||||
{
|
||||
executionContext.Output($"##[group]Download immutable action package '{downloadInfo.NameWithOwner}@{downloadInfo.Ref}'");
|
||||
executionContext.Output($"Version: {downloadInfo.PackageDetails.Version}");
|
||||
executionContext.Output($"Digest: {downloadInfo.PackageDetails.ManifestDigest}");
|
||||
executionContext.Output($"Source commit SHA: {downloadInfo.ResolvedSha}");
|
||||
executionContext.Output("##[endgroup]");
|
||||
}
|
||||
else
|
||||
{
|
||||
executionContext.Output($"Download action repository '{downloadInfo.NameWithOwner}@{downloadInfo.Ref}' (SHA:{downloadInfo.ResolvedSha})");
|
||||
}
|
||||
}
|
||||
|
||||
//download and extract action in a temp folder and rename it on success
|
||||
string tempDirectory = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Actions), "_temp_" + Guid.NewGuid());
|
||||
|
||||
@@ -9,6 +9,9 @@ namespace GitHub.DistributedTask.WebApi
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public ActionDownloadAuthentication Authentication { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public ActionDownloadPackageDetails PackageDetails { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public string NameWithOwner { get; set; }
|
||||
|
||||
@@ -37,4 +40,14 @@ namespace GitHub.DistributedTask.WebApi
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public string Token { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ActionDownloadPackageDetails
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public string ManifestDigest { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ namespace GitHub.Services.Launch.Contracts
|
||||
[DataMember(EmitDefaultValue = false, Name = "authentication")]
|
||||
public ActionDownloadAuthenticationResponse Authentication { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "package_details")]
|
||||
public ActionDownloadPackageDetailsResponse PackageDetails { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
@@ -59,6 +62,17 @@ namespace GitHub.Services.Launch.Contracts
|
||||
public string Token { get; set; }
|
||||
}
|
||||
|
||||
|
||||
[DataContract]
|
||||
public class ActionDownloadPackageDetailsResponse
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false, Name = "version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "manifest_digest")]
|
||||
public string ManifestDigest { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ActionDownloadInfoResponseCollection
|
||||
{
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace GitHub.Services.Launch.Client
|
||||
TarballUrl = actionDownloadInfoResponse.TarUrl,
|
||||
Ref = actionDownloadInfoResponse.Version,
|
||||
ZipballUrl = actionDownloadInfoResponse.ZipUrl,
|
||||
PackageDetails = ToServerData(actionDownloadInfoResponse.PackageDetails)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,6 +109,21 @@ namespace GitHub.Services.Launch.Client
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private static ActionDownloadPackageDetails? ToServerData(ActionDownloadPackageDetailsResponse? actionDownloadPackageDetails)
|
||||
{
|
||||
if (actionDownloadPackageDetails == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ActionDownloadPackageDetails
|
||||
{
|
||||
Version = actionDownloadPackageDetails.Version,
|
||||
ManifestDigest = actionDownloadPackageDetails.ManifestDigest
|
||||
};
|
||||
}
|
||||
|
||||
private MediaTypeFormatter m_formatter;
|
||||
private Uri m_launchServiceUrl;
|
||||
private string m_token;
|
||||
|
||||
Reference in New Issue
Block a user