Browse Source

Update manifest

jkotalik/porter
Justin Kotalik 6 years ago
parent
commit
4dbbed9c7f
  1. 22
      src/Microsoft.Tye.Core/PorterManifestGenerator.cs
  2. 10
      src/Microsoft.Tye.Core/PorterPublisher.cs

22
src/Microsoft.Tye.Core/PorterManifestGenerator.cs

@ -32,6 +32,28 @@ namespace Microsoft.Tye
mapping.Add("tag", image.ImageTag);
}
}
var mixins = new YamlSequenceNode();
root.Add("mixins", mixins);
mixins.Add("exec");
var installSeq = new YamlSequenceNode();
root.Add("install", installSeq);
var installExec = new YamlMappingNode();
installSeq.Add(installExec);
var args = new YamlMappingNode();
installExec.Add("exec", args);
args.Add("command", "ls");
args.Add("description", "ls");
//root.Add("upgrade", "");
var uninstallSeq = new YamlSequenceNode();
root.Add("uninstall", uninstallSeq);
var uninstallExec = new YamlMappingNode();
uninstallSeq.Add(uninstallExec);
var unargs = new YamlMappingNode();
uninstallExec.Add("exec", unargs);
unargs.Add("command", "ls");
unargs.Add("description", "ls");
return new YamlDocument(root);
}

10
src/Microsoft.Tye.Core/PorterPublisher.cs

@ -11,16 +11,22 @@ namespace Microsoft.Tye
{
public static async Task PublishAsync(OutputContext output, YamlDocument document, ApplicationBuilder builder)
{
var tempFile = TempFile.Create();
using var tempFile = TempFile.Create();
{
await using var stream = File.OpenWrite(tempFile.FilePath);
await using var writer = new StreamWriter(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), leaveOpen: true);
var yamlStream = new YamlStream(document);
yamlStream.Save(writer, assignAnchors: false);
}
await ProcessUtil.RunAsync("porter", $"publish -f {tempFile.FilePath}");
var res = await ProcessUtil.RunAsync("porter", $"publish -f {tempFile.FilePath}", throwOnError: false);
if (res.ExitCode != 0)
{
output.WriteInfoLine(res.StandardError);
output.WriteInfoLine(res.StandardOutput);
}
}
}
}

Loading…
Cancel
Save