private async Task AddEntry()

in tool/TeamCity.Docker/ContextFactory.cs [118:142]


        private async Task<Result> AddEntry([NotNull] TarOutputStream archive, [NotNull] string filePathInArchive, [NotNull] Stream contentStream)
        {
            if (archive == null)
            {
                throw new ArgumentNullException(nameof(archive));
            }

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

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

            var entry = TarEntry.CreateTarEntry(filePathInArchive);
            entry.Size = contentStream.Length;
            entry.TarHeader.Mode = Chmod; //chmod 755
            archive.PutNextEntry(entry);
            var result = await _streamService.Copy(contentStream, archive, $"Adding {filePathInArchive}");
            archive.CloseEntry();
            return result;
        }