public static void HelmChartMuseumUpload(this Cake.Core.ICakeContext context, HelmChartMuseumUploadSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var requestUri = new Uri(new Uri(settings.MuseumUrl), "api/charts");
            var file       = new FileInfo(settings.Path);

            using (var client = new HttpClient())
                using (var stream = file.OpenRead())
                {
                    if (!string.IsNullOrEmpty(settings.Username))
                    {
                        var byteArray = Encoding.ASCII.GetBytes($"{settings.Username}:{settings.Password}");
                        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                    }
                    var response = client.PostAsync(requestUri, new StreamContent(stream)).Result;
                    response.EnsureSuccessStatusCode();
                }
        }
Ejemplo n.º 2
0
        public static void HelmLint(this Cake.Core.ICakeContext context, HelmLintSettings settings, string path)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var tool = new HelmTool <HelmLintSettings>(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);

            tool.Run("lint", settings ?? new HelmLintSettings(), new string[] { path });
        }
        public static string HandlebarsRenderText(this Cake.Core.ICakeContext context, string template, object data)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var compiled = global::HandlebarsDotNet.Handlebars.Compile(template);

            return(compiled(data));
        }
Ejemplo n.º 4
0
        public static string HandlebarsRenderTextFile(this Cake.Core.ICakeContext context, FilePath templateFile, object data)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var template = File.ReadAllText(templateFile.FullPath);

            return(context.HandlebarsRenderText(template, data));
        }
Ejemplo n.º 5
0
 public static void HelmLint(this Cake.Core.ICakeContext context, string path)
 {
     HelmLint(context, null, path);
 }
Ejemplo n.º 6
0
        public static void HandlebarsRenderTextFile(this Cake.Core.ICakeContext context, FilePath templateFile, FilePath targetFile, object data)
        {
            var contents = context.HandlebarsRenderTextFile(templateFile, data);

            File.WriteAllText(targetFile.FullPath, contents);
        }