Skip to content

Commit

Permalink
Print immutable action package details in set up job logs
Browse files Browse the repository at this point in the history
  • Loading branch information
heavymachinery committed Jan 9, 2025
1 parent fde5227 commit a77adc6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Runner.Worker/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,19 @@ private async Task DownloadRepositoryActionAsync(IExecutionContext executionCont
// make sure we get a clean folder ready to use.
IOUtil.DeleteDirectory(destDirectory, executionContext.CancellationToken);
Directory.CreateDirectory(destDirectory);
executionContext.Output($"Download action repository '{downloadInfo.NameWithOwner}@{downloadInfo.Ref}' (SHA:{downloadInfo.ResolvedSha})");
}

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($"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());
Expand Down
13 changes: 13 additions & 0 deletions src/Sdk/DTWebApi/WebApi/ActionDownloadInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class ActionDownloadInfo
[DataMember(EmitDefaultValue = false)]
public ActionDownloadAuthentication Authentication { get; set; }

[DataMember(EmitDefaultValue = false)]
public ActionDownloadPackageDetails PackageDetails { get; set; }

[DataMember(EmitDefaultValue = false)]
public string NameWithOwner { get; set; }

Expand Down Expand Up @@ -37,4 +40,14 @@ public class ActionDownloadAuthentication
[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; }
}
}
14 changes: 14 additions & 0 deletions src/Sdk/WebApi/WebApi/LaunchContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class ActionDownloadInfoResponse
{
[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; }
Expand Down Expand Up @@ -59,6 +62,17 @@ public class ActionDownloadAuthenticationResponse
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
{
Expand Down
16 changes: 16 additions & 0 deletions src/Sdk/WebApi/WebApi/LaunchHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private static ActionDownloadInfo ToServerData(ActionDownloadInfoResponse action
TarballUrl = actionDownloadInfoResponse.TarUrl,
Ref = actionDownloadInfoResponse.Version,
ZipballUrl = actionDownloadInfoResponse.ZipUrl,
PackageDetails = ToServerData(actionDownloadInfoResponse.PackageDetails)
};
}

Expand All @@ -108,6 +109,21 @@ private static ActionDownloadInfo ToServerData(ActionDownloadInfoResponse action
};
}


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;
Expand Down

0 comments on commit a77adc6

Please sign in to comment.