Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print immutable action package details in set up job logs #3645

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Runner.Worker/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +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($"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
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
};
}
heavymachinery marked this conversation as resolved.
Show resolved Hide resolved

private MediaTypeFormatter m_formatter;
private Uri m_launchServiceUrl;
private string m_token;
Expand Down
Loading