public ArtifactDetails CreatePackage(string currentSerializationFolder, string currentBuildNumber, string sourcePath = null)
        {
            //Step 1. Get Current Production Release Number from OD
            var version = _octopusDeployService.FindCurrentlyDeployedProductionVersion(_octopusDeploySettings.ProjectName, _octopusDeploySettings.EnvironmentName);

            //Step 2. Get Production Build Number From TC
            var buildNumber = new BasicOctopusToTeamcityMappingStrategy().GetTeamCityBuildNumberFromOctopusReleaseNumber(version.VersionNumber);

            //Step 3. Get Serlization folder that you have stored as an artifact
            var sourceZip = _artifactRepository.DownloadSerializationAsset("v" + buildNumber);

            if (string.IsNullOrEmpty(sourcePath))
            {
                sourcePath = Directory.GetCurrentDirectory() + "\\ExtractedZip";
            }

            if (Directory.Exists(sourcePath))
            {
                Directory.Delete(sourcePath, true);
            }

            Directory.CreateDirectory(sourcePath);

            ZipFile.ExtractToDirectory(sourceZip, sourcePath);

            //Step 4. Generate content package via Diff based on the old serlization  compared to new one (Courier!)
            //Step 5. Generate ItemsToPublish.json for Sitecore.Ship

            var packageGenerator = new SitecoreContentPackageGenerator(new SitecoreSerializationDiffGenerator(new ItemsToDeleteSettings()));
            var artifactDetails  = packageGenerator.CreateArtifacts(sourcePath + "\\serialization\\", currentSerializationFolder);

            _artifactRepository.CreateSerializationAsset("v" + currentBuildNumber, currentSerializationFolder);

            return(artifactDetails);
        }
Пример #2
0
        public string CreateReleaseNotes(string currentCommitId)
        {
            //Step 1. Get Current Production Release Number from OD
            var octopusDeployVersion = _octopusDeployService.FindCurrentlyDeployedProductionVersion(_octopusDeploySettings.ProjectName, _octopusDeploySettings.EnvironmentName);

            //Step 2. Get Build Number From TC
            var buildNumber = _octopusToTeamcityMappingStrategy.GetTeamCityBuildNumberFromOctopusReleaseNumber(octopusDeployVersion.VersionNumber);

            // Step 3. Get tag label
            var tagLabel = _buildIdToTagNameStratergy.GetTagName(buildNumber);

            //Step 4. Get Commits since last deploy.
            var commits = _sourceControlService.GetCommitsBetweenTag_AndCommit(tagLabel, currentCommitId);

            //Step 5. Get Rsolved Jira issues since last deploy

            var issues = _bugTrackingService.GetIssuesResolvedSinceDate(octopusDeployVersion.DateReleaseCreated);

            //Step 6. Collate commits and issues into text document and save to disk.

            return(new ReleaseNoteFileCreator().CreateFile(commits, issues));
        }