Exemple #1
0
        string PerformVariableReplacement(RunningDeployment deployment, S3PackageOptions options)
        {
            Guard.NotNull(deployment.StagingDirectory, "deployment.StagingDirectory must not be null");

            if (options.VariableSubstitutionPatterns.IsNullOrEmpty() && options.StructuredVariableSubstitutionPatterns.IsNullOrEmpty())
            {
                return(deployment.PackageFilePath);
            }

            var stagingDirectory     = deployment.StagingDirectory;
            var substitutionPatterns = SplitFilePatternString(options.VariableSubstitutionPatterns);

            substituteInFiles.Substitute(stagingDirectory, substitutionPatterns);

            var structuredSubstitutionPatterns = SplitFilePatternString(options.StructuredVariableSubstitutionPatterns);

            structuredConfigVariablesService.ReplaceVariables(stagingDirectory, structuredSubstitutionPatterns.ToList());

            return(Repackage(stagingDirectory, Path.GetFileName(deployment.PackageFilePath)));
        }
Exemple #2
0
        /// <summary>
        /// Uploads the given package file with the provided package options
        /// </summary>
        /// <param name="clientFactory"></param>
        /// <param name="deployment"></param>
        /// <param name="options"></param>
        public S3UploadResult UploadUsingPackage(Func <AmazonS3Client> clientFactory, RunningDeployment deployment, S3PackageOptions options)
        {
            Guard.NotNull(deployment, "Deployment may not be null");
            Guard.NotNull(options, "Package options may not be null");
            Guard.NotNull(clientFactory, "Client factory must not be null");

            return(CreateRequest(deployment.PackageFilePath,
                                 GetBucketKey(fileSystem, deployment.PackageFilePath, options), options)
                   .Tee(x => LogPutObjectRequest("entire package", x))
                   .Map(x => HandleUploadRequest(clientFactory(), x, ThrowInvalidFileUpload)));
        }
Exemple #3
0
        /// <summary>
        /// Uploads the given package file with the provided package options
        /// </summary>
        /// <param name="clientFactory"></param>
        /// <param name="deployment"></param>
        /// <param name="options"></param>
        public Task <S3UploadResult> UploadUsingPackage(Func <AmazonS3Client> clientFactory, RunningDeployment deployment, S3PackageOptions options)
        {
            Guard.NotNull(deployment, "Deployment may not be null");
            Guard.NotNull(options, "Package options may not be null");
            Guard.NotNull(clientFactory, "Client factory must not be null");

            var targetArchivePath = PerformVariableReplacement(deployment, options);

            var filename = GetNormalizedPackageFilename(deployment);

            return(CreateRequest(targetArchivePath,
                                 GetBucketKey(filename, options, targetArchivePath), options)
                   .Tee(x => LogPutObjectRequest("entire package", x))
                   .Map(x => HandleUploadRequest(clientFactory(), x, ThrowInvalidFileUpload)));
        }